Changeset 6147
- Timestamp:
- 12/09/2016 07:30:14 AM (4 years ago)
- Location:
- branches/2.5/includes/core
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.5/includes/core/actions.php
r5643 r6147 46 46 add_action( 'wp_head', 'bbp_head', 10 ); 47 47 add_action( 'wp_footer', 'bbp_footer', 10 ); 48 add_action( 'wp_roles_init', 'bbp_roles_init', 10 ); 48 49 add_action( 'set_current_user', 'bbp_setup_current_user', 10 ); 49 50 add_action( 'setup_theme', 'bbp_setup_theme', 10 ); … … 85 86 86 87 /** 87 * There is no action API for roles to use, so hook in immediately after 88 * everything is included (including the theme's functions.php. This is after 89 * the $wp_roles global is set but before $wp->init(). 90 * 91 * If it's hooked in any sooner, role names may not be translated correctly. 92 * 93 * @link http://bbpress.trac.wordpress.org/ticket/2219 94 * 95 * This is kind of lame, but is all we have for now. 96 */ 97 add_action( 'bbp_after_setup_theme', 'bbp_add_forums_roles', 1 ); 88 * bbp_roles_init - Attached to 'wp_roles_init' above 89 */ 90 add_action( 'bbp_roles_init', 'bbp_add_forums_roles', 1 ); 98 91 99 92 /** -
branches/2.5/includes/core/capabilities.php
r6125 r6147 293 293 * @since bbPress (r4290) 294 294 * 295 * @param WP_Roles $wp_roles The main WordPress roles global 296 * 295 297 * @uses bbp_get_wp_roles() To load and get the $wp_roles global 296 298 * @uses bbp_get_dynamic_roles() To get and add bbPress's roles to $wp_roles 297 299 * @return WP_Roles The main $wp_roles global 298 300 */ 299 function bbp_add_forums_roles() { 300 $wp_roles = bbp_get_wp_roles(); 301 301 function bbp_add_forums_roles( $wp_roles = null ) { 302 303 // Attempt to get global roles if not passed in & not mid-initialization 304 if ( ( null === $wp_roles ) && ! doing_action( 'wp_roles_init' ) ) { 305 $wp_roles = bbp_get_wp_roles(); 306 } 307 308 // Loop through dynamic roles and add them to the $wp_roles array 302 309 foreach ( bbp_get_dynamic_roles() as $role_id => $details ) { 303 310 $wp_roles->roles[$role_id] = $details; … … 306 313 } 307 314 315 // Return the modified $wp_roles array 308 316 return $wp_roles; 309 317 } -
branches/2.5/includes/core/sub-actions.php
r6120 r6147 131 131 function bbp_widgets_init() { 132 132 do_action( 'bbp_widgets_init' ); 133 } 134 135 /** 136 * Initialize roles 137 * 138 * @since bbPress (r3389) 139 * 140 * @param WP_Roles $wp_roles The main WordPress roles global 141 * 142 * @uses do_action() Calls 'bbp_roles_init' 143 */ 144 function bbp_roles_init( $wp_roles = null ) { 145 do_action( 'bbp_roles_init', $wp_roles ); 133 146 } 134 147
Note: See TracChangeset
for help on using the changeset viewer.