Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Adding a new User Type


Leland Fiegel
Member

@lelandf

Okay, it took me a couple hours but I finally got this to work (sorta) using a variation of fel64’s code. I was using it to create a special usergroup with the same capabilities as regular members for use with the Hidden Forums plugin.

The original code kinda worked, because it did create a new user group with the name I had chosen. I soon realized, however, the users in the user group I made had no capabilities and therefore couldn’t post, edit their profile at all, etc. I was expecting they would have the same capabilities as members.

So I made a few changes and…here’s the plugin code I used:

<?php
/*
Plugin Name: Add lusers
Description: adds the luser role
Author: fel64
*/

add_filter('get_roles', 'addlusers');

function addlusers( $roles ) {
$roles['luser'] =& $luser; //convenience
$luser['name'] = __('Luser');
$lusercaps = array('participate','edit_favorites','edit_tags','edit_topics','edit_posts','edit_profile','write_topics','write_posts','change_password','read');
foreach( $lusercaps AS $cap ) {
$luser['capabilities'][$cap] = true;
}
return $roles;
}
?>

Basically I removed the first line of the function, because for some reason it wasn’t working. I then copied all the capabilities of a regular member in an array format. You can get other capabilities (like for moderators, admins, and key masters) from the capabilities.php file in /bb-includes/.

Just save the code in a .php file and upload it to your plugins folder and activate. You would also probably want to change the “Luser” name to something else.

Now I know this probably isn’t the best way to do it, but it worked for me, so I thought I’d share it here. Hopefully some of you get some use out of it.

Skip to toolbar