Posted by shenzhuxi on July 9, 2009 at 6:13am
Issue Summary
An action to edit a user's role should be added earlier.
Attached is a patch to user.module that implements function user_edit_user_role_action().
Patch is done against user.module in drupal 6.13.
| Attachment | Size | Status | Test result | Operations |
|---|---|---|---|---|
| user_module.patch | 1.29 KB | Ignored: Check issue status. | None | None |
Comments
#1
I think that Drupal 6 is close to API changes; this means that only code bugs are fixed.
#2
at action creation of "change role" i get a white screen of death with url:admin/settings/actions/configure/4525d06b8e38a14f7e33fe6629cd9f4b
#3
I'm sorry for the small typo in the patch. Check the new attach.
#4
Folks will still get the white screen of death as you are missing the 'user_edit_user_role_action' function itself in the patch.
#5
You'll need to add:
function user_edit_user_role_action(&$object, $context = array()) {
$role = $context['role'];
$operation = $context['operation'];
if (isset($object->uid)) {
// $uid = $object->uid;
user_multiple_role_edit(array($object->uid), $operation, $role);
}
}
#6
Sorry, hope this time I made the right patch.
#7
Oh it seems not to be necessary now. Drupal 6.14 already has this action now.
Sorry.
views_bulk_operations has this action not Drupal 6.14.
#8
I'd made an error anyway. It should have been:
function user_edit_user_role_action(&$object, $context = array()) {
global $user;
$role = $context['role'];
$operation = $context['operation'];
if (isset($user->uid)) {
user_multiple_role_edit(array($user->uid), $operation, $role);
}
}
#9
I just upgraded to 6.14 and I don't see this action in my advanced action menu. I added the patch mentioned earlier, but when I go to triggers it doesn't shop up? This is myfirst time trying to create my own action.
Raelyn
#10
Thank you,
First, this Action is NOT in 6.14, then, there still needs a patch or module to use this function !
And this is definitely a very usefull Patch ! Someone knows if it works with 6.14 also ?
ALSO:
Could someone remake the patch with the correction from soramya (post #8) ? I only manage to make this patch work with this correction.
I use it all the time, and I think it should be part of future Drupal Releases.
#11
the view_bulk_operations indeed has the action under advanced actions, but i cannot link this action to a user updating his profile... is there another way to do that? (add a role when the user updates his profile)
#12
I figured out this actions stuff is actually not needed if you use rules... you can use a triggered rule to change a users role.
Just wanted to let you know...
#13
Can you explain this a little bit more, luksedj?
#14
Duplicate of #404398: Add actions for adding/deleting user roles