Disciple_Tools_Groups

Extends \Disciple_Tools_Posts

Class Disciple_Tools_Contacts Functions for creating, finding, updating or deleting contacts

package

Disciple_Tools\Posts\Groups

Methods

Disciple_Tools_Posts constructor.

__construct() 
inherited

add_comment

add_comment(integer $group_id, string $comment_html, string $type = "comment", array $args = array(), boolean $check_permissions = true, boolean $silent = false) : false|integer|\WP_Error
static

Arguments

$group_id

integer

$comment_html

string

$type

string

$args

array

$check_permissions

boolean

$silent

boolean

Response

false|integer|\WP_Error

add_connection_to_post

add_connection_to_post(\string $post_type, \int $post_id, \string $field_key, \int $value) 
inherited static

Arguments

$post_type

\string

$post_id

\int

$field_key

\string

$value

\int

add_post_contact_method

add_post_contact_method(array $post_settings, \int $post_id, \string $key, \string $value, array $field) 
inherited static

Arguments

$post_settings

array

$post_id

\int

$key

\string

$value

\string

$field

array

Adds a share record

add_shared_on_group(integer $post_id, integer $user_id, array $meta = null, boolean $send_notifications = true, boolean $check_permissions = true) : false|integer|\WP_Error
static

Arguments

$post_id

integer

$user_id

integer

$meta

array

$send_notifications

boolean

$check_permissions

boolean

Response

false|integer|\WP_Error

Used in in the method get_custom, this method mutates $fields to add data about a particular contact in the required format. You might want to use this instead of get_custom for performance reasons.

adjust_post_custom_fields(array $post_settings, integer $post_id, array &$fields, array $fields_to_return = array(), null $meta_fields = null, null $post_user_meta = null) : void
inherited static

Arguments

$post_settings

array

This is what get_custom_fields_settings() returns

$post_id

integer

The ID number of the contact

$fields

array

This array will be mutated with the results

$fields_to_return

array

if not empty only add the fields that are specified (optional)

$meta_fields

null

a way to pass in the post's meta fields instead of getting in from the database (optional)

$post_user_meta

null

pass in the user post meta if already available (optional)

can_access

can_access(string $post_type) : boolean
inherited static

Arguments

$post_type

string

Response

boolean

can_create

can_create(string $post_type) : boolean
inherited static

Arguments

$post_type

string

Response

boolean

can_delete

can_delete(string $post_type) : boolean
inherited static

Arguments

$post_type

string

Response

boolean

A user can update the record if they have the global permission or if the post if assigned or shared with them

can_update(string $post_type, integer $post_id) : boolean
inherited static

Arguments

$post_type

string

$post_id

integer

Response

boolean

A user can view the record if they have the global permission or if the post if assigned or shared with them

can_view(string $post_type, integer $post_id) : boolean
inherited static

Arguments

$post_type

string

$post_id

integer

Response

boolean

can_view_all

can_view_all(string $post_type) : boolean
inherited static

Arguments

$post_type

string

Response

boolean

Make sure there are no extra or misspelled fields Make sure the field values are the correct format

check_for_invalid_post_fields(array $post_settings, array $fields, array $allowed_fields = array()) : array
inherited static

Arguments

$post_settings

array

$fields

array

$allowed_fields

array

Response

array

check_requires_update

check_requires_update( $group_id) 
static

Arguments

$group_id

Helper function to create a unique metakey for contact channels.

create_channel_metakey( $channel_key,  $field_type) : string
inherited static

Arguments

$channel_key

$field_type

Response

string

Create a new group

create_group(array $fields = array(), boolean|true $check_permissions = true) : integer
static

Arguments

$fields

array

, the new group's data

$check_permissions

boolean|true

Response

integer

| WP_Error

create_post_field_hook

create_post_field_hook( $fields,  $post_type) 

Arguments

$fields

$post_type

delete_comment

delete_comment(\int $group_id, \int $comment_id, \bool $check_permissions = true) 
static

Arguments

$group_id

