Changeset 4910
- Timestamp:
- 05/15/2013 05:39:17 PM (13 years ago)
- Location:
- trunk/includes
- Files:
-
- 2 edited
-
admin/actions.php (modified) (1 diff)
-
core/update.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/includes/admin/actions.php
r4390 r4910 64 64 65 65 // Activation 66 add_action( 'bbp_activation', 'bbp_delete_rewrite_rules' ); 66 add_action( 'bbp_activation', 'bbp_delete_rewrite_rules' ); 67 add_action( 'bbp_activation', 'bbp_make_current_user_keymaster' ); 67 68 68 69 // Deactivation -
trunk/includes/core/update.php
r4849 r4910 302 302 set_transient( '_bbp_activation_redirect', true, 30 ); 303 303 } 304 305 /** 306 * Hooked to the 'bbp_activate' action, this helper function automatically makes 307 * the current user a Key Master in the forums if they just activated bbPress, 308 * regardless of the bbp_allow_global_access() setting. 309 * 310 * @since bbPress (r4910) 311 * 312 * @internal Used to internally make the current user a keymaster on activation 313 * 314 * @uses current_user_can() to bail if user cannot activate plugins 315 * @uses get_current_user_id() to get the current user ID 316 * @uses get_current_blog_id() to get the current blog ID 317 * @uses is_user_member_of_blog() to bail if the current user does not have a role 318 * @uses bbp_is_user_keymaster() to bail if the user is already a keymaster 319 * @uses bbp_set_user_role() to make the current user a keymaster 320 * 321 * @return If user can't activate plugins or is already a keymaster 322 */ 323 function bbp_make_current_user_keymaster() { 324 325 // Bail if the current user can't activate plugins since previous pageload 326 if ( ! current_user_can( 'activate_plugins' ) ) 327 return; 328 329 // Get the current user ID 330 $user_id = get_current_user_id(); 331 $blog_id = get_current_blog_id(); 332 333 // Bail if user is not actually a member of this site 334 if ( ! is_user_member_of_blog( $user_id, $blog_id ) ) 335 return; 336 337 // Bail if the current user is already a keymaster 338 if ( bbp_is_user_keymaster( $user_id ) ) 339 return; 340 341 // Make the current user a keymaster 342 bbp_set_user_role( $user_id, bbp_get_keymaster_role() ); 343 }
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)