davellan (@davellan)

Forum Replies Created

Viewing 7 replies - 1 through 7 (of 7 total)
  • @davellan

    Participant

    Stackoverflow came to the rescue, and I have this question to thank for it.

    If you read all the comments, it gets to the solution, which in my case was this code.

    function i4w_authenticated_remote_login_action($user, $contact) {
      global $SESSION;
      IF ($arrTAGS = explode(',', $SESSION['i4wuser']['Groups'])) :
        IF (in_array(38181, $arrTAGS) || in_array(38185, $arrTAGS) || in_array(38193, $arrTAGS)) :
          $user_id = get_current_user_id();      
          $new_role_forum_role="bbp_participant";
          bbp_set_user_role( $user_id, $new_role_forum_role );
          $wp_user_capabilities_arr = array("subscriber" => true, "bbp_participant" => true, "bbp_spectator" => false);
          update_user_meta($user_id, "wp_capabilities", $wp_user_capabilities_arr);
        ELSEIF (in_array(38177, $arrTAGS) || in_array(38195, $arrTAGS) || in_array(38183, $arrTAGS) || in_array(38187, $arrTAGS) || in_array(38189, $arrTAGS)) :
          $user_id = get_current_user_id();      
          $new_role_forum_role=”bbp_spectator”;
          bbp_set_user_role( $user_id, $new_role_forum_role );
          $wp_user_capabilities_arr = array("subscriber" => true, "bbp_spectator" => false);
          update_user_meta($user_id, "wp_capabilities", $wp_user_capabilities_arr);
        ENDIF;
      ENDIF;
    }
    add_filter('i4w_authenticated_remote_login', 'i4w_authenticated_remote_login_action', 1, 2);

    I am a bit confused as to why I needed to use the update_user_meta to remove the additional capabilities (or why I would have had additional capabilities generated from the bbp_set_user_role function). If someone could answer that it would be greatly appreciated, as I am sure this code is not 100% efficient.

    @davellan

    Participant

    John James Jacoby – thank you for mentioning Members by Justin Tadlock.

    Deactivating the previous plugins and just activating that fixed a lot of problems, even without touching anything. Keymaster now functions properly, which is a relief.

    I still have some work to do, as the spectator and participant roles don’t seem to be functioning quite right, but this definitely shines some light on what was wrong.

    @davellan

    Participant

    Deactivating and activating these plugins definitely causes issues, such as stripping all the capabilities from all the role types. Crap.

    Skimming through the internet reveals people with similar problems, but no clear resolution that I can follow. It seems like these role plugins can write into the database and mess with bbPress settings (at least from my understanding of it).

    I need a way of reversing the damage this has done, but without losing my forums if possible. Fortunately, the site is new so the forum is not active, but I would rather not have to build up the structure from scratch.

    @davellan

    Participant

    Sorry didn’t see this earlier.

    It was working at one point, because as the Keymaster I was able to edit the forums, where now I cannot.

    Plugins I have used for roles:

    Change WordPress user roles and capabilities

    Cannot find a website for this one, but it is called User Roles and Capabilities.

    @davellan

    Participant

    Still having an issue, although it seems to have evolved.

    So now using the roles and capability manager, the changes I make stick.

    Even so, bbPress roles don’t seem to work. So I made a new WP role I called member, and assigned it participant capabilities. I then changed subscriber (the default) and assigned it spectator capabilities. These roles new allow users to function as I wanted. A hack but it works reliably.

    But now, as the WP admin and keymaster, I cannot moderate the forums through the dashboard or inside the forum. Since none of the bbPress roles actually work, I can’t do anything with them. I suppose I will have to make yet another role and call it moderator, and give it all the keymaster capabilities.

    But this shouldnt have to be like this. Really lost on why this is broken.

    @davellan

    Participant

    I got a role and capability manager, and I see that the WP subscriber role (by default is selected) gives users both “spectate” and “participant” roles (even though I have it set to only form role specatator by default).

    I edited this and left the subscriber role only with specatate capability. It would then not allow spectators to post (yay) but also blocked participants (boo). I switched roles to moderator to see if it would allow posting and it did. When I switched back to participant, it worked (yay) but then when I went to spectator it also worked (boo).

    So I went back to the roles and capability manager, and also the capabilities I toggled off were toggled back on! How does this happen?

    @davellan

    Participant

    Did that and nothing found. Used different themes, deactivated all my plugins and still nothing.

Viewing 7 replies - 1 through 7 (of 7 total)