\int

$comment_id

\int

$check_permissions

\bool

delete_post

delete_post(\int $post_id, \string $post_type) 
inherited static

Arguments

$post_id

\int

$post_type

\string

dt_comment_created

dt_comment_created( $post_type,  $post_id,  $comment_id,  $type) 

Arguments

$post_type

$post_id

$comment_id

$type

dt_get_post_fields_filter

dt_get_post_fields_filter( $fields,  $post_type) 

Arguments

$fields

$post_type

dt_user_list_filters

dt_user_list_filters( $filters,  $post_type) 
static

Arguments

$filters

$post_type

Reduced the number of fields on a post to what is useful in D.T

filter_wp_post_object_fields(object $post) : array
inherited static

Arguments

$post

object

Response

array

format_activity_message

format_activity_message( $activity,  $post_type_settings) 
inherited static

Arguments

$activity

$post_type_settings

format_connection_message

format_connection_message( $p2p_id,  $activity,  $action = 'connected to') 
inherited static

Arguments

$p2p_id

$activity

$action

format_post_contact_details

format_post_contact_details( $post_settings,  $meta_fields,  $type,  $key,  $value) 
inherited static

Arguments

$post_settings

$meta_fields

$type

$key

$value

get_activity

get_activity(integer $group_id) : array|null|object|\WP_Error
static

Arguments

$group_id

integer

Response

array|null|object|\WP_Error

get_all_groups_status_type

get_all_groups_status_type() 
static

get_comments

get_comments(integer $group_id) : array|integer|\WP_Error
static

Arguments

$group_id

integer

Response

array|integer|\WP_Error

get_group

get_group(integer $group_id, boolean $check_permissions = true, boolean $load_cache = false) : array|\WP_Error
static

Arguments

$group_id

integer

$check_permissions

boolean

$load_cache

boolean

Response

array|\WP_Error

get_group_default_filter_counts

get_group_default_filter_counts( $tab = "all",  $show_closed = false) 
static

Arguments

$tab

$show_closed

get_label_for_post_type

get_label_for_post_type( $post_type,  $singular = false) 
inherited static

Arguments

$post_type

$singular

Get most recent activity for the field

get_most_recent_activity_for_field( $post_id,  $field_key) : mixed
inherited static

Arguments

$post_id

$field_key

Response

mixed

get_multi_select_options

get_multi_select_options( $post_type,  $field,  $search = "") 
inherited static

Arguments

$post_type

$field

$search

get_my_groups_status_type

get_my_groups_status_type() 
static

Cached version of get_page_by_title so that we're not making unnecessary SQL all the time

get_post_by_title_cached(string $title, string $output = OBJECT, string|array $post_type = 'page',  $connection_type = 'none') : \WP_Post|null
inherited static
link

Uncached Functions

Arguments

$title

string

Page title

$output

string

Optional. Output type; OBJECT*, ARRAY_N, or ARRAY_A.

$post_type

string|array

Optional. Post type; default is 'page'.

$connection_type

Response

\WP_Post|null

WP_Post on success or null on failure

get_posts_shared_with_user

get_posts_shared_with_user(string $post_type, integer $user_id,  $search_for_post_name = '') : array
inherited static

Arguments

$post_type

string

$user_id

integer

$search_for_post_name

Response

array

Get settings related to contacts

get_settings() : array|\WP_Error
static

Response

array|\WP_Error

Gets an array of users whom the group is shared with.

get_shared_with_on_group(integer $post_id) : array|mixed
static

Arguments

$post_id

integer

Response

array|mixed

get_subassigned_users

get_subassigned_users( $post_id) 
inherited static

Arguments

$post_id

get_viewable

get_viewable(string $post_type, integer $most_recent) : array|\WP_Error|\WP_Query
inherited static

Arguments

$post_type

string

$most_recent

integer

Response

array|\WP_Error|\WP_Query

get_viewable_groups

get_viewable_groups(integer $most_recent) : array|\WP_Query
static

Arguments

$most_recent

