Holding accounts of a certain role for admin approval
I have a feature requirement I am trying to work out for a new site I am building for a client. However, I am not sure how to proceed with this feature, and would like some advice. I've tried posting in the regular drupal forums, and asking in the various IRC chats, but have not been able to raise any suggestions, so now I turn to you!
We are using the rolesignup module to allow users to sign up into certain roles. For all roles but one or two, we do not want the user accounts to have to depend on admin approval. However, there are certain roles that need to have access to sensitive contents - we would like these roles to be subject to admin approval.
Is there any way to run a check on which role a new account belongs to, and to hold it for admin approval if it is of a certain type?
I appreciate any and all advice and direction on this!


Ical feed
workflow_ng?
Have you looked at workflow_ng? I've barely looked at it myself, but I've read about it. I think it would be able to do what you're asking about.
Thanks for the reply
Thanks for the reply nadavoid.
Can anyone else confirm if this can be handled by workflow_ng? I have used it before for other things, and I don't seem to recall it being able to do something like this. Of course, that was several revisions ago.
any further suggestions?
any further suggestions? Workflow_ng does not seem to be able to do what I need.
maybe use hook_user
maybe use the register $op on hook_user to determine the role, and then set the account status to blocked rather than active.
maybe a workaround...
I was just poking around in workflow_ng, just to see what it is capable of by itself. I think there is something there that might work for you, although not exactly as you would like.
Hopefully that helps some. Let us know if you end up working out a better solution.
Yes, that is more or less
Yes, that is more or less what I was playing with. However, I can't find out how to trigger this action.
Simply put, I suspect that at the point that workflow_ng checks whether to fire (ie, immediately after the user registers), the user's role hasn't been assigned yet.
I suspect this is due to how rolesignup works - from poking around the rolesignup.module, it appears that the roles are added after the workflow event is fired. Explicitly, the module makes an entry into the roles table in hook_users when the 'insert' op is triggered:
<?php/**
* Implementation of hook_user()
*/
function rolesignup_user($op, &$edit, &$account, $category = NULL) {
switch ($op) {
case 'insert':
$roles = user_roles(1,'register for role');
if ($roles[$_SESSION['role']]) {
db_query("INSERT INTO {users_roles} (uid, rid) VALUES (%d, %d)", $account->uid, $_SESSION['role']);
}
}
}
?>
So, this means the 'user has registered' event trigger doesn't work. None of the other ones are guaranteed to be only once; a user may update his account information multiple times.
A work around I am thinking about is to create another utility role. This will be automatically added by rolesignup when users signup for the sensitive role. Then, when they first log in and view their user page, fire an event to do the above.
Of course, this isn't perfect, and kind of is the long way around. Any better suggestions?