Menu

## Object_Sync_Sf_WordPress
in package

class-object-sync-sf-wordpress.php : 14

Object_Sync_Sf_WordPress class.

### Table of Contents

$debug : bool
  Whether the plugin is in debug mode
$file : string
  The main plugin file
$logging : object
  Object_Sync_Sf_Logging class
$mappings : object
  Object_Sync_Sf_Mapping class
$option_prefix : string
  The plugin's prefix when saving options to the database
$options : array<string|int, mixed>
  Method call options
$sfwp_transients : object
  Object_Sync_Sf_WordPress_Transient class
$slug : string
  The plugin's slug so we can include it when necessary
$version : string
  Current version of the plugin
$wordpress_objects : array<string|int, mixed>
  Supported WordPress objects
$wpdb : object
  Global object of `$wpdb`, the WordPress database
__construct() : mixed
  Constructor for WordPress class
cache_expiration() : The
  If there is a WordPress setting for how long to keep this specific cache, return it and set the object property Otherwise, return seconds in 24 hours
cache_get() : mixed
  Check to see if this API call exists in the cache if it does, return the transient for that key
cache_set() : bool
  Create a cache entry for the current result, with the url and args as the key
get_object_types() : array<string|int, mixed>
  Get WordPress object types
get_wordpress_object_data() : array<string|int, mixed>
  Get WordPress data based on what object it is
get_wordpress_object_fields() : array<string|int, mixed>
  Get WordPress fields for an object
get_wordpress_table_structure() : array<string|int, mixed>
  Get WordPress table structure for an object
object_create() : array<string|int, mixed>
  Create a new object of a given type.
object_delete() : array<string|int, mixed>
  Delete a WordPress object.
object_delete_link() : string
  Generate a delete link for the WordPress record.
object_edit_link() : string
  Generate an edit link for the WordPress record.
object_update() : array<string|int, mixed>
  Update an existing object. Part of CRUD for WordPress objects
object_upsert() : array<string|int, mixed>
  Create new records or update existing records.
append_tec_event_dates() : array<string|int, mixed>
  Generate date formats for The Event Calendar plugin
attachment_create() : array<string|int, mixed>
  Create a new WordPress attachment.
attachment_delete() : mixed
  Delete a WordPress attachment.
attachment_update() : array<string|int, mixed>
  Update a WordPress attachment.
attachment_upsert() : array<string|int, mixed>
  Create a new WordPress attachment or update it if a match is found.
comment_create() : array<string|int, mixed>
  Create a new WordPress comment.
comment_delete() : bool
  Delete a WordPress comment.
comment_update() : array<string|int, mixed>
  Update a WordPress comment.
comment_upsert() : array<string|int, mixed>
  Create a new WordPress comment or update it if a match is found.
create_wp_meta() : array<string|int, mixed>
  Standard method for creating meta values This works for users, posts, terms, and comments. It does not work for attachments.
object_fields() : array<string|int, mixed>
  Get all the fields for an object The important thing here is returning the fields as an array: $all_fields = array( 'key' => 'key name', 'table' => 'table name', 'methods' => array( 'create' => '', 'read' => '', 'update' => '', 'delete' => '' ) ); if there's a better way to do this than the mess of queries below, we should switch to that when we can we just need to make sure we get all applicable fields for the object itself, as well as its meta fields
post_create() : array<string|int, mixed>
  Create a new WordPress post.
post_delete() : mixed
  Delete a WordPress post.
post_update() : array<string|int, mixed>
  Update a WordPress post.
post_upsert() : array<string|int, mixed>
  Create a new WordPress post or update it if a match is found.
term_create() : array<string|int, mixed>
  Create a new WordPress term.
term_delete() : bool
  Delete a WordPress term.
term_update() : array<string|int, mixed>
  Update a WordPress term.
term_upsert() : array<string|int, mixed>
  Create a new WordPress term or update it if a match is found.
update_wp_meta() : array<string|int, mixed>
  Standard method for updating meta values This works for users, posts, terms, and comments. It does not work for attachments.
user_create() : array<string|int, mixed>
  Create a new WordPress user.
user_delete() : bool
  Delete a WordPress user.
