Skip to:
Content
Pages
Categories
Search
Top
Bottom

Custom User Groups

  • Hi There, this really bugs me. I love bbpress and it’s simplicity.

    Im currently using Version 0.9.0.2.

    Is there any plugin or feature that allows me to create custom user groups?

    I need to say group A is allowed to view forum xyz, while group B is not allowd to do so. (im already using Hidden Forums to prevent serval forum from being seen from those who are not logged in)

    I hope you get what I mean.

    thanks in advance

    – farly

    btw, my forum rulord.de

Viewing 4 replies - 1 through 4 (of 4 total)
  • You can use fel64’s unofficial plugin to add a new Role:

    https://bbpress.org/forums/topic/adding-a-new-user-type?replies=6#post-9210

    I’ve used this together with Hidden Forums, and it works really nicely! :-)

    Thanks!

    I modified this approach slightly and ended up with this:

    <?php
    /*
    Plugin Name: Add custom usergroups
    Description: Adds custom usergroups
    Author: fel64, farly
    */
    add_filter('get_roles', 'add_custom_usergroups');

    function add_custom_usergroups( $roles ) {

    //define custom groups
    $groups['mitglied_probe'] = array('Mitglied auf Probe', array('rulord_level1'));
    $groups['mitglied'] = array('Mitglied', array('rulord_level1', 'rulord_level2'));
    $groups['kernmitglied'] = array('Kernmitglied', array('rulord_level1', 'rulord_level2', 'rulord_level3'));
    $groups['koordinator'] = array('Koordinator', array('rulord_level1', 'rulord_level2', 'rulord_level3', 'rulord_level4'));
    $groups['leiter'] = array('Leiter', array('rulord_level1', 'rulord_level2', 'rulord_level3', 'rulord_level4', 'rulord_level5'));

    foreach ($groups as $key => $g) {
    $roles[$key] = $roles['member']; //duplicate member capabilities
    $roles[$key] =& $user[$key]; //convenience
    $user[$key]['name'] = __($g[0]);
    foreach( $g[1] as $capability ) {
    $user[$key]['capabilities'][$capability] = true;
    }
    }
    return $roles;

    }
    ?>

    It works for me so far :)

    Okay I had to change it a bit:

    <?php
    /*
    Plugin Name: Add custom usergroups
    Description: Adds custom usergroups
    Author: fel64, farly
    */
    add_filter('get_roles', 'add_custom_usergroups');

    function add_custom_usergroups( $roles ) {

    //define custom groups

    //$groups['GROUPNAME'] = array('CAPABILITIES LIKE','HUMAN GROUPNAME', array(EXTRA CAPABILITY, EXTRA CAPABILITY));

    $groups['probemitglied'] = array('member','Mitglied auf Probe', array());
    $groups['mitglied'] = array('member','Mitglied', array());
    $groups['kernmitglied'] = array('member','Kernmitglied', array());
    $groups['koordinator'] = array('moderator','Koordinator', array());
    $groups['leiter'] = array('administrator','Leiter', array());

    foreach ($groups as $key => $g) {
    $roles[$key] = $roles[$g[0]]; //duplicate member capabilities
    $roles[$key]['name'] = __($g[1]); // change name
    foreach( $g[2] as $capability ) {
    $roles[$key]['capabilities'][$capability] = true; // add extra capabilities
    }
    }
    return $roles;
    }
    ?>

    Hi,

    i activate the plugin but i cannot select any new user type in the profile of users. How to select the new roles?

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