Changeset 6520
- Timestamp:
- 06/10/2017 08:52:34 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/users/engagements.php
r6518 r6520 21 21 * @param int $user_id The user id 22 22 * @param string $meta_key The relationship key 23 * @param string $meta_type The relationship type 23 * @param string $meta_type The relationship type (usually 'post') 24 24 * @param bool $unique Whether metadata should be unique to the object 25 25 * 26 * @uses add_post_meta() To set the term on theobject27 * @uses apply_filters() Calls 'bbp_add_user_to_object' with the return value & parameters28 * @return bool Returns true if the user is added to the object, otherwise false26 * @uses add_post_meta() To add the user to an object 27 * 28 * @return bool Returns true on success, false on failure 29 29 */ 30 30 function bbp_add_user_to_object( $object_id = 0, $user_id = 0, $meta_key = '', $meta_type = 'post', $unique = true ) { … … 40 40 * @since 2.6.0 bbPress (r6109) 41 41 * 42 * @param int $object_id The post id42 * @param int $object_id The object id 43 43 * @param int $user_id The user id 44 44 * @param string $meta_key The relationship key 45 * @param string $meta_type The relationship type 46 * 47 * @uses delete_post_meta() To remove the term from the object 48 * @uses apply_filters() Calls 'bbp_remove_user_from_object' with the object 49 * id, user id, and taxonomy 50 * @return bool Returns true is the user taxonomy term is removed from the object, 51 * otherwise false 45 * @param string $meta_type The relationship type (usually 'post') 46 * 47 * @uses delete_metadata() To remove a user from an objects 48 * 49 * @return bool Returns true on success, false on failure 52 50 */ 53 51 function bbp_remove_user_from_object( $object_id = 0, $user_id = 0, $meta_key = '', $meta_type = 'post' ) { … … 59 57 60 58 /** 61 * Remove a user id from all objects59 * Remove all users from an object 62 60 * 63 61 * @since 2.6.0 bbPress (r6109) 64 62 * 65 * @param int $object_id The post id63 * @param int $object_id The object id 66 64 * @param int $user_id The user id 67 65 * @param string $meta_key The relationship key 68 * @param string $meta_type The relationship type 69 * 70 * @uses delete_post_meta() To remove the term from the object 71 * @uses apply_filters() Calls 'bbp_remove_user_from_object' with the object 72 * id, user id, and taxonomy 73 * @return bool Returns true is the user taxonomy term is removed from the object, 74 * otherwise false 66 * @param string $meta_type The relationship type (usually 'post') 67 * 68 * @uses delete_metadata() To remove all user from an object 69 * 70 * @return bool Returns true on success, false on failure 71 */ 72 function bbp_remove_all_users_from_object( $object_id = 0, $meta_key = '', $meta_type = 'post' ) { 73 $retval = delete_metadata( $meta_type, $object_id, $meta_key, null, false ); 74 75 // Filter & return 76 return (bool) apply_filters( 'bbp_remove_all_users_from_object', (bool) $retval, $object_id, $meta_key, $meta_type ); 77 } 78 79 /** 80 * Remove a user id from all objects 81 * 82 * @since 2.6.0 bbPress (r6109) 83 * 84 * @param int $user_id The user id 85 * @param string $meta_key The relationship key 86 * @param string $meta_type The relationship type (usually 'post') 87 * 88 * @uses delete_metadata() To remove user from all objects 89 * 90 * @return bool Returns true on success, false on failure 75 91 */ 76 92 function bbp_remove_user_from_all_objects( $user_id = 0, $meta_key = '', $meta_type = 'post' ) { … … 82 98 83 99 /** 84 * Get user taxonomy terms for an object 100 * Remove all users from all objects 101 * 102 * @since 2.6.0 bbPress (r6109) 103 * 104 * @param string $meta_key The relationship key 105 * @param string $meta_type The relationship type (usually 'post') 106 * 107 * @uses delete_metadata() To remove users from objects 108 * 109 * @return bool Returns true on success, false on failure 110 */ 111 function bbp_remove_all_users_from_all_objects( $meta_key = '', $meta_type = 'post' ) { 112 $retval = delete_metadata( $meta_type, null, $meta_key, null, true ); 113 114 // Filter & return 115 return (bool) apply_filters( 'bbp_remove_all_users_from_all_objects', (bool) $retval, $meta_key, $meta_type ); 116 } 117 118 /** 119 * Get users of an object 85 120 * 86 121 * @since 2.6.0 bbPress (r6109) … … 90 125 * @param string $meta_type The type of meta to look in 91 126 * 92 * @uses get_post_meta() To get the user taxonomy terms 93 * @uses apply_filters() Calls 'bbp_get_users_for_object' with the user 94 * taxonomy terms, object id, and taxonomy 95 * @return array Returns the user taxonomy terms of the object 127 * @uses get_metadata() To get the users of an object 128 * 129 * @return array Returns ids of users 96 130 */ 97 131 function bbp_get_users_for_object( $object_id = 0, $meta_key = '', $meta_type = 'post' ) { … … 104 138 105 139 /** 106 * Check if the user id is set on an object140 * Check if an object has a specific user 107 141 * 108 142 * @since 2.6.0 bbPress (r6109) … … 111 145 * @param int $user_id The user id 112 146 * @param string $meta_key The relationship key 113 * @param string $meta_type The relationship type 114 * 115 * @uses get_post_meta() To check if the user id is set on the object 116 * @uses apply_filters() Calls 'bbp_is_object_of_user' with the object id, 117 * user id, and taxonomy 118 * @return bool Returns true if the user id is set on the object for the 119 * taxonomy, otherwise false 147 * @param string $meta_type The relationship type (usually 'post') 148 * 149 * @uses bbp_get_users_for_object() To get all users of an object 150 * 151 * @return bool Returns true if object has a user, false if not 120 152 */ 121 153 function bbp_is_object_of_user( $object_id = 0, $user_id = 0, $meta_key = '', $meta_type = 'post' ) {
Note: See TracChangeset
for help on using the changeset viewer.