user_update() : array<string|int, mixed>
  Update a WordPress user.
user_upsert() : array<string|int, mixed>
  Create a new WordPress user or update it if a match is found.

### Properties

#### $debug

class-object-sync-sf-wordpress.php : 91

Whether the plugin is in debug mode

`public bool $debug`

#### $file

class-object-sync-sf-wordpress.php : 28

The main plugin file

`public string $file`

#### $logging

class-object-sync-sf-wordpress.php : 56

Object_Sync_Sf_Logging class

`public object $logging`

#### $mappings

class-object-sync-sf-wordpress.php : 63

Object_Sync_Sf_Mapping class

`public object $mappings`

#### $option_prefix

class-object-sync-sf-wordpress.php : 49

The plugin's prefix when saving options to the database

`public string $option_prefix`

#### $options

class-object-sync-sf-wordpress.php : 77

Method call options

`public array<string|int, mixed> $options`

#### $sfwp_transients

class-object-sync-sf-wordpress.php : 84

Object_Sync_Sf_WordPress_Transient class

`public object $sfwp_transients`

#### $slug

class-object-sync-sf-wordpress.php : 42

The plugin's slug so we can include it when necessary

`public string $slug`

#### $version

class-object-sync-sf-wordpress.php : 21

Current version of the plugin

`public string $version`

#### $wordpress_objects

class-object-sync-sf-wordpress.php : 70

Supported WordPress objects

`public array<string|int, mixed> $wordpress_objects`

#### $wpdb

class-object-sync-sf-wordpress.php : 35

Global object of `$wpdb`, the WordPress database

`public object $wpdb`

### Methods

#### __construct()

class-object-sync-sf-wordpress.php : 96

Constructor for WordPress class

`public __construct() : mixed`

##### Return values

mixed —

#### cache_expiration()

class-object-sync-sf-wordpress.php : 536

If there is a WordPress setting for how long to keep this specific cache, return it and set the object property Otherwise, return seconds in 24 hours

`public cache_expiration(string $option_key, int $expire) : The`

##### Parameters

$option_key : string

  The cache item to keep around.

$expire : int

  The default time after which to expire the cache.

##### Return values

The —

cache expiration saved in the database.

#### cache_get()

class-object-sync-sf-wordpress.php : 490

Check to see if this API call exists in the cache if it does, return the transient for that key

`public cache_get(string $url, array<string|int, mixed> $args) : mixed`

##### Parameters

$url : string

  The API call we'd like to make.

$args : array<string|int, mixed>

  The arguents of the API call.

##### Return values

mixed —

#### cache_set()

class-object-sync-sf-wordpress.php : 512

Create a cache entry for the current result, with the url and args as the key

`public cache_set(string $url, array<string|int, mixed> $args, array<string|int, mixed> $data[, string $cache_expiration = '' ]) : bool`

##### Parameters

$url : string

  The API query URL.

$args : array<string|int, mixed>

  The arguments passed on the API query.

$data : array<string|int, mixed>

  The data received.

$cache_expiration : string = ''

  How long to keep the cache result around for.

##### Tags

link
  https://wordpress.stackexchange.com/questions/174330/transient-storage-location-database-xcache-w3total-cache

##### Return values

bool —

whether or not the value was set

#### get_object_types()

class-object-sync-sf-wordpress.php : 131

Get WordPress object types

`public get_object_types() : array<string|int, mixed>`

##### Return values

array<string|int, mixed> —

$wordpress_objects

#### get_wordpress_object_data()

class-object-sync-sf-wordpress.php : 418

Get WordPress data based on what object it is

`public get_wordpress_object_data(string $object_type, int $object_id[, bool $is_deleted = false ]) : array<string|int, mixed>`

##### Parameters

$object_type : string

  The type of object.

$object_id : int

  The ID of the object.

$is_deleted : bool = false

  Whether the WordPress object has been deleted.

##### Return values

array<string|int, mixed> —

$wordpress_object

#### get_wordpress_object_fields()

class-object-sync-sf-wordpress.php : 361

Get WordPress fields for an object

`public get_wordpress_object_fields(string $wordpress_object[, string $id_field = 'ID' ]) : array<string|int, mixed>`

