Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 6 replies - 1 through 6 (of 6 total)
  • @spiritix

    Participant

    Hello guys

    What I used is:
    – BuddyPress with combination of either bbP private groups plugin or Members plugin or Restrict Content Pro – bbPress plugin
    – I created extended BuddyPress profile fields in registration
    – I restricted access to the forum with one of above mentioned plugins
    – I used my code mentioned in the beginning

    How it looks like:
    – my code works like a charm! once you choose User1 type in registration, it applies subscriber role, User2 subscriber as well, contributor for User3 – THIS WORKS.
    – what does NOT work is restriction via plugins. Have no clue why. With members plugin od pivate groups, I set Forum1 to be accessable ONLY to User3 type of user, but User1 and User2 can access too! Why?! It has nothing to do with my code, after registration you can clearly check it in WP Users that the role has been assigned.

    If I knew hot to restrict access to the forum based on the WP Role, my code would be sufficient to solve this. Can you help with that part?


    @youmin
    – are upi saying in BB 2.2 access to forum based on the WP role is fixed?

    @spiritix

    Participant

    Never mind, I think I have it 🙂
    [edited – please use the ‘code’ button to share snippets]

    add_action('bp_core_activated_user', 'bp_custom_registration_role',10 , 3);
    function bp_custom_registration_role($user_id, $key, $user) {
       $userdata = array();
       $userdata['ID'] = $user_id;
       $userdata['role'] = xprofile_get_field_data('Typ konta', $user_id);
       
       if ($userdata['role'] == 'User1') 
          $userdata['role'] = 'subscriber';
       
       if ($userdata['role'] == 'User2') 
          $userdata['role'] = 'subscriber';
       
       if ($userdata['role'] == 'User3') 
          $userdata['role'] = 'contributor';
    
       //only allow if user role is my_role
       if (($userdata['role'] == "subscriber") or ($userdata['role'] == "contributor"))
          wp_update_user($userdata);
       
      }

    @spiritix

    Participant

    btw – how can I have so nice BuddyPress members section?

    Members

    It’s awesome!

    @spiritix

    Participant

    Hi there

    One more issue (it’s killing me). Despite having the registration disabled, emails for registration and the whole activation process stayed from buddypress. So I use WP registration template but get buddypress emails and activation – which is even NOT WORKING!

    Can you help me disable whole f*ckin BuddyPress registration&activation process so I can use only WP registration + its emails and everything?

    I appreciate your help.
    Thank you!

    @spiritix

    Participant

    Great man, this solved the issue. Thanks 🙂

    @spiritix

    Participant

    Hey, no this did not help :-/

Viewing 6 replies - 1 through 6 (of 6 total)
Skip to toolbar