Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: How to: ddlb of user roles


chrishajer
Participant

@chrishajer

I don’t believe the roles are stored in the database, I think they’re all stored and defined in bb-includes/capabilities.php. So, I don’t believe you can pull them from anywhere other than there. Maybe I missed it and they are defined in the database somewhere, but I don’t think so.

There is already a drop down of roles in the admin section, when you go to edit a user’s profile, you can mark them member, inactive, blocked, etc. Take a look at lines 1309 – 1317 in bb-includes/template-functions.php

<tr>
<th scope="row"><?php _e('User Type:'); ?></th>
<td><select name="role">
<?php foreach( $roles as $r => $n ) : ?>
<option value="<?php echo $r; ?>"<?php if ( array_key_exists($r, $user->capabilities) ) echo ' selected="selected"'; ?>><?php echo $n; ?></option>
<?php endforeach; ?>
</select>
</td>
</tr>

Will that do what you want?

Skip to toolbar