##### Parameters

$wordpress_object : string

  The type of WordPress object.

$id_field : string = 'ID'

  The field of that object that corresponds with its ID in the database.

##### Return values

array<string|int, mixed> —

$object_fields

#### get_wordpress_table_structure()

class-object-sync-sf-wordpress.php : 173

Get WordPress table structure for an object

`public get_wordpress_table_structure(string $object_type) : array<string|int, mixed>`

##### Parameters

$object_type : string

  The type of object.

##### Return values

array<string|int, mixed> —

$object_table_structure The table structure.

#### object_create()

class-object-sync-sf-wordpress.php : 669

Create a new object of a given type.

`public object_create(string $name, array<string|int, mixed> $params) : array<string|int, mixed>`

##### Parameters

$name : string

  Object type name, E.g., user, post, comment.

$params : array<string|int, mixed>

  Values of the fields to set for the object.

##### Return values

array<string|int, mixed> —

data: id : 123, success : true errors : [ ], from_cache: cached: is_redo:

part of CRUD for WordPress objects

#### object_delete()

class-object-sync-sf-wordpress.php : 899

Delete a WordPress object.

`public object_delete(string $name, int $id) : array<string|int, mixed>`

##### Parameters

$name : string

  Object type name, E.g., user, post, comment.

$id : int

  WordPress id of the object.

##### Return values

array<string|int, mixed> —

data: success: 1 "errors" : [ ],

part of CRUD for WordPress objects

#### object_delete_link()

class-object-sync-sf-wordpress.php : 2701

Generate a delete link for the WordPress record.

`public object_delete_link(string $object_type, int $wordpress_id) : string`

##### Parameters

$object_type : string

  the type of WordPress object.

$wordpress_id : int

  the ID of the WordPress object.

##### Return values

string —

$delete_link

#### object_edit_link()

class-object-sync-sf-wordpress.php : 2677

Generate an edit link for the WordPress record.

`public object_edit_link(string $object_type, int $wordpress_id) : string`

##### Parameters

$object_type : string

  the type of WordPress object.

$wordpress_id : int

  the ID of the WordPress object.

##### Return values

string —

$edit_link

#### object_update()

class-object-sync-sf-wordpress.php : 830

Update an existing object. Part of CRUD for WordPress objects

`public object_update(string $name, int $id, array<string|int, mixed> $params[, array<string|int, mixed> $mapping_object = array() ]) : array<string|int, mixed>`

##### Parameters

$name : string

  Object type name, E.g., user, post, comment.

$id : int

  WordPress id of the object.

$params : array<string|int, mixed>

  Values of the fields to set for the object.

$mapping_object : array<string|int, mixed> = array()

  is the object map connecting the records.

##### Return values

array<string|int, mixed> —

data: success: 1 "errors" : [ ], from_cache: cached: is_redo:

#### object_upsert()

class-object-sync-sf-wordpress.php : 747

Create new records or update existing records.

`public object_upsert(string $name, string $key, string $value, array<string|int, mixed> $methods, array<string|int, mixed> $params[, bool $pull_to_drafts = false ][, bool $check_only = false ]) : array<string|int, mixed>`

The new records or updated records are based on the value of the specified field. If the value is not unique, REST API returns a 300 response with the list of matching records.

##### Parameters

$name : string

  Object type name, E.g., user, post, comment.

$key : string

  The field to check if this record should be created or updated.

$value : string

  The value for this record of the field specified for $key.

$methods : array<string|int, mixed>

  What WordPress methods do we use to get the data, if there are any. otherwise, maybe will have to do a wpdb query.

$params : array<string|int, mixed>

  Values of the fields to set for the object.

$pull_to_drafts : bool = false

  Whether to save to WordPress drafts when pulling from Salesforce.

$check_only : bool = false

  Allows this method to only check for matching records, instead of making any data changes.

##### Return values

array<string|int, mixed> —

data: "id" : 123, "success" : true "errors" : [ ], from_cache: cached: is_redo:

part of CRUD for WordPress objects

#### append_tec_event_dates()

class-object-sync-sf-wordpress.php : 2655