integer

Response

array|\WP_Query

increment

increment( &$var,  $val) 
static

Arguments

$var

$val

is_post_key_contact_method_or_connection

is_post_key_contact_method_or_connection( $post_settings,  $key) 
inherited static

Arguments

$post_settings

$key

post_connection_added

post_connection_added( $post_type,  $post_id,  $field_key,  $value) 

Arguments

$post_type

$post_id

$field_key

$value

post_connection_removed

post_connection_removed( $post_type,  $post_id,  $field_key,  $value) 

Arguments

$post_type

$post_id

$field_key

$value

post_created_hook

post_created_hook( $post_type,  $post_id,  $initial_fields) 

Arguments

$post_type

$post_id

$initial_fields

post_updated_hook

post_updated_hook( $post_type,  $post_id,  $initial_fields) 

Arguments

$post_type

$post_id

$initial_fields

remove_connection_from_post

remove_connection_from_post(\string $post_type, \int $post_id, \string $field_key, \int $value) 
inherited static

Arguments

$post_type

\string

$post_id

\int

$field_key

\string

$value

\int

Removes share record

remove_shared_on_group(integer $post_id, integer $user_id) : false|integer|\WP_Error
static

Arguments

$post_id

integer

$user_id

integer

Response

false|integer|\WP_Error

search_viewable_groups

search_viewable_groups(array $query, \bool $check_permissions = true) 
static

Arguments

$query

array

$check_permissions

\bool

search_viewable_post

search_viewable_post(\string $post_type, array $query, \bool $check_permissions = true) 
inherited static

Arguments

$post_type

\string

$query

array

$check_permissions

\bool

unique_hash

unique_hash() 
inherited static

update_comment

update_comment(\int $group_id, \int $comment_id, \string $comment_content, \bool $check_permissions = true) 
static

Arguments

$group_id

\int

$comment_id

\int

$comment_content

\string

$check_permissions

\bool

update_connections

update_connections(array $post_settings, \int $post_id, array $fields,  $existing_contact = null) 
inherited static

Arguments

$post_settings

array

$post_id

\int

$fields

array

$existing_contact

Update an existing Group

update_group(integer $group_id, array $fields, boolean $check_permissions = true) : integer
static
access

public

since 0.1.0

Arguments

$group_id

integer

, the post id for the group

$fields

array

, the meta fields

$check_permissions

boolean

Response

integer

| WP_Error of group ID

update_group_member_count

update_group_member_count( $group_id,  $action = "added") 

Arguments

$group_id

$action

update_location_grid_fields

update_location_grid_fields(array $field_settings, \int $post_id, array $fields,  $post_type, array $existing_post = null) 
inherited static

Arguments

$field_settings

array

$post_id

\int

$fields

array

$post_type

$existing_post

array

update_multi_select_fields

update_multi_select_fields(array $field_settings, \int $post_id, array $fields, array $existing_contact = null) 
inherited static

Arguments

$field_settings

array

$post_id

\int

$fields

array

$existing_contact

array

update_post_contact_method

update_post_contact_method(\int $post_id, \string $key, array $values) 
inherited static

Arguments

$post_id

\int

$key

\string

$values

array

update_post_contact_methods

update_post_contact_methods(array $post_settings, \int $post_id, array $fields, array $existing_contact = null) 
inherited static

Arguments

$post_settings

array

$post_id

\int

$fields

array

$existing_contact

array

update_post_field_hook

update_post_field_hook( $fields,  $post_type,  $post_id) 

Arguments

$fields

$post_type

$post_id

update_post_user_meta_fields

update_post_user_meta_fields(array $field_settings, \int $post_id, array $fields, array $existing_record) 
inherited static

Arguments

$field_settings

array

$post_id

\int

$fields

array

$existing_record

array

Properties

address_types

address_types : 
static

Type(s)

group_fields

group_fields : 
static

Type(s)

group_connection_types

group_connection_types : 
static

Type(s)

channel_list

channel_list : 
static

Type(s)