Changeset 7444 for trunk/bp-core/bp-core-caps.php
- Timestamp:
- 10/19/2013 09:58:33 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core/bp-core-caps.php
r7228 r7444 2 2 3 3 /** 4 * BuddyPress Capabilites 4 * BuddyPress Capabilites. 5 5 * 6 6 * @package BuddyPress … … 12 12 13 13 /** 14 * Add scapabilities to WordPress user roles.14 * Add capabilities to WordPress user roles. 15 15 * 16 16 * This is called on plugin activation. 17 17 * 18 * @since BuddyPress (1.6 )19 * 20 * @uses get_role() To get the administrator, default and moderator roles 21 * @uses WP_Role::add_cap() To add various capabilities 22 * @uses do_action() Calls 'bp_add_caps' 18 * @since BuddyPress (1.6.0) 19 * 20 * @uses get_role() To get the administrator, default and moderator roles. 21 * @uses WP_Role::add_cap() To add various capabilities. 22 * @uses do_action() Calls 'bp_add_caps'. 23 23 */ 24 24 function bp_add_caps() { … … 40 40 41 41 /** 42 * Remove scapabilities from WordPress user roles.42 * Remove capabilities from WordPress user roles. 43 43 * 44 44 * This is called on plugin deactivation. 45 45 * 46 * @since BuddyPress (1.6 )47 * 48 * @uses get_role() To get the administrator and default roles 49 * @uses WP_Role::remove_cap() To remove various capabilities 50 * @uses do_action() Calls 'bp_remove_caps' 46 * @since BuddyPress (1.6.0) 47 * 48 * @uses get_role() To get the administrator and default roles. 49 * @uses WP_Role::remove_cap() To remove various capabilities. 50 * @uses do_action() Calls 'bp_remove_caps'. 51 51 */ 52 52 function bp_remove_caps() { … … 68 68 69 69 /** 70 * Maps community caps to built in WordPress caps 71 * 72 * @since BuddyPress (1.6) 73 * 74 * @param array $caps Capabilities for meta capability 75 * @param string $cap Capability name 76 * @param int $user_id User id 77 * @param mixed $args Arguments 78 * @uses get_post() To get the post 79 * @uses get_post_type_object() To get the post type object 80 * @uses apply_filters() Calls 'bp_map_meta_caps' with caps, cap, user id and 81 * args 82 * @return array Actual capabilities for meta capability 70 * Map community caps to built in WordPress caps. 71 * 72 * @since BuddyPress (1.6.0) 73 * 74 * @see WP_User::has_cap() for description of the arguments passed to the 75 * 'map_meta_cap' filter. 76 * @uses get_post() To get the post. 77 * @uses get_post_type_object() To get the post type object. 78 * @uses apply_filters() Calls 'bp_map_meta_caps' with caps, cap, user ID and 79 * args. 80 * 81 * @param array $caps See {@link WP_User::has_cap()}. 82 * @param string $cap See {@link WP_User::has_cap()}. 83 * @param int $user_id See {@link WP_User::has_cap()}. 84 * @param mixed $args See {@link WP_User::has_cap()}. 85 * @return array Actual capabilities for meta capability. See {@link WP_User::has_cap()}. 83 86 */ 84 87 function bp_map_meta_caps( $caps, $cap, $user_id, $args ) { … … 87 90 88 91 /** 89 * Return community capabilities 90 * 91 * @since BuddyPress (1.6) 92 * 93 * @uses apply_filters() Calls 'bp_get_community_caps' with the capabilities 94 * @return array Forum capabilities 92 * Return community capabilities. 93 * 94 * @since BuddyPress (1.6.0) 95 * 96 * @uses apply_filters() Calls 'bp_get_community_caps' with the capabilities. 97 * 98 * @return array Community capabilities. 95 99 */ 96 100 function bp_get_community_caps() { … … 103 107 104 108 /** 105 * Return san array of capabilities based on the role that is being requested.106 * 107 * @since BuddyPress (1.6 )108 * 109 * @ param string $role Optional. Defaults to The role to load caps for110 * @uses apply_filters() Allow return value to be filtered111 * 112 * @return array Capabilities for $role 109 * Return an array of capabilities based on the role that is being requested. 110 * 111 * @since BuddyPress (1.6.0) 112 * 113 * @uses apply_filters() Allow return value to be filtered. 114 * 115 * @param string $role The role for which you're loading caps. 116 * @return array Capabilities for $role. 113 117 */ 114 118 function bp_get_caps_for_role( $role = '' ) { … … 139 143 140 144 /** 141 * Give a user the default 'Forum Participant' role when creating a topic/reply 142 * on a site they do not have a role or capability on. 143 * 144 * @since BuddyPress (1.6) 145 * 146 * @global BuddyPress $bp 145 * Set a default role for the current user. 146 * 147 * Give a user the default role when creating content on a site they do not 148 * already have a role or capability on. 149 * 150 * @since BuddyPress (1.6.0) 151 * 152 * @global BuddyPress $bp Global BuddyPress settings object. 147 153 * 148 154 * @uses is_multisite() … … 172 178 173 179 /** 174 * Whether current user has a capability or role. Can be passed blog ID, or will 175 * use the root blod by default 176 * 177 * @since BuddyPress (1.6) 180 * Check whether the current user has a given capability. 181 * 182 * Can be passed blog ID, or will use the root blog by default. 183 * 184 * @since BuddyPress (1.6.0) 178 185 * 179 186 * @param string $capability Capability or role name. 180 * @param int $blog_id Blog ID181 * @return bool 187 * @param int $blog_id Optional. Blog ID. Defaults to the BP root blog. 188 * @return bool True if the user has the cap for the given blog. 182 189 */ 183 190 function bp_current_user_can( $capability, $blog_id = 0 ) { … … 193 200 194 201 /** 195 * Temporary implementation of 'bp_moderate' cap 196 * 197 * In BuddyPress 1.6, the 'bp_moderate' cap was introduced. In order to enforce that 198 * bp_current_user_can( 'bp_moderate' ) always returns true for Administrators, we must manually 199 * add the 'bp_moderate' cap to the list of user caps for Admins. 200 * 201 * Note that this level of enforcement is only necessary in the case of non-Multisite. This is 202 * because WordPress automatically assigns every capability - and thus 'bp_moderate' - to Super 203 * Admins on a Multisite installation. See WP_User::has_cap(). 204 * 205 * This implementation of 'bp_moderate' is temporary, until BuddyPress properly matches caps to 206 * roles and stores them in the database. Plugin authors: Do not use this function. 207 * 208 * @since BuddyPress (1.6) 202 * Temporary implementation of 'bp_moderate' cap. 203 * 204 * In BuddyPress 1.6, the 'bp_moderate' cap was introduced. In order to 205 * enforce that bp_current_user_can( 'bp_moderate' ) always returns true for 206 * Administrators, we must manually add the 'bp_moderate' cap to the list of 207 * user caps for Admins. 208 * 209 * Note that this level of enforcement is only necessary in the case of 210 * non-Multisite. This is because WordPress automatically assigns every 211 * capability - and thus 'bp_moderate' - to Super Admins on a Multisite 212 * installation. See {@link WP_User::has_cap()}. 213 * 214 * This implementation of 'bp_moderate' is temporary, until BuddyPress properly 215 * matches caps to roles and stores them in the database. Plugin authors: Do 216 * not use this function. 217 * 218 * @access private 219 * @since BuddyPress (1.6.0) 220 * 209 221 * @see WP_User::has_cap() 210 * @access private 211 * 212 * @param array $allcaps The caps that WP associates with the given role 213 * @param array $caps The caps being tested for in WP_User::has_cap() 214 * @param array $args Miscellaneous arguments passed to the user_has_cap filter 215 * @return array $allcaps The user's cap list, with 'bp_moderate' appended, if relevant 222 * 223 * @param array $allcaps The caps that WP associates with the given role. 224 * @param array $caps The caps being tested for in WP_User::has_cap(). 225 * @param array $args Miscellaneous arguments passed to the user_has_cap filter. 226 * @return array $allcaps The user's cap list, with 'bp_moderate' appended, if relevant. 216 227 */ 217 228 function _bp_enforce_bp_moderate_cap_for_admins( $caps = array(), $cap = '', $user_id = 0, $args = array() ) { … … 241 252 * This is called on plugin activation. 242 253 * 243 * @since BuddyPress (1.6) 244 * 245 * @deprecated since version 1.7 254 * @since BuddyPress (1.6.0) 255 * @deprecated 1.7.0 246 256 */ 247 257 function bp_add_roles() { … … 254 264 * This is called on plugin deactivation. 255 265 * 256 * @since BuddyPress (1.6) 257 * 258 * @deprecated since version 1.7 266 * @since BuddyPress (1.6.0) 267 * @deprecated 1.7.0 259 268 */ 260 269 function bp_remove_roles() { … … 264 273 265 274 /** 266 * The participant role for registered users without roles 275 * The participant role for registered users without roles. 267 276 * 268 277 * This is primarily for multisite compatibility when users without roles on 269 * sites that have global communities enabled 278 * sites that have global communities enabled. 270 279 * 271 280 * @since BuddyPress (1.6) 272 * 273 * @deprecated since version 1.7 281 * @deprecated 1.7.0 274 282 */ 275 283 function bp_get_participant_role() { … … 278 286 279 287 /** 280 * The moderator role for BuddyPress users 281 * 282 * @since BuddyPress (1.6) 283 * 284 * @deprecated since version 1.7 288 * The moderator role for BuddyPress users. 289 * 290 * @since BuddyPress (1.6.0) 291 * @deprecated 1.7.0 285 292 */ 286 293 function bp_get_moderator_role() {
Note: See TracChangeset
for help on using the changeset viewer.