Generate date formats for The Event Calendar plugin

`private append_tec_event_dates(string $date, string $type, array<string|int, mixed> $content) : array<string|int, mixed>`

##### Parameters

$date : string

  the string value of the date from Salesforce.

$type : string

  this should be start or end.

$content : array<string|int, mixed>

  the other mapped params.

##### Return values

array<string|int, mixed> —

$content

#### attachment_create()

class-object-sync-sf-wordpress.php : 1598

Create a new WordPress attachment.

`private attachment_create(array<string|int, mixed> $params[, string $id_field = 'ID' ]) : array<string|int, mixed>`

##### Parameters

$params : array<string|int, mixed>

  Array of attachment data params.

$id_field : string = 'ID'

  Optional string of what the ID field is, if it is ever not ID.

##### Return values

array<string|int, mixed> —

data: ID : 123, success: 1 "errors" : [ ],

#### attachment_delete()

class-object-sync-sf-wordpress.php : 1929

Delete a WordPress attachment.

`private attachment_delete(int $id[, bool $force_delete = false ]) : mixed`

##### Parameters

$id : int

  Attachment ID.

$force_delete : bool = false

  If we should bypass the trash. We don't change this from FALSE anywhere in this plugin.

##### Return values

mixed —

attachment object if successful, false if failed

#### attachment_update()

class-object-sync-sf-wordpress.php : 1840

Update a WordPress attachment.

`private attachment_update(string $attachment_id, array<string|int, mixed> $params[, string $id_field = 'ID' ]) : array<string|int, mixed>`

##### Parameters

$attachment_id : string

  The ID for the attachment to be updated. This value needs to be in the array that is sent to the update methods.

$params : array<string|int, mixed>

  Array of attachment data params.

$id_field : string = 'ID'

  Optional string of what the ID field is, if it is ever not ID.

##### Return values

array<string|int, mixed> —

data: success: 1 "errors" : [ ],

Note: this method uses wp_insert_attachment for core content fields as there isn't a corresponding method for updating these rows it does use wp_update_attachment_metadata for the meta fields, though. Developers should use hooks to change this, if it does not meet their needs.

#### attachment_upsert()

class-object-sync-sf-wordpress.php : 1679

Create a new WordPress attachment or update it if a match is found.

`private attachment_upsert(string $key, string $value, array<string|int, mixed> $methods, array<string|int, mixed> $params[, string $id_field = 'ID' ][, bool $check_only = false ]) : array<string|int, mixed>`

##### Parameters

$key : string

  What key we are looking at for possible matches.

$value : string

  What value we are looking at for possible matches.

$methods : array<string|int, mixed>

  What WordPress methods do we use to get the data, if there are any. otherwise, maybe will have to do a wpdb query.

$params : array<string|int, mixed>

  Array of attachment data params.

$id_field : string = 'ID'

  Optional string of what the ID field is, if it is ever not ID.

$check_only : bool = false

  Allows this method to only check for matching records, instead of making any data changes.

##### Return values

array<string|int, mixed> —

data: ID : 123, success: 1 "errors" : [ ],

#### comment_create()

class-object-sync-sf-wordpress.php : 2231

Create a new WordPress comment.

`private comment_create(array<string|int, mixed> $params[, string $id_field = 'comment_ID' ]) : array<string|int, mixed>`

##### Parameters

$params : array<string|int, mixed>

  Array of comment data params.

$id_field : string = 'comment_ID'

  Optional string of what the ID field is, if it is ever not comment_ID.

##### Return values

array<string|int, mixed> —

data: ID : 123, success: 1 "errors" : [ ],

#### comment_delete()

class-object-sync-sf-wordpress.php : 2527

Delete a WordPress comment.

`private comment_delete(int $id[, bool $force_delete = false ]) : bool`

##### Parameters

$id : int

  Comment ID.

$force_delete : bool = false

  If we should bypass the trash. We don't change this from FALSE anywhere in this plugin.

##### Return values

bool —

true if successful, false if failed.

#### comment_update()

class-object-sync-sf-wordpress.php : 2476

Update a WordPress comment.

`private comment_update(int $comment_id, array<string|int, mixed> $params[, string $id_field = 'comment_ID' ]) : array<string|int, mixed>`

