how to implement role control using custom user_profile.tpl

theWolf - March 23, 2008 - 22:22
Project:Role Control
Version:6.x-1.x-dev
Component:Code
Category:support request
Priority:normal
Assigned:theWolf
Status:active
Description

is there any way that can call the function role_control_user() so that I can implement it using a custom user_profile.tpl. If you can provided a snippet it would be much appreciated. Thanks,

#1

elliot - March 24, 2008 - 00:02

Can you elaborate a bit on what you'd like to do? Are you trying to add the role control options to a custom user/edit screen?
-Elliot

#2

theWolf - March 24, 2008 - 02:21

Actually I have 2 issues which are 1) as of now the administrator can choose multiple roles by going to "My account -> Edit" but all other regular users "Authenticated users" do not see any option to select multiple roles.

This are some of the settings I have:

1. I am using the role signup module (allows users to signup for roles upon registration)
2. I gave the following permissions to the the users in certain roles that will be able to select multiple roles:
"admin role control" & "maintain own role control"

The second issue is that I would like to create a new tab under "My account -> Edit" where all I have is the selection of roles where the users can choose from.

#3

elliot - March 24, 2008 - 21:19

1. Someone else was saying there were problems with the role signup module and role control. I don't use it, so I'm not sure what they are, but I believe if you signup for a role at registration time role control may remove it, (might be the other way round.)
2. The role "Authenticated Users" will need the "maintain own role control" permission to be able to choose their roles.
3. I'm not sure how to move the role control section from the main edit page to a different tab. Seems you should be able to go through the module code and find the section that posts it onto the edit page and tweak it to show up on a different tab fairly easily.

(Sorry if these answers aren't great, my computer died over the weekend and it's going to take me a while to get back up and running.)

#4

briskday - November 13, 2008 - 23:58

I love this module. I am using the 6.x dev version as well as the profile module in core. I am trying to move the role control check box on the user edit form to the profile tab, which I've done with hook_form_alter but then the check box no longer works. How can I move it from the main account edit form to the profile edit form while maintaining functionality?

I am using the profile module for a volunteer network so when they sign up they check the box to give themselves the volunteer role, then fill out the profile, but it's weird to have those two steps on different pages, would like to consolidate them on the profile form.

If anyone can point me in the right direction it would be greatly appreciated.

#5

elliot - November 14, 2008 - 00:16
Version:5.x-1.0» 6.x-1.x-dev

@briskday
You might be able to change && $category == 'account' to be && $category == 'someothercategory' in the role_control_user function. I think that's where it decides which page to show up on, though I have to admit I haven't looked at the code much in the last year and haven't tested this theory.

#6

briskday - November 14, 2008 - 06:43

Thanks elliot,

that did it, changed $category == account to $category == volunteer profile and it works like a charm...

However, now I just noticed that the check box in the registration form does not work (even reverting to the untouched 6.x dev version)
I have set permissions for every role (anonymous, authenticated, and volunteer) to be able to control their 'volunteer' role status, but checking the box at registration does not assign the role to the user. I suppose the solution is somewhere in that

case (insert): line

again your wisdom is greatly appreciated, to recap - works perfect on the user account form, does not work from the registration form.

#7

elliot - November 14, 2008 - 14:03

@briskday
I just tested your change on my install. It appears to work, so I'm going to guess there's another module interfering or that there is some setting that's incorrect on the admin side. If you have the ability to turn off all other third-party modules and test, that might make the cause more obvious. The function that handles the user registration page is:
role_control_form_alter.

If you post back here again with questions could you please start a new thread? This support request was actually for Drupal 5.

good luck.
-Elliot

 
 

Drupal is a registered trademark of Dries Buytaert.