Give untyped users a user type

domidc - December 12, 2007 - 15:20
Project:User types
Version:5.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed
Description

You should be able to use the user type module on an existing site which has allready a significant amount of users when you could ask them to choose a type at logging in. After choosing the type you will still be able to change from one user type to an other using the switch user feature which was recently added.
Why not simply use the switch user type? Because some sites will allow only one (permanent) user type and will turn off the permission to switch. For this reason this feature could still be usefull.

#1

domidc - December 12, 2007 - 15:28

I decided to develop the feature I requested. A form will be displayed at login in. After choosing your type the page wont be available anymore so if the access to switch user is disabled the type chosen is permanent.

documentation:

adapted functions:
  • menu hook : new item(path 'choosetype') who calls the form via user_types_page(), access is checked by user_type_user_access_choosetype().
  • user hook : case login which checks if you are allready a 'typed' user, and if you're not you'll be directed to the form.
new functions:
  • user_type_user_access_choosetype() : If you allready have a type access is denied to the form.
  • user_types_page() : Sets up the page to display the form.
  • user_types_set_type() : the form where you can choose your type.
  • user_types_set_type_submit($form_id, $form_values): inserts your uid and user_type_type in the user_types_user table.
AttachmentSize
user_types_give_type.module.patch 2.89 KB

#2

swentel - September 26, 2008 - 14:11
Status:active» fixed

There was an implementation of the idea in HEAD allready, so I left the current implementation with one minor modification based on your suggestions: you can only switch if you currently have the default user type (normal user).

#3

Anonymous (not verified) - October 10, 2008 - 14:12
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.