##### Parameters

$comment_id : int

  The ID for the comment to be updated. This value needs to be in the array that is sent to wp_update_comment.

$params : array<string|int, mixed>

  Array of comment data params.

$id_field : string = 'comment_ID'

  Optional string of what the ID field is, if it is ever not ID.

##### Return values

array<string|int, mixed> —

data: success: 1 "errors" : [ ],

#### comment_upsert()

class-object-sync-sf-wordpress.php : 2309

Create a new WordPress comment or update it if a match is found.

`private comment_upsert(string $key, string $value, array<string|int, mixed> $methods, array<string|int, mixed> $params[, string $id_field = 'comment_ID' ][, bool $pull_to_drafts = false ][, bool $check_only = false ]) : array<string|int, mixed>`

##### Parameters

$key : string

  What key we are looking at for possible matches.

$value : string

  What value we are looking at for possible matches.

$methods : array<string|int, mixed>

  What WordPress methods do we use to get the data, if there are any. otherwise, maybe will have to do a wpdb query.

$params : array<string|int, mixed>

  Array of comment data params.

$id_field : string = 'comment_ID'

  Optional string of what the ID field is, if it is ever not comment_ID.

$pull_to_drafts : bool = false

  Whether to save to WordPress drafts when pulling from Salesforce.

$check_only : bool = false

  Allows this method to only check for matching records, instead of making any data changes.

##### Return values

array<string|int, mixed> —

data: ID : 123, success: 1 "errors" : [ ],

#### create_wp_meta()

class-object-sync-sf-wordpress.php : 2542

Standard method for creating meta values This works for users, posts, terms, and comments. It does not work for attachments.

`private create_wp_meta(array<string|int, mixed> $params, int|wp_error $parent_object_id, string $parent_object_type) : array<string|int, mixed>`

##### Parameters

$params : array<string|int, mixed>

  the values to be saved.

$parent_object_id : int|wp_error

  the WordPress object ID that this metadata is associated with. It shouldn't ever end up here as an error, but it's worth documenting.

$parent_object_type : string

  the WordPress object type.

##### Return values

array<string|int, mixed> —

$meta_result contains the success flag and the array of errors

#### object_fields()

class-object-sync-sf-wordpress.php : 558

Get all the fields for an object The important thing here is returning the fields as an array: $all_fields = array( 'key' => 'key name', 'table' => 'table name', 'methods' => array( 'create' => '', 'read' => '', 'update' => '', 'delete' => '' ) ); if there's a better way to do this than the mess of queries below, we should switch to that when we can we just need to make sure we get all applicable fields for the object itself, as well as its meta fields

`private object_fields(string $object_name, string $id_field, string $content_table, array<string|int, mixed> $content_methods, string $meta_table, array<string|int, mixed> $meta_methods, string $where[, array<string|int, mixed> $ignore_keys = array() ]) : array<string|int, mixed>`

##### Parameters

$object_name : string

  THe name of the object type.

$id_field : string

  The database filed that contains its ID.

$content_table : string

  The table that normally contains such objects.

$content_methods : array<string|int, mixed>

  Unused, but included as part of the return.

$meta_table : string

  The table where meta values for this object type are contained.

$meta_methods : array<string|int, mixed>

  Unused, but included as part of the return.

$where : string

  SQL query.

$ignore_keys : array<string|int, mixed> = array()

  Fields to ignore from the database.

##### Return values

array<string|int, mixed> —

$all_fields The fields for the object.

#### post_create()

class-object-sync-sf-wordpress.php : 1273

Create a new WordPress post.

`private post_create(array<string|int, mixed> $params[, string $id_field = 'ID' ][, string $post_type = 'post' ]) : array<string|int, mixed>`

##### Parameters

$params : array<string|int, mixed>

  Array of post data params.

$id_field : string = 'ID'

  Optional string of what the ID field is, if it is ever not ID.

$post_type : string = 'post'

  Optional string for custom post type, if applicable.

##### Return values

array<string|int, mixed> —

data: ID : 123, success: 1 "errors" : [ ],

#### post_delete()

class-object-sync-sf-wordpress.php : 1581

Delete a WordPress post.

`private post_delete(int $id[, bool $force_delete = false ]) : mixed`

##### Parameters

$id : int

  Post ID.

$force_delete : bool = false

  If we should bypass the trash. We don't change this from FALSE anywhere in this plugin.

##### Return values

mixed —

post object if successful, false if failed

#### post_update()

class-object-sync-sf-wordpress.php : 1531

Update a WordPress post.

`private post_update(string $post_id, array<string|int, mixed> $params[, string $id_field = 'ID' ][, string $post_type = '' ]) : array<string|int, mixed>`

##### Parameters

$post_id : string

  The ID for the post to be updated. This value needs to be in the array that is sent to wp_update_post.

$params : array<string|int, mixed>

  Array of post data params.

$id_field : string = 'ID'

  Optional string of what the ID field is, if it is ever not ID.

$post_type : string = ''

  Optional string for custom post type, if applicable.

##### Return values

array<string|int, mixed> —

data: success: 1 "errors" : [ ],

#### post_upsert()

class-object-sync-sf-wordpress.php : 1367

Create a new WordPress post or update it if a match is found.

`private post_upsert(string $key, string $value, array<string|int, mixed> $methods, array<string|int, mixed> $params[, string $id_field = 'ID' ][, bool $pull_to_drafts = false ][, string $post_type = 'post' ][, bool $check_only = false ]) : array<string|int, mixed>`

##### Parameters

$key : string

  What key we are looking at for possible matches.

$value : string

  What value we are looking at for possible matches.

$methods : array<string|int, mixed>

  What WordPress methods do we use to get the data, if there are any. otherwise, maybe will have to do a wpdb query.

$params : array<string|int, mixed>

  Array of post data params.

$id_field : string = 'ID'

  optional string of what the ID field is, if it is ever not ID.

$pull_to_drafts : bool = false

  Whether to save to WordPress drafts when pulling from Salesforce.

$post_type : string = 'post'

  Optional string for custom post type, if applicable.

$check_only : bool = false

  Allows this method to only check for matching records, instead of making any data changes.

##### Return values

array<string|int, mixed> —

data: ID : 123, success: 1 "errors" : [ ],

#### term_create()

class-object-sync-sf-wordpress.php : 1947

Create a new WordPress term.

`private term_create(array<string|int, mixed> $params, string $taxonomy[, string $id_field = 'ID' ]) : array<string|int, mixed>`

##### Parameters

$params : array<string|int, mixed>

  Array of term data params.

$taxonomy : string

  The taxonomy to which to add the term. this is required.

$id_field : string = 'ID'

  Optional string of what the ID field is, if it is ever not ID.

##### Return values

array<string|int, mixed> —

data: ID : 123, success: 1 "errors" : [ ],

#### term_delete()

class-object-sync-sf-wordpress.php : 2211

Delete a WordPress term.

`private term_delete(int $term_id, string $taxonomy) : bool`

##### Parameters

$term_id : int

  The ID for the term to be updated. This value needs to be in the array that is sent to wp_update_term.

$taxonomy : string

  The taxonomy from which to delete the term. this is required.

##### Return values

bool —

True if successful, false if failed.

#### term_update()

class-object-sync-sf-wordpress.php : 2158

Update a WordPress term.

`private term_update(int $term_id, array<string|int, mixed> $params, string $taxonomy[, string $id_field = 'ID' ]) : array<string|int, mixed>`

##### Parameters

$term_id : int

  The ID for the term to be updated. This value needs to be in the array that is sent to wp_update_term.

$params : array<string|int, mixed>

  Array of term data params.

$taxonomy : string

  The taxonomy to which to add the term. this is required.

$id_field : string = 'ID'

  Optional string of what the ID field is, if it is ever not ID.

##### Return values

array<string|int, mixed> —

data: success: 1 "errors" : [ ],

#### term_upsert()

class-object-sync-sf-wordpress.php : 2019

Create a new WordPress term or update it if a match is found.

`private term_upsert(string $key, string $value, array<string|int, mixed> $methods, array<string|int, mixed> $params, string $taxonomy[, string $id_field = 'ID' ][, bool $pull_to_drafts = false ][, bool $check_only = false ]) : array<string|int, mixed>`

##### Parameters

$key : string

  What key we are looking at for possible matches.

$value : string

  What value we are looking at for possible matches.

$methods : array<string|int, mixed>

  What WordPress methods do we use to get the data, if there are any. otherwise, maybe will have to do a wpdb query.

$params : array<string|int, mixed>

  Array of term data params.

$taxonomy : string

  The taxonomy to which to add the term. this is required..

$id_field : string = 'ID'

  Optional string of what the ID field is, if it is ever not ID.

$pull_to_drafts : bool = false

  Whether to save to WordPress drafts when pulling from Salesforce.

$check_only : bool = false

  Allows this method to only check for matching records, instead of making any data changes.

##### Return values

array<string|int, mixed> —

data: ID : 123, success: 1 "errors" : [ ],

#### update_wp_meta()

class-object-sync-sf-wordpress.php : 2588

Standard method for updating meta values This works for users, posts, terms, and comments. It does not work for attachments.

`private update_wp_meta(array<string|int, mixed> $params, int|wp_error $parent_object_id, string $parent_object_type) : array<string|int, mixed>`

##### Parameters

$params : array<string|int, mixed>

  the values to be saved.

$parent_object_id : int|wp_error

  the WordPress object ID that this metadata is associated with. It shouldn't ever end up here as an error, but it's worth documenting.

$parent_object_type : string

  the WordPress object type.

##### Return values

array<string|int, mixed> —

$meta_result contains the success flag, the changed flag, and the array of errors

#### user_create()

class-object-sync-sf-wordpress.php : 968

Create a new WordPress user.

`private user_create(array<string|int, mixed> $params[, string $id_field = 'ID' ]) : array<string|int, mixed>`

##### Parameters

$params : array<string|int, mixed>

  array of user data params.

$id_field : string = 'ID'

  The column in the DB that holdes the user ID.

##### Return values

array<string|int, mixed> —

data: ID : 123, success: 1 "errors" : [ ],

#### user_delete()

class-object-sync-sf-wordpress.php : 1253

Delete a WordPress user.

`private user_delete(int $id[, int $reassign = null ]) : bool`

##### Parameters

$id : int

  User ID.

$reassign : int = null

  If we should reassign any posts to other users. We don't change this from NULL anywhere in this plugin.

##### Return values

bool —

true if successful

#### user_update()

class-object-sync-sf-wordpress.php : 1199

Update a WordPress user.

`private user_update(string $user_id, array<string|int, mixed> $params[, string $id_field = 'ID' ]) : array<string|int, mixed>`

##### Parameters

$user_id : string

  The ID for the user to be updated. This value needs to be in the array that is sent to wp_update_user.

$params : array<string|int, mixed>

  Array of user data params.

$id_field : string = 'ID'

  Optional string of what the ID field is, if it is ever not ID.

##### Return values

array<string|int, mixed> —

data: success: 1 "errors" : [ ],

#### user_upsert()

class-object-sync-sf-wordpress.php : 1063

Create a new WordPress user or update it if a match is found.

`private user_upsert(string $key, string $value, array<string|int, mixed> $methods, array<string|int, mixed> $params[, string $id_field = 'ID' ][, bool $pull_to_drafts = false ][, bool $check_only = false ]) : array<string|int, mixed>`

##### Parameters

$key : string

  What key we are looking at for possible matches.

$value : string

  What value we are looking at for possible matches.

$methods : array<string|int, mixed>

  What WordPress methods do we use to get the data, if there are any. otherwise, maybe will have to do a wpdb query.

$params : array<string|int, mixed>

  Array of user data params. This is generated by Object_Sync_Sf_Mapping::map_params().

$id_field : string = 'ID'

  Optional string of what the ID field is, if it is ever not ID.

$pull_to_drafts : bool = false

  Whether to save to WordPress drafts when pulling from Salesforce.

$check_only : bool = false

  Allows this method to only check for matching records, instead of making any data changes.

##### Return values

array<string|int, mixed> —

data: ID : 123, success: 1 "errors" : [ ],

## Search results