Once a user has correctly entered the confirmation code to activate their mobile phone number, it would be nice to have them automatically added to a certain role. It could be done quite easily by adding some code after user_save in sms_user_settings_confirm_form_submit. In fact the following code achieves this, but is hard coded to a single role which is in use on one of my websites:
$rid = 6;
$role_name = db_result(db_query('SELECT name FROM {role} WHERE rid = %d', $rid));
if ($account !== FALSE && !isset($account->roles[$rid])) {
$roles = $account->roles + array($rid => $role_name);
user_save($account, array('roles' => $roles));
}
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | smsframework-515700.patch | 2.47 KB | fw_crocodile |
Comments
Comment #1
fw_crocodile commentedI think it would be better to integrate with trigger module.
As to have a trigger that let you do some action on number activation. This would be a lot more usefull.
Comment #2
fw_crocodile commentedHi,
this is a patch that created a new trigger on code validation. Note no actions id are registered to the trigger so you need to use the triggerunlock module.
You just have to create an action to change user role and apply it to the trigger.
Beware, the patch contain the #661134: Add "receive sms" permission. change too.
Comment #3
BenK commentedSubscribing...
Comment #4
univate commentedComment #5
grub3 commentedYou may look also at this issue: http://drupal.org/node/864326
I updated the patch.
Comment #6
dpi