Introduction

Purpose

A WordPress plugin that provides a PHP interface for developers to communicate with the Mspecs Marketing provider API.

It is responsible for retrieving and caching data, but does not include any presentation layer. It also provides a backend admin interfacing for configuration and viewing cached data.

Setup

  1. Install WordPress plugin
  2. Go to WordPress Settings » MSPECS
  3. Enter API details

Disclaimer

Lorem ipsum

\

Functions

mspecs_add_buyer_to_viewing()

mspecs_add_buyer_to_viewing(\WP_Post|string  $deal, string  $viewing_id, array  $buyer_details) : array|\WP_Error

Add a buyer to a viewing, the buyer can be a new buyer or an existing one.

Parameters

\WP_Post|string $deal
string $viewing_id
array $buyer_details

Returns

array|\WP_Error —

mspecs_add_buyer_to_viewing_slot()

mspecs_add_buyer_to_viewing_slot(\WP_Post|string  $deal, string  $viewing_id, string  $slot_id, array  $buyer_details) : array|\WP_Error

Add a buyer to a viewing slot, the buyer can be a new buyer or an existing one.

Parameters

\WP_Post|string $deal
string $viewing_id
string $slot_id
array $buyer_details

Returns

array|\WP_Error —

mspecs_add_prospective_buyer()

mspecs_add_prospective_buyer(\WP_Post|string  $deal, array  $buyer_details) : array|\WP_Error

Add a new prospective buyer to a deal. An error will be returned if the buyer is already added.

Parameters

\WP_Post|string $deal
array $buyer_details

Returns

array|\WP_Error —

mspecs_admin_capability()

mspecs_admin_capability() : mixed

Returns

mixed —

mspecs_cache_key()

mspecs_cache_key(mixed  $key_object) : mixed

Parameters

mixed $key_object

Returns

mixed —

mspecs_deal_id_from_post_id()

mspecs_deal_id_from_post_id(int  $post_id) : string

Converts WP Post ID to Mspecs ID

Parameters

int $post_id

Returns

string —

$mspecs_id

mspecs_deal_id_from_short_id()

mspecs_deal_id_from_short_id(string  $mspecs_short_id) : string

Converts Mspecs Short ID to standard Mspecs ID

Parameters

string $mspecs_short_id

Returns

string —

$mspecs_id

mspecs_file_dir()

mspecs_file_dir() : mixed

Returns

mixed —

mspecs_file_dir_url()

mspecs_file_dir_url() : mixed

Returns

mixed —

mspecs_get_bids()

mspecs_get_bids(\WP_Post|null  $deal = null) : array

Get an array of bids on a deal, ordered by ascending date then ascending amount

Parameters

\WP_Post|null $deal

Returns

array —

mspecs_get_deal()

mspecs_get_deal(\WP_Post|string  $mspecs_id) : \WP_Post|false

Get a deal by its Mspecs ID If a deal is provided instead of an ID, it will simply be returned

Parameters

\WP_Post|string $mspecs_id

Returns

\WP_Post|false —

mspecs_get_deal_files()

mspecs_get_deal_files(\WP_Post|null  $deal = null) : array

Get an array of deal files, also makes sure the file urls are correct

Parameters

\WP_Post|null $deal

Returns

array —

mspecs_get_deal_images()

mspecs_get_deal_images(\WP_Post|null  $deal = null) : array|null

Get an array of deal images, also makes sure the image urls are correct

Parameters

\WP_Post|null $deal

Returns

array|null —

mspecs_get_deal_meta()

mspecs_get_deal_meta(string  $meta_key, \WP_Post|null  $deal = null) : mixed

Get meta data from a Mspecs deal

Parameters

string $meta_key
\WP_Post|null $deal

Returns

mixed —

mspecs_get_deals()

mspecs_get_deals(array  $args = array()) : \WP_Post[]|int[]

Query Mspecs deals

Parameters

array $args

Returns

\WP_Post[]|int[] —

Array of post objects or post IDs.

mspecs_get_deals_by_meta()

mspecs_get_deals_by_meta(mixed  $key, mixed  $value) : mixed

Parameters

mixed $key
mixed $value

Returns

mixed —

mspecs_get_deals_by_office()

mspecs_get_deals_by_office(mixed  $office_id) : \WP_Post[]

Get Mspecs Deals by office

Parameters

mixed $office_id

Returns

\WP_Post[] —

mspecs_get_deals_by_status()

mspecs_get_deals_by_status(mixed  $status) : \WP_Post[]

Get Mspecs Deals by sale status

Parameters

mixed $status

Returns

\WP_Post[] —

mspecs_get_deals_by_sub_type()

mspecs_get_deals_by_sub_type(mixed  $sub_type) : \WP_Post[]

Get Mspecs Deals by object sub type

Parameters

mixed $sub_type

Returns

\WP_Post[] —

mspecs_get_deals_by_type()

mspecs_get_deals_by_type(mixed  $type) : \WP_Post[]

Get Mspecs Deals by object type

Parameters

mixed $type

Returns

\WP_Post[] —

mspecs_get_mspecs_meta()

mspecs_get_mspecs_meta(\WP_Post  $post) : array

Get all Mspecs specific meta from a post

Parameters

\WP_Post $post

Returns

array —

mspecs_get_office()

mspecs_get_office(string  $mspecs_id) : \WP_Post|false

Get an office by its Mspecs ID

Parameters

string $mspecs_id

Returns

\WP_Post|false —

mspecs_get_offices()

mspecs_get_offices(array  $args = array()) : \WP_Post[]|int[]

Query Mspecs offices

Parameters

array $args

Returns

\WP_Post[]|int[] —

Array of post objects or post IDs.

mspecs_get_organization()

mspecs_get_organization() : \WP_Post|false

Gets the organization data

Returns

\WP_Post|false —

mspecs_get_the_deal()

mspecs_get_the_deal(\WP_Post|string|null  $deal = null) : \WP_Post|null

Returns the current global $post object if it is a Mspecs Deal If the $deal parameter is passed, it will instead return the WP_Post object if it is an Mspecs Deal or deal ID

Parameters

\WP_Post|string|null $deal

Returns

\WP_Post|null —

mspecs_get_user()

mspecs_get_user(string  $mspecs_id) : \WP_Post|false

Get a user by its Mspecs ID

Parameters

string $mspecs_id

Returns

\WP_Post|false —

mspecs_get_users()

mspecs_get_users(array  $args = array()) : \WP_Post[]|int[]

Query Mspecs users

Parameters

array $args

Returns

\WP_Post[]|int[] —

Array of post objects or post IDs.

mspecs_get_viewings()

mspecs_get_viewings(\WP_Post|null  $deal = null) : array

Get an array of viewings on a deal

Parameters

\WP_Post|null $deal

Returns

array —

mspecs_image_sizes()

mspecs_image_sizes() : mixed

Returns

mixed —

mspecs_is_deal()

mspecs_is_deal(\WP_Post  $deal) : bool

Check if a WP_Post is a Mspecs Deal

Parameters

\WP_Post $deal

Returns

bool —

mspecs_prefixed_post_metas()

mspecs_prefixed_post_metas() : mixed

Returns

mixed —

mspecs_settings()

mspecs_settings(mixed  $key = null) : mixed

Parameters

mixed $key

Returns

mixed —

mspecs_update_setting()

mspecs_update_setting(mixed  $key, mixed  $value) : mixed

Parameters

mixed $key
mixed $value

Returns

mixed —