Re: bbPress 1.0-alpha-4 released
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.
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.