Skip to:
Content

bbPress.org

Changeset 4371


Ignore:
Timestamp:
11/09/2012 12:42:36 PM (12 years ago)
Author:
johnjamesjacoby
Message:

Capabilities:

  • Hook bbp_set_current_user_default_role() to 'switch_blog'
  • Fixes bug where mapped forums role was lost on multisite when WP_Admin_Bar::initialize() would switch to a blog that a user is a member of, if the user was viewing a forum on a site they do not have a role on.
  • See #1939.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/core/actions.php

    r4364 r4371  
    8989 */
    9090add_action( 'bbp_setup_theme', 'bbp_add_forums_roles', 1 );
     91
     92/**
     93 * When switching to a new blog, a users mapped role will get wiped out by
     94 * WP_User::for_blog() and WP_User::_init_caps().
     95 *
     96 * This happens naturally in multisite setups during WP_Admin_Bar::initialize(),
     97 * which is annoying because it will happen on each page-load.
     98 *
     99 * Resetting the role on blog-switch enables us to maintain the user's dynamic
     100 * role between sites. Note that if a user already has a role on that site, no
     101 * mapping will occur.
     102 */
     103add_action( 'switch_blog', 'bbp_set_current_user_default_role', 1 );
    91104
    92105/**
Note: See TracChangeset for help on using the changeset viewer.