Project:User types
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

I have two user types set up, "Business" and "User". I want users who sign up as businesses to have their account approved before they can post content on the site, but normal users should not have to.

I tried to create a module to do this using the trigger and action modules.

Basically, when a user signs up with a specific role, i tried to have the module unblock that user, but to no avail.

My module seems to try to do this before the role is assigned. Can you direct me to the part of the code that assigns the role, or if you like, i have no problem with you integrating my code with yours.

Any response is appreciated.

Thanks,
Kyle

AttachmentSize
approveactions.zip2.22 KB

Comments

#1

Well, i solved my own problem. Now, my module does nothing except display a form to select the roles, and stores it in a database. the user_types module does the rest.

It probably makes more sense to have user_types.module display the form and store the data, but here's what i did.

I changed the following code in hook_user in user_types.module from:

<?php
if (!empty($role)) {
 
$edit['roles'] = array($role => $role);
}
?>

to this:

<?php
if (!empty($role)) {
 
$edit['roles'] = array($role => $role);
  if (
module_exists('roleapproval')) {
   
$rids = roleapproval_roles();
    if (
in_array($edit['roles'][$role],$rids)) {
     
user_user_operations_unblock(array($edit['uid']));
    }
  }
}
?>

i also updated my module. It's attached.

AttachmentSize
approveactions.tar_.gz 1.11 KB

#2

Status:active» fixed

#3

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.