dragly (@dragly)

Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • @JesperA: Have you tried to change the cookie keys from the default phrases? For instance a simple word?

    I’m not at all sure if that’s the problem, but I didn’t get my integration working before I changed the keys to something completely different without special chars or whitespaces. Although I might have done something else as well in the same run.

    I’ve updated the plugin to cope with forums using blocked and inactive users as well.

    function inactive_to_member() {
    $userID = bb_get_current_user_info( 'id' );
    $user_obj = new BP_User( $userID );
    $user = bb_get_user( bb_get_user_id( $userID ) );
    if(empty($user->capabilities)) {
    $user_obj->set_role('member');
    }
    }
    add_action ('bb_head', 'inactive_to_member', 5, 0);

    The only flaw I can find with this plugin is that it won’t update the user’s role until the next time the user refreshes the page. I guess it could be fixed with a simple redirect/refresh in the plugin however.

    I was in need of a quickfix for the user-role problem, so I wrote a really ugly plugin for it.

    Whenever the page is shown, it checks whether or not the user is able to “write_post”. If not, it sets the user role to “member”.

    IMPORTANT: This means the plugin won’t be usable for all of you who are in the need of setting users as ‘inactive’ or ‘blocked’! In my case, I probably won’t need ‘inactive’ or ‘blocked’ users before bbPress 1.0 is released.

    Download plugin

    Here is the code for the plugin if you would like to check it out before download. And by the way, I’m not really used to writing plugins for bbPress yet, so if I’ve made any really bad flaws (especially on the security-side) please sort me out.

    function inactive_to_member() {
    $userID = bb_get_current_user_info( 'id' );
    $user_obj = new BP_User( $userID );
    if(!bb_current_user_can('write_post')) {
    $user_obj->set_role('member');
    }
    }
    add_action ('bb_head', 'inactive_to_member', 5, 0);

    I hope this might help some of you out.

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