Skip to:
Content
Pages
Categories
Search
Top
Bottom

2.6 doesn’t recognise existing WP forum roles


  • scabbrox
    Participant

    @scabbrox

    Hello there

    I’ve run into an issue with updating our website’s forum from 2.5.14 to 2.6.

    We have been using a set of wp roles as additional forum roles on our site for about 2 years now to allow us to have more tiers of membership and administrator roles visible in the forums rather than the standard 5. This has worked fine up till now but when we apply the 2.6 update these roles are no longer recognised as additional forum roles, though they still exists as wordpress roles.

    I’m not entirely sure how these roles were initially flagged as forum roles, but they were simply created by duplicating the existing forum roles and then renaming them.

    I’ve checked the functions.file for our child theme and there’s nothing in there that would be assigning them so I’m assuming it’s because of differences in the capabilities-php file where some of the previous capabilities are listed as deprecated in 2.6.

    Any idea how we can fix this as currently we’re unable to upgrade until we can retain the roles.

    Thanks for your assistance in this matter.

Viewing 25 replies - 1 through 25 (of 29 total)

  • John James Jacoby
    Keymaster

    @johnjamesjacoby

    Hey there! Sorry that 2.6 is giving you trouble.

    bbPress roles are somewhat tricky, but not too much has changed, so it shouldn’t be too hard for us to figure it out.

    We’ll need to see the code that you used to make your custom Roles. If you can include it or link to it here, that will be really helpful.


    scabbrox
    Participant

    @scabbrox

    Hi there and thanks for the reply.

    The trouble is I’m not entirely sure how we did it as it was a while ago and the person that did it is no longer with us.

    I’m not seeing anything in functions.php which is where I understand that code is normally put for this so I’m assuming it’s in the capabilities.php file that the update is overriding as this does refer to treating wp_roles as bbpress roles.

    I can send a copy of the capabilities file (not seeing an upload button) or perhaps you can give me an idea where else to look?

    Sorry to be so vague, but it works fine with the previous version of bbpress so I’m guessing it’s something that gets overwritten when I update.

    The roles were created by clicking duplicate on a bbpress role and then changing the name, but if I try that now it just created a wp-role and not a forum role.


    scabbrox
    Participant

    @scabbrox

    I think I may have found it….

    It’s in the bbpress.php file (of the pre-update version). Is this it?

    ———–
    /**
    * The main function responsible for returning the one true bbPress Instance
    * to functions everywhere.
    *
    * Use this function like you would a global variable, except without needing
    * to declare the global.
    *
    * Example: <?php $bbp = bbpress(); ?>
    *
    * @return The one true bbPress Instance
    */
    function bbpress() {
    return bbpress::instance();
    }

    /**
    * Hook bbPress early onto the ‘plugins_loaded’ action.
    *
    * This gives all other plugins the chance to load before bbPress, to get their
    * actions, filters, and overrides setup without bbPress being in the way.
    */
    if ( defined( ‘BBPRESS_LATE_LOAD’ ) ) {
    add_action( ‘plugins_loaded’, ‘bbpress’, (int) BBPRESS_LATE_LOAD );

    // “And now here’s something we hope you’ll really like!”
    } else {
    bbpress();
    }

    endif; // class_exists check

    function add_new_roles( $bbp_roles )
    {
    $bbp_roles[‘bbp_trial’] = array(
    ‘name’ => ‘Trial’,
    ‘capabilities’ => custom_capabilities( ‘bbp_trial’ )
    );

    $bbp_roles[‘bbp_warlord’] = array(
    ‘name’ => ‘Warlord’,
    ‘capabilities’ => custom_capabilities( ‘bbp_warlord’ )
    );

    $bbp_roles[‘bbp_general’] = array(
    ‘name’ => ‘General’,
    ‘capabilities’ => custom_capabilities( ‘bbp_general’ )
    );

    $bbp_roles[‘bbp_member’] = array(
    ‘name’ => ‘Member’,
    ‘capabilities’ => custom_capabilities( ‘bbp_member’ )
    );

    $bbp_roles[‘bbp_council_member’] = array(
    ‘name’ => ‘Council Member’,
    ‘capabilities’ => custom_capabilities( ‘bbp_council_member’ )
    );

    return $bbp_roles;
    }

    add_filter( ‘bbp_get_dynamic_roles’, ‘add_new_roles’, 1 );

    function add_role_caps_filter( $caps, $role )
    {
    if( $role == ‘bbp_trial’ )
    $caps = custom_capabilities( $role );

    if( $role == ‘bbp_warlord’ )
    $caps = custom_capabilities( $role );

    if( $role == ‘bbp_general’ )
    $caps = custom_capabilities( $role );

    if( $role == ‘bbp_member’ )
    $caps = custom_capabilities( $role );

    if( $role == ‘bbp_council_member’ )
    $caps = custom_capabilities( $role );

    return $caps;
    }

    add_filter( ‘bbp_get_caps_for_role’, ‘add_role_caps_filter’, 10, 2 );

    function custom_capabilities( $role )
    {
    switch ( $role )
    {

    /* Capabilities for ‘councilmember’ role */
    case ‘bbp_council_member’:
    return array(
    // Primary caps
    ‘spectate’ => true,
    ‘participate’ => true,
    ‘moderate’ => true,
    ‘throttle’ => true,
    ‘view_trash’ => false,

    // Forum caps
    ‘publish_forums’ => false,
    ‘edit_forums’ => false,
    ‘edit_others_forums’ => false,
    ‘delete_forums’ => false,
    ‘delete_others_forums’ => false,
    ‘read_private_forums’ => true,
    ‘read_hidden_forums’ => true,

    // Topic caps
    ‘publish_topics’ => true,
    ‘edit_topics’ => true,
    ‘edit_others_topics’ => true,
    ‘delete_topics’ => true,
    ‘delete_others_topics’ => true,
    ‘read_private_topics’ => true,

    // Reply caps
    ‘publish_replies’ => true,
    ‘edit_replies’ => true,
    ‘edit_others_replies’ => true,
    ‘delete_replies’ => true,
    ‘delete_others_replies’ => true,
    ‘read_private_replies’ => true,

    // Topic tag caps
    ‘manage_topic_tags’ => true,
    ‘edit_topic_tags’ => true,
    ‘delete_topic_tags’ => true,
    ‘assign_topic_tags’ => true,
    );

    /* Capabilities for ‘member’ role */
    case ‘bbp_member’:
    return array(
    // Primary caps
    ‘spectate’ => true,
    ‘participate’ => true,
    ‘moderate’ => false,
    ‘throttle’ => false,
    ‘view_trash’ => false,

    // Forum caps
    ‘publish_forums’ => false,
    ‘edit_forums’ => false,
    ‘edit_others_forums’ => false,
    ‘delete_forums’ => false,
    ‘delete_others_forums’ => false,
    ‘read_private_forums’ => true,
    ‘read_hidden_forums’ => false,

    // Topic caps
    ‘publish_topics’ => true,
    ‘edit_topics’ => true,
    ‘edit_others_topics’ => false,
    ‘delete_topics’ => false,
    ‘delete_others_topics’ => false,
    ‘read_private_topics’ => true,

    // Reply caps
    ‘publish_replies’ => true,
    ‘edit_replies’ => true,
    ‘edit_others_replies’ => false,
    ‘delete_replies’ => true,
    ‘delete_others_replies’ => false,
    ‘read_private_replies’ => true,

    // Topic tag caps
    ‘manage_topic_tags’ => false,
    ‘edit_topic_tags’ => false,
    ‘delete_topic_tags’ => false,
    ‘assign_topic_tags’ => true,
    );

    /* Capabilities for ‘warlord’ role */
    case ‘bbp_warlord’:
    return array(
    // Primary caps
    ‘spectate’ => true,
    ‘participate’ => true,
    ‘moderate’ => true,
    ‘throttle’ => true,
    ‘view_trash’ => true,

    // Forum caps
    ‘publish_forums’ => true,
    ‘edit_forums’ => true,
    ‘edit_others_forums’ => true,
    ‘delete_forums’ => true,
    ‘delete_others_forums’ => true,
    ‘read_private_forums’ => true,
    ‘read_hidden_forums’ => true,

    // Topic caps
    ‘publish_topics’ => true,
    ‘edit_topics’ => true,
    ‘edit_others_topics’ => true,
    ‘delete_topics’ => true,
    ‘delete_others_topics’ => true,
    ‘read_private_topics’ => true,

    // Reply caps
    ‘publish_replies’ => true,
    ‘edit_replies’ => true,
    ‘edit_others_replies’ => true,
    ‘delete_replies’ => true,
    ‘delete_others_replies’ => true,
    ‘read_private_replies’ => true,

    // Topic tag caps
    ‘manage_topic_tags’ => true,
    ‘edit_topic_tags’ => true,
    ‘delete_topic_tags’ => true,
    ‘assign_topic_tags’ => true,
    );

    /* Capabilities for ‘general’ role */
    case ‘bbp_general’:
    return array(
    // Primary caps
    ‘spectate’ => true,
    ‘participate’ => true,
    ‘moderate’ => true,
    ‘throttle’ => true,
    ‘view_trash’ => true,

    // Forum caps
    ‘publish_forums’ => true,
    ‘edit_forums’ => true,
    ‘edit_others_forums’ => true,
    ‘delete_forums’ => true,
    ‘delete_others_forums’ => true,
    ‘read_private_forums’ => true,
    ‘read_hidden_forums’ => true,

    // Topic caps
    ‘publish_topics’ => true,
    ‘edit_topics’ => true,
    ‘edit_others_topics’ => true,
    ‘delete_topics’ => true,
    ‘delete_others_topics’ => true,
    ‘read_private_topics’ => true,

    // Reply caps
    ‘publish_replies’ => true,
    ‘edit_replies’ => true,
    ‘edit_others_replies’ => true,
    ‘delete_replies’ => true,
    ‘delete_others_replies’ => true,
    ‘read_private_replies’ => true,

    // Topic tag caps
    ‘manage_topic_tags’ => true,
    ‘edit_topic_tags’ => true,
    ‘delete_topic_tags’ => true,
    ‘assign_topic_tags’ => true,
    );

    /* Capabilities for ‘trial’ role */
    case ‘bbp_trial’:
    return array(
    // Primary caps
    ‘spectate’ => true,
    ‘participate’ => true,
    ‘moderate’ => false,
    ‘throttle’ => false,
    ‘view_trash’ => false,

    // Forum caps
    ‘publish_forums’ => false,
    ‘edit_forums’ => false,
    ‘edit_others_forums’ => false,
    ‘delete_forums’ => false,
    ‘delete_others_forums’ => false,
    ‘read_private_forums’ => true,
    ‘read_hidden_forums’ => false,

    // Topic caps
    ‘publish_topics’ => true,
    ‘edit_topics’ => true,
    ‘edit_others_topics’ => false,
    ‘delete_topics’ => false,
    ‘delete_others_topics’ => false,
    ‘read_private_topics’ => true,

    // Reply caps
    ‘publish_replies’ => true,
    ‘edit_replies’ => true,
    ‘edit_others_replies’ => false,
    ‘delete_replies’ => true,
    ‘delete_others_replies’ => false,
    ‘read_private_replies’ => true,

    // Topic tag caps
    ‘manage_topic_tags’ => false,
    ‘edit_topic_tags’ => false,
    ‘delete_topic_tags’ => false,
    ‘assign_topic_tags’ => true,
    );

    break;

    default :
    return $role;
    }
    }


    Robin W
    Moderator

    @robin-w

    yes, that looks like it, and yes it should not be in that part as it gets overwritten. Good that you had a copy !

    so from

    function add_new_roles( $bbp_roles )

    to the end and put this in the functions file of your child theme


    scabbrox
    Participant

    @scabbrox

    Thanks for that.

    Just to be sure is there anything I need to add between the end of the current functions.php in my child theme and the above paste?

    It currently ends like this:

    // usp pro replace underscores with spaces
    function usp_pro_modify_field_value($value) {

    return ucwords(trim(str_replace(‘_’, ‘ ‘, $value)));

    }
    add_filter(‘usp_custom_fields_checkbox_value’, ‘usp_pro_modify_field_value’);
    add_filter(‘usp_custom_fields_radio_value’, ‘usp_pro_modify_field_value’);
    add_filter(‘usp_custom_fields_select_value’, ‘usp_pro_modify_field_value’);
    add_filter(‘acf/settings/remove_wp_meta_box’, ‘__return_false’);


    Robin W
    Moderator

    @robin-w

    yes putting it after that should be fine.

    Just keep a version of the file before the change just in case it errors then you can quickly revert back and report back here !!


    scabbrox
    Participant

    @scabbrox

    Worked great, thanks!


    Robin W
    Moderator

    @robin-w

    great – glad you are fixed !!


    scabbrox
    Participant

    @scabbrox

    Hello again Robin

    Sorry to bother you again but I seem to have a persistent issue that I thought I’d cleared but keeps coming back.

    I’ve noticed that despite now having all my additional forum roles back, assigned and active that each time a user relogs it adds Spectator to their user roles (this is a forum not user role so it should not do that) whilst not changing their forum role.

    The only way to fix this is to change their forum role back to Spectator and then change it once more to Member/Moderator etc, but this doesn’t stick for good as check back in a day or two and they’ve got Spectator listed as a user role again.

    This creates issues with permissions on the site as Spectators can’t see a lot of the content.

    Wondering if you have any idea why it might be adding this role back?


    Robin W
    Moderator

    @robin-w

    can you check

    dashboard>settings>forums

    item – Automatically give registered visitors the xx role

    I suspect you have this checked and set to spectator?


    scabbrox
    Participant

    @scabbrox

    Hi and thanks for the quick reply.

    It is indeed set to do that, it always has been in the past to allow new applicants the ability to see areas of the forum that are public and make an application to join.

    The difference is now it’s adding it also to anyone who also has a role assigned manually.

    I can try turning it off but am concerned this may impact the ability of genuine Spectators (potential applicants and former members) to make applications and see the public forums.

    I’ll test it and get back to you if needed.


    Robin W
    Moderator

    @robin-w

    hmmm…not sure why it is doing that – clearly it thinks they don’t have a role.


    scabbrox
    Participant

    @scabbrox

    Seems it works even without a role so looks like it’s sorted. Will let you know if it recurs. Thanks again.


    scabbrox
    Participant

    @scabbrox

    The only reason I can think of is that before the extra ranks were part of BBPress.php file and now they are in the child themes functions.php instead so maybe it’s not loading these roles in time?


    Robin W
    Moderator

    @robin-w

    no, 2.6 does roles differently – so in effect turning that off fixed it for your logged in users. If non logged in see all that you want, then that’s fine, and you are fixed.

    If not come back


    scabbrox
    Participant

    @scabbrox

    Hello again and sorry to necro my previous thread but the issue is I feel linked and so the history is perhaps useful.

    Today I was trying to fix a persistent issue I have with BBpress where bullets and numerical lists will not show up in posts and some searching around led me to some posts where they suggested that some .css might be to blame with the lists function being disabled.

    Looking around for the issue in my child theme I happened upon a bbpspress css file added called ‘loop single reply’ and decided to delete it temporarily to see if this was to blame.

    I downloaded a copy and did not delete the one in file-manager so I could restore if needed.

    Once I did it however it broken my special forum roles above and everybody except keymasters and spectators (the only standard roles I use) lost their forum roles.

    Even after restoring the file, going into users and role editors the roles are all there, but I cannot reassign them, I can only assign standard forum roles.

    The function.php file with role additions is the same as above, but these do not seem to be forum roles anymore, just user roles.

    Before I revert the entire site to a previous day’s back-up and lose the applications and activity we have has since last night I thought I’d check here.

    Many thanks in advance for your help and this definitely teaches me to always me to do a back-up before playing with files, no matter how trivial they may appear.


    scabbrox
    Participant

    @scabbrox

    BTW, this is the content of the loop-single-reply.php file I temporarily disabled:

    <?php

    /**
    * Replies Loop – Single Reply
    *
    * @package bbPress
    * @subpackage Theme
    */
    ?>
    <?php
    $tag = ‘li’;
    if ( bbp_thread_replies() ){
    $tag = ‘div’;
    }
    ?>
    <<?php echo esc_attr( $tag );?> id=”post-<?php bbp_reply_id(); ?>” class=”bbp-reply-header”>

    <div <?php bbp_reply_class(); ?>>

    <div class=”nk-forum-topic-author”>

    <?php do_action(‘bbp_theme_before_reply_author_details’); ?>

    <?php echo godlike_bbp_reply_author_avatar();?>

    <div class=”nk-forum-topic-author-name”>
    <?php bbp_reply_author_link(array(‘sep’ => ”, ‘show_role’ => false, ‘type’ => ‘name’)); ?>
    </div>

    <div class=”nk-forum-topic-author-role”>
    <!– Removed by Zenna to be replaced by Forum Role Display –>
    <!–<?php echo bbp_get_reply_author_role();?>–>
    <?php echo bsp_display_reply_role(bbp_get_reply_id());?>
    </div>

    <?php if (bbp_is_user_keymaster()) : ?>

    <?php do_action(‘bbp_theme_before_reply_author_admin_details’); ?>

    <div class=”bbp-reply-ip nk-forum-topic-author-since”><?php bbp_author_ip(bbp_get_reply_id()); ?></div>

    <?php do_action(‘bbp_theme_after_reply_author_admin_details’); ?>

    <?php endif; ?>

    <?php do_action(‘bbp_theme_after_reply_author_details’); ?>

    </div><!– .bbp-reply-author –>

    <div class=”nk-forum-topic-content”>

    <?php do_action(‘bbp_theme_before_reply_content’); ?>

    <?php bbp_reply_content(); ?>

    <?php do_action(‘bbp_theme_after_reply_content’); ?>

    </div><!– .bbp-reply-content –>

    </div><!– .reply –>

    <div class=”nk-forum-topic-footer”>

    <span class=”nk-forum-topic-date”><?php bbp_reply_post_date(); ?></span>

    ” class=”bbp-reply-permalink”>#<?php bbp_reply_id(); ?>

    <span class=”nk-forum-action-btn”>
    <?php do_action(‘sociality-likes’, bbp_get_reply_id(), ‘bb_reply’); ?>
    </span>

    <?php if (bbp_is_single_user_replies()) : ?>

    <span class=”bbp-header”>
    <?php esc_html_e(‘in reply to: ‘, ‘godlike’); ?>
    <a class=”bbp-topic-permalink”
    href=”<?php bbp_topic_permalink(bbp_get_reply_topic_id()); ?>”><?php bbp_topic_title(bbp_get_reply_topic_id()); ?>
    </span>

    <?php endif; ?>

    <?php do_action(‘bbp_theme_before_reply_admin_links’); ?>

    <?php bbp_reply_admin_links(); ?>

    <?php do_action(‘bbp_theme_after_reply_admin_links’); ?>

    </div><!– .bbp-meta –>

    </<?php echo esc_attr( $tag );?>><!– #post-<?php bbp_reply_id(); ?> –>


    scabbrox
    Participant

    @scabbrox

    The following is still in my functions.php file but whilst the custom roles show up under the “forum role” pull-down menu in the user profile, they cannot be saved and do not show under the Member roles list as ‘bbp_specialrolename’ versions, just as simple use roles (we have always had some duplicates for forum and non forum roles).

    function add_new_roles( $bbp_roles )
    {
    $bbp_roles[‘bbp_trial’] = array(
    ‘name’ => ‘Trial’,
    ‘capabilities’ => custom_capabilities( ‘bbp_trial’ )
    );

    $bbp_roles[‘bbp_warlord’] = array(
    ‘name’ => ‘Warlord’,
    ‘capabilities’ => custom_capabilities( ‘bbp_warlord’ )
    );

    $bbp_roles[‘bbp_general’] = array(
    ‘name’ => ‘General’,
    ‘capabilities’ => custom_capabilities( ‘bbp_general’ )
    );

    $bbp_roles[‘bbp_member’] = array(
    ‘name’ => ‘Member’,
    ‘capabilities’ => custom_capabilities( ‘bbp_member’ )
    );

    $bbp_roles[‘bbp_council_member’] = array(
    ‘name’ => ‘Council Member’,
    ‘capabilities’ => custom_capabilities( ‘bbp_council_member’ )
    );

    return $bbp_roles;
    }

    add_filter( ‘bbp_get_dynamic_roles’, ‘add_new_roles’, 1 );

    function add_role_caps_filter( $caps, $role )
    {
    if( $role == ‘bbp_trial’ )
    $caps = custom_capabilities( $role );

    if( $role == ‘bbp_warlord’ )
    $caps = custom_capabilities( $role );

    if( $role == ‘bbp_general’ )
    $caps = custom_capabilities( $role );

    if( $role == ‘bbp_member’ )
    $caps = custom_capabilities( $role );

    if( $role == ‘bbp_council_member’ )
    $caps = custom_capabilities( $role );

    return $caps;
    }

    add_filter( ‘bbp_get_caps_for_role’, ‘add_role_caps_filter’, 10, 2 );

    function custom_capabilities( $role )
    {
    switch ( $role )
    {

    /* Capabilities for ‘councilmember’ role */
    case ‘bbp_council_member’:
    return array(
    // Primary caps
    ‘spectate’ => true,
    ‘participate’ => true,
    ‘moderate’ => true,
    ‘throttle’ => true,
    ‘view_trash’ => false,

    // Forum caps
    ‘publish_forums’ => false,
    ‘edit_forums’ => false,
    ‘edit_others_forums’ => false,
    ‘delete_forums’ => false,
    ‘delete_others_forums’ => false,
    ‘read_private_forums’ => true,
    ‘read_hidden_forums’ => true,

    // Topic caps
    ‘publish_topics’ => true,
    ‘edit_topics’ => true,
    ‘edit_others_topics’ => true,
    ‘delete_topics’ => true,
    ‘delete_others_topics’ => true,
    ‘read_private_topics’ => true,

    // Reply caps
    ‘publish_replies’ => true,
    ‘edit_replies’ => true,
    ‘edit_others_replies’ => true,
    ‘delete_replies’ => true,
    ‘delete_others_replies’ => true,
    ‘read_private_replies’ => true,

    // Topic tag caps
    ‘manage_topic_tags’ => true,
    ‘edit_topic_tags’ => true,
    ‘delete_topic_tags’ => true,
    ‘assign_topic_tags’ => true,
    );

    /* Capabilities for ‘member’ role */
    case ‘bbp_member’:
    return array(
    // Primary caps
    ‘spectate’ => true,
    ‘participate’ => true,
    ‘moderate’ => false,
    ‘throttle’ => false,
    ‘view_trash’ => false,

    // Forum caps
    ‘publish_forums’ => false,
    ‘edit_forums’ => false,
    ‘edit_others_forums’ => false,
    ‘delete_forums’ => false,
    ‘delete_others_forums’ => false,
    ‘read_private_forums’ => true,
    ‘read_hidden_forums’ => false,

    // Topic caps
    ‘publish_topics’ => true,
    ‘edit_topics’ => true,
    ‘edit_others_topics’ => false,
    ‘delete_topics’ => false,
    ‘delete_others_topics’ => false,
    ‘read_private_topics’ => true,

    // Reply caps
    ‘publish_replies’ => true,
    ‘edit_replies’ => true,
    ‘edit_others_replies’ => false,
    ‘delete_replies’ => true,
    ‘delete_others_replies’ => false,
    ‘read_private_replies’ => true,

    // Topic tag caps
    ‘manage_topic_tags’ => false,
    ‘edit_topic_tags’ => false,
    ‘delete_topic_tags’ => false,
    ‘assign_topic_tags’ => true,
    );

    /* Capabilities for ‘warlord’ role */
    case ‘bbp_warlord’:
    return array(
    // Primary caps
    ‘spectate’ => true,
    ‘participate’ => true,
    ‘moderate’ => true,
    ‘throttle’ => true,
    ‘view_trash’ => true,

    // Forum caps
    ‘publish_forums’ => true,
    ‘edit_forums’ => true,
    ‘edit_others_forums’ => true,
    ‘delete_forums’ => true,
    ‘delete_others_forums’ => true,
    ‘read_private_forums’ => true,
    ‘read_hidden_forums’ => true,

    // Topic caps
    ‘publish_topics’ => true,
    ‘edit_topics’ => true,
    ‘edit_others_topics’ => true,
    ‘delete_topics’ => true,
    ‘delete_others_topics’ => true,
    ‘read_private_topics’ => true,

    // Reply caps
    ‘publish_replies’ => true,
    ‘edit_replies’ => true,
    ‘edit_others_replies’ => true,
    ‘delete_replies’ => true,
    ‘delete_others_replies’ => true,
    ‘read_private_replies’ => true,

    // Topic tag caps
    ‘manage_topic_tags’ => true,
    ‘edit_topic_tags’ => true,
    ‘delete_topic_tags’ => true,
    ‘assign_topic_tags’ => true,
    );

    /* Capabilities for ‘general’ role */
    case ‘bbp_general’:
    return array(
    // Primary caps
    ‘spectate’ => true,
    ‘participate’ => true,
    ‘moderate’ => true,
    ‘throttle’ => true,
    ‘view_trash’ => true,

    // Forum caps
    ‘publish_forums’ => true,
    ‘edit_forums’ => true,
    ‘edit_others_forums’ => true,
    ‘delete_forums’ => true,
    ‘delete_others_forums’ => true,
    ‘read_private_forums’ => true,
    ‘read_hidden_forums’ => true,

    // Topic caps
    ‘publish_topics’ => true,
    ‘edit_topics’ => true,
    ‘edit_others_topics’ => true,
    ‘delete_topics’ => true,
    ‘delete_others_topics’ => true,
    ‘read_private_topics’ => true,

    // Reply caps
    ‘publish_replies’ => true,
    ‘edit_replies’ => true,
    ‘edit_others_replies’ => true,
    ‘delete_replies’ => true,
    ‘delete_others_replies’ => true,
    ‘read_private_replies’ => true,

    // Topic tag caps
    ‘manage_topic_tags’ => true,
    ‘edit_topic_tags’ => true,
    ‘delete_topic_tags’ => true,
    ‘assign_topic_tags’ => true,
    );

    /* Capabilities for ‘trial’ role */
    case ‘bbp_trial’:
    return array(
    // Primary caps
    ‘spectate’ => true,
    ‘participate’ => true,
    ‘moderate’ => false,
    ‘throttle’ => false,
    ‘view_trash’ => false,

    // Forum caps
    ‘publish_forums’ => false,
    ‘edit_forums’ => false,
    ‘edit_others_forums’ => false,
    ‘delete_forums’ => false,
    ‘delete_others_forums’ => false,
    ‘read_private_forums’ => true,
    ‘read_hidden_forums’ => false,

    // Topic caps
    ‘publish_topics’ => true,
    ‘edit_topics’ => true,
    ‘edit_others_topics’ => false,
    ‘delete_topics’ => false,
    ‘delete_others_topics’ => false,
    ‘read_private_topics’ => true,

    // Reply caps
    ‘publish_replies’ => true,
    ‘edit_replies’ => true,
    ‘edit_others_replies’ => false,
    ‘delete_replies’ => true,
    ‘delete_others_replies’ => false,
    ‘read_private_replies’ => true,

    // Topic tag caps
    ‘manage_topic_tags’ => false,
    ‘edit_topic_tags’ => false,
    ‘delete_topic_tags’ => false,
    ‘assign_topic_tags’ => true,
    );

    break;

    default :
    return $role;
    }
    }
    // ==============================================================
    // Switch off bbPress Forum moderation
    add_filter( ‘bbp_bypass_check_for_moderation’, ‘__return_true’ );


    scabbrox
    Participant

    @scabbrox

    Have sorted it for now by using default roles to give people access but would like the custom roles to be working again if possible.


    Robin W
    Moderator

    @robin-w

    custom roles work on my test site under2.6

    I’ll load your code onto my test site later and see if it works there.


    scabbrox
    Participant

    @scabbrox

    put in a reply with some links to imgur images and explanations but it’s seemingly gone to moderation approval due to the links.

    Have a look if you find it there, if not I’ll re-write it without working links.


    scabbrox
    Participant

    @scabbrox

    OK… I seem to have found a solution, it’s not elegant but no idea how else to fix it.

    As I said in my post withe the links the roles are still there, just not listed in the roles section. You can pull down the menu and select the role, but it fails and trying to edit its capabilities only takes you the capabilities for the new standard role they have.

    However, if I clone a standard bbp role of the same type or create a new role called the same as one of the old roles e.g bbp_council_member. It adds the role with a warning that the role is not editable as created by another plugin (in this case my functions.php file) but doing this puts it back in the list and automatically reassigns all the previous users to that role.

    It dumps moderator into other roles (but not as a forum role) so I need to flag back to moderator for forum and then again to the new custom role to get rid of it, but it works.

    Very strange really, no idea why this should happen simply because I took away one file from the single_loop_reply for the child theme.


    scabbrox
    Participant

    @scabbrox

    Just as a query as it might be faster than manually fixing all the flags of old roles from each member but if I use the remap all users to default roles will this clear the database of all the flags in one go?

    I guess, it it safe is what I am asking, don’t want to inadvertently lose keymaster rights and be stuck.


    Robin W
    Moderator

    @robin-w

    ok, thanks for the update.

    I loaded your code in my test site and it works fine – eg I can allocate someone to warlord.

    what plugins do you have on your site?


    scabbrox
    Participant

    @scabbrox

    Not sure how to easily get a list, but this is what’s in my plugins folder:

    advanced-backgrounds
    4 KB
    Apr 2, 2020, 2:12 PM
    httpd/unix-directory
    0755

    advanced-css-editor
    4 KB
    Dec 15, 2019, 12:04 PM
    httpd/unix-directory
    0755

    advanced-custom-fields-pro
    4 KB
    Today, 5:51 PM
    httpd/unix-directory
    0755

    akismet
    4 KB
    Apr 30, 2020, 11:45 AM
    httpd/unix-directory
    0755

    all-in-one-wp-migration
    4 KB
    May 18, 2020, 4:13 PM
    httpd/unix-directory
    0755

    all-in-one-wp-migration.6.77.zip
    331.74 KB
    Dec 15, 2019, 11:54 AM
    package/x-generic
    0644

    bbp-private-groups
    4 KB
    May 22, 2020, 11:17 AM
    httpd/unix-directory
    0755

    bbp-style-pack
    4 KB
    May 8, 2020, 4:37 PM
    httpd/unix-directory
    0755

    bbp-toolkit
    4 KB
    Dec 15, 2019, 12:04 PM
    httpd/unix-directory
    0755

    bbp-user-online-status
    4 KB
    Dec 15, 2019, 12:04 PM
    httpd/unix-directory
    0755

    bbpress
    4 KB
    Jan 30, 2020, 4:43 PM
    httpd/unix-directory
    0755

    bbpress-enable-tinymce-visual-tab
    4 KB
    Dec 15, 2019, 12:04 PM
    httpd/unix-directory
    0755

    bbpress-mark-as-read
    4 KB
    Dec 15, 2019, 12:04 PM
    httpd/unix-directory
    0755

    bbpress-wp-tweaks
    4 KB
    Jan 15, 2020, 10:12 AM
    httpd/unix-directory
    0755

    bbpress2-shortcode-whitelist
    4 KB
    Dec 15, 2019, 12:04 PM
    httpd/unix-directory
    0755

    bp-custom.php
    302 bytes
    Nov 14, 2019, 2:05 PM
    application/x-httpd-php
    0644

    bsp_test.css
    134 bytes
    Nov 14, 2019, 2:05 PM
    text/css
    0644

    bspstyle.css
    12.2 KB
    Nov 14, 2019, 2:05 PM
    text/css
    0644

    buddypress
    4 KB
    May 15, 2020, 2:15 PM
    httpd/unix-directory
    0755

    category-featured-images-extended
    4 KB
    Dec 15, 2019, 12:04 PM
    httpd/unix-directory
    0755

    contact-form-7
    4 KB
    May 22, 2020, 11:17 AM
    httpd/unix-directory
    0755

    custom-sidebars
    4 KB
    Dec 15, 2019, 12:04 PM
    httpd/unix-directory
    0755

    extended-widget-options
    4 KB
    Dec 15, 2019, 12:04 PM
    httpd/unix-directory
    0755

    facebook-pagelike-widget
    4 KB
    Dec 15, 2019, 12:04 PM
    httpd/unix-directory
    0755

    gd-bbpress-attachments
    4 KB
    May 13, 2020, 4:18 PM
    httpd/unix-directory
    0755

    gd-bbpress-tools
    4 KB
    May 13, 2020, 4:18 PM
    httpd/unix-directory
    0755

    godlike-core
    4 KB
    Today, 1:00 PM
    httpd/unix-directory
    0755

    google-analytics-dashboard-for-wp
    4 KB
    Feb 26, 2020, 3:41 PM
    httpd/unix-directory
    0755

    index.php
    28 bytes
    Nov 14, 2019, 2:05 PM
    application/x-httpd-php
    0644

    jetpack
    4 KB
    May 6, 2020, 7:51 AM
    httpd/unix-directory
    0755

    js_composer
    4 KB
    Apr 25, 2020, 3:27 PM
    httpd/unix-directory
    0755

    kirki
    4 KB
    May 22, 2020, 11:17 AM
    httpd/unix-directory
    0755

    list-category-posts
    4 KB
    Dec 15, 2019, 12:04 PM
    httpd/unix-directory
    0755

    lock-user-account
    4 KB
    Dec 15, 2019, 12:04 PM
    httpd/unix-directory
    0755

    login-with-ajax
    4 KB
    Jan 24, 2020, 9:34 AM
    httpd/unix-directory
    0755

    mailchimp-for-wp
    4 KB
    Apr 28, 2020, 4:44 PM
    httpd/unix-directory
    0755

    members
    4 KB
    Apr 29, 2020, 1:07 AM
    httpd/unix-directory
    0755

    menu-icons
    4 KB
    Dec 15, 2019, 12:04 PM
    httpd/unix-directory
    0755

    mycred
    4 KB
    May 8, 2020, 4:37 PM
    httpd/unix-directory
    0755

    nav-menu-roles
    4 KB
    Mar 28, 2020, 3:21 PM
    httpd/unix-directory
    0755

    nk-themes-helper
    4 KB
    May 6, 2020, 7:51 AM
    httpd/unix-directory
    0755

    nk-woocommerce-swatches
    4 KB
    Jan 26, 2020, 11:20 AM
    httpd/unix-directory
    0755

    notification
    4 KB
    Apr 22, 2020, 10:14 AM
    httpd/unix-directory
    0755

    notification-bbpress
    4 KB
    May 18, 2020, 4:11 PM
    httpd/unix-directory
    0755

    notification-buddypress
    4 KB
    May 18, 2020, 4:14 PM
    httpd/unix-directory
    0755

    paypal-donations
    4 KB
    Dec 15, 2019, 12:04 PM
    httpd/unix-directory
    0755

    post-views-counter
    4 KB
    Dec 15, 2019, 12:04 PM
    httpd/unix-directory
    0755

    quick-pagepost-redirect-plugin
    4 KB
    Dec 15, 2019, 12:04 PM
    httpd/unix-directory
    0755

    recent-posts-widget-with-thumbnails
    4 KB
    Jan 15, 2020, 10:13 AM
    httpd/unix-directory
    0755

    revslider
    4 KB
    May 17, 2020, 11:57 AM
    httpd/unix-directory
    0755

    sociality
    4 KB
    Apr 23, 2020, 9:53 AM
    httpd/unix-directory
    0755

    tinymce-advanced
    4 KB
    Apr 2, 2020, 2:12 PM
    httpd/unix-directory
    0755

    tomparisde-twitchtv-widget
    4 KB
    Apr 30, 2020, 6:56 PM
    httpd/unix-directory
    0755

    ttv-easy-embed
    4 KB
    Mar 11, 2020, 1:58 PM
    httpd/unix-directory
    0755

    updraftplus
    4 KB
    Today, 11:53 AM
    httpd/unix-directory
    0755

    user-role-editor
    4 KB
    May 5, 2020, 10:13 AM
    httpd/unix-directory
    0755

    usp-helper
    4 KB
    Dec 15, 2019, 12:04 PM
    httpd/unix-directory
    0755

    usp-pro
    4 KB
    Apr 9, 2020, 3:30 PM
    httpd/unix-directory
    0755

    w3-total-cache
    40 KB
    Apr 29, 2020, 1:07 AM
    httpd/unix-directory
    0755

    woocommerce
    4 KB
    May 22, 2020, 11:17 AM
    httpd/unix-directory
    0755

    woocommerce-admin
    4 KB
    May 19, 2020, 12:53 PM
    httpd/unix-directory
    0755

    wow-recruitment-legion
    4 KB
    Dec 15, 2019, 12:04 PM
    httpd/unix-directory
    0755

    wp-discord
    4 KB
    Dec 15, 2019, 12:04 PM
    httpd/unix-directory
    0755

    wp-google-maps
    4 KB
    May 8, 2020, 4:37 PM
    httpd/unix-directory
    0755

    wp-optimize
    4 KB
    Apr 2, 2020, 2:11 PM
    httpd/unix-directory
    0755

    wp-slimstat
    4 KB
    Dec 15, 2019, 12:04 PM
    httpd/unix-directory
    0755

    wp-smushit
    4 KB
    May 19, 2020, 12:53 PM
    httpd/unix-directory
    0755

    wpcat2tag-importer
    4 KB
    Dec 15, 2019, 12:04 PM
    httpd/unix-directory
    0755

    youtube-embed-plus
    4 KB
    Apr 17, 2020, 3:40 PM
    httpd/unix-directory
    0755

Viewing 25 replies - 1 through 25 (of 29 total)
  • You must be logged in to reply to this topic.
Skip to toolbar