It's not much use for users to just click a box to apply. Why should we grant or deny it? I don't personally know each and every single one of my users. I want them to fill out a CCK form that tells me why they think they should be granted this role.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

upupax’s picture

This would be a great feature.
Especially if you think sometimes you need to know some additional information to grant a specific site functionality.

Subscribing.

Soren Jones’s picture

Version: 6.x-1.5 »
upupax’s picture

I think the best solution for this, IMHO, would be to convert apply for role in a cck field.
In this way, with the help of modules like conten_profile, it would be possible to setup different tabs in your profile, and giving user the possibility to apply for role adding new informations.
All these new informations would be automatically stored in the user profile.

heacu’s picture

man, i can't think of any more basic or essential feature than this! seriously the applicant has got to have a reason. subscribing.

dddave’s picture

Marked #330461: Textfield possibility also when applying for role as duplicate. However this feature is absloutly necessary in my eyes. Saddly I am not able to write it.
What does the maintainer think of this?

Jon Pugh’s picture

CCK doesn't really apply here... Role Applications aren't nodes, so there really isn't a way to utilize CCK, unless we hijack the form widgets in some way.

I am working on a project where there is an application process, however... I think webform.module would be a better pairing for this functionality.

I think I may end up writing a module that connects webform and apply_for_role. It wouldn't be too difficult to pull a webform form into the Apply for role form... a settings item to choose which webform node to use for apply_for_role.

Prodigy’s picture

@6

I think making webform a prerequisite to collect a small reason while the user is applying is overkill.

I was thinking more along the lines of hooking into the core profile module. Perhaps being able to assign a profile-text field to 'apply for role'.

I definitely agree this is a needed feature. We just need to figure out how to make it work for the most amount of people.

buttonwillowsix’s picture

I have a use for this too, and could use a solution that connects to the webform.module OR one that just had a simple reason attached. I would also like it if there was the option to add a description to each role (either through another module or this one.)

BenK’s picture

+1 for this feature. I need it also. Even a simple text field would do.

Ari Gold’s picture

I also would like to see tihs feature.

Right now I'm trying to figure out how to have a form with name, address, and textarea that prepopulates from saved address in ubercart...

mpaler’s picture

+1 for webform integration

iaminawe’s picture

+1 webform integration

alberto56’s picture

Title: attach CCK type to application » Provide form fields during the application process

As careernerd has said, CCK does not necessarily apply in this case. Hence, I am changing the title slightly.

This feature would definitely be interesting and I need something like this for a site I'm working on.

There are two types of users: authenticated users who can create their own accounts, and location reps who have to be vetted by an administrator.

Here is a proposal and example workflow which applies to my site:

(1) this module can optionally link roles to content types. For example, the role "location rep" will be linked to "loc rep application".
(2) I will put any number of CCK fields in the "loc rep application" content type.
(3) Upon registration or when requesting a new role, if the requested role is linked to a content type, the user will be prompted to create a new node of that type. (note that requesting a new role is the only way to create these nodes -- attempting to go to node/add/loc_rep_application should not be allowed by the module and will either redirect to the role application page if the user is not a loc rep, or redirect to the user/register page if the user is anonymous; or, for loc reps, display a message saying that you are already a member of this role and can't apply again).
(4) On the pending role applications page, a link will be provided to the node thus created for admins review if such a node exists.

Further, it would be nice also to provide a way to automatically fill in some content_profile or profile fields from node cck fields upon role approval. Perhaps the trigger-action might be used for this.

Anyway, your comments are appreciated. If anyone prefers webform integration, please explain how you would see it.

Cheers,

Albert.

kunago’s picture

Wouldn't a simple textarea field type be sufficient? Then there would be no need to dependency on other modules.

alberto56’s picture

@kunago -- if we use integration with nodes and cck, it has the added advantage of being available to views. Is that really a must though? I thought it might be interesting for my use case.

fehin’s picture

Version: » 6.x-1.9

HI alberto56 did you make any progress with this? I'm looking for a similar feature. I need the users to attach a description and multiple images to their application and populate their profile with the description field if approved.

alberto56’s picture

@fehin hi, I did not find any solution suitable to my needs. I ended up not using apply for role and rather using a custom module which defines a Drupal action that goes through all the steps I need.

bkosborne’s picture

FileSize
34.16 KB

like careernerd said, role applications are not nodes, and should not be treated as such.

I've just about completed a module that bridges apply_for_role and webform 3.x.

I've attached a screenshot of how it looks in the admin interface (on the bottom of the settings page for apply_for_role). You can associate any webform with any role. So basically a user can submit a webform, but also apply for the role with the submission of the form.

It prevents the webform from being submit if the user has already applied for the role or already has the role assigned to them.

I think it's relevant to ask people if they'd like more features added?

BenK’s picture

@bkosborne: Your module sounds cool. I'd love to see one another feature: The ability to apply for ownership/authorship of a referenced node in the webform. There would be a node reference field to specify which node ownership was being applied for. The use case would be a site like yelp or citysearch in which you want a user to be able to "claim" a node as their own (since they are the official representative of that node).

Thoughts?

--Ben

codare’s picture

YAAAY!! @bkosborne - this is exactly pretty much what I have just spent a couple of days looking for (I think). We're putting together a site for teachers and we need them to provide info so we can verify them as teachers. This looks like it would be ideal - allowing us to gather their school contact info, etc. when they apply for a role as Teacher.

My enthusiasm and anticipation is unbearable... hopefully it is released soooooon (or where do we get it??)

PS- Is there any way of having the option to implement it into the "Create new account" section?? (This would be the cherry on the icing for me...)

:-)
Codare

bkosborne’s picture

Codare - I got pulled from the project for stuff I had to do at my job. I have the system working fine on one of my sites - it's just not completely 'modular'. Please message me for details

ezeedub’s picture

I'm also looking for a solution that allows passing form data with the role request. It seems to me that's a pretty reasonable feature for the "apply for role" module to provide. bkosborne, you're solution looks like a step in the right direction. Could you post your code so we can look at rolling it into this module?

I'm also interested in the related issue (mentioned above) of forwarding the role-request data (if approved) to a Content Profile content type. There is discussion about how to make that module role aware which relies on another module (Auto Assign Role), but from what I can tell a fully integrated solution is not yet completed. It looks like the solution so far attempts to capture the user's intention at the moment of registration (using path to decide which content type to use), but does not address the situation when existing users request a new role.

If I understand correctly, there is demand for existing users to be able to

  1. apply for a new role
  2. provide justification for the change
  3. provide new profile content appropriate to the new role

I think relying on webform isn't a bad idea if it solves both #2 and #3. Solving #3 isn't part of this module, but there should probably be some talk between the various module developers (AFR, CP and AAR) to figure out what is the right way forward.

stieglitz’s picture

I too would like this feature. I get alot of spam despite having captcha enabled.

bkosborne’s picture

I'll put posting a patch for this support within a few days.

scottsawyer’s picture

@bkosborne, this sounds exactly like what everyone is looking for. A module would be great, and greatly appreciated. Please post back when you have something. Thanks.

bkosborne’s picture

@scottsawyer

I'm first working on a patch for views support for the module. First time I'm adding views support to a module so may be a couple days.

After views support is added, I'll add the webform bridge module project page.

Mitnick’s picture

@bkosborne: Any development of the solution you suggested at #21? I too is looking for this feature. Many thanks and more power to you!

bkosborne’s picture

Waiting for Soren to update the module with a unique identifier in the database schema.... He said he won't be able to get to it this week. After he updates it, I can push the module thru immediately.

Soren Jones’s picture

A non-composite primary key has already been added in 7. If anyone wants to submit a patch for 6, please do. The key should be called "aid". Thanks.

bkosborne’s picture

I'll submit it. Never patched for a DB change... Just change the db schema and write an update hook?

Soren Jones’s picture

Yes. Thank you. ^^

bkosborne’s picture

FileSize
1.63 KB

Here you go... I was trying to figure out how to add a field so that it appears in the first column; not sure how to do that, if it's even possible.

edit: requires running update.php if apply_for_role is already installed

Mitnick’s picture

Pardon me but may I know which module is this patch for? Thanks.

bkosborne’s picture

Apply for role, it adds a new DB field. does not change any functionality

bkosborne’s picture

Modules done... could use some testing.
You need to apply the above patch before using it.

http://drupal.org/project/apply_for_role_webform

You will have to wait for the dev release to roll out, or just download from CVS.

Soren Jones’s picture

Have you tested the patch in #32 with a populated database?

I was trying to figure out how to add a field so that it appears in the first column

You can see how I've done that in 7. Not sure that it's the best way. And 6 will be a little different. You might try IRC.

Also:

\ No newline at end of file
bkosborne’s picture

Hey Soren,

I tested it against a "users_roles_apply" table with 4 or 5 entries. Are you concerned about length it would take to add the field against a table with hundreds/thousands of entries?

wxman’s picture

I'm trying this all out, because it was exactly what I needed to fix a problem.
If I have a question about the new module, do you want it here or over at http://drupal.org/project/apply_for_role_webform?

It seems to working on my test site except the sender has an error message:

User warning: Unknown column "aid" in "field list" query: SELECT MAX(aid) as maxid FROM users_roles_apply in _db_query() (line 149 of /var/www/vhosts/tlt.com/httpdocs/includes/database.mysql.inc).

Also the "results of this submission may be viewed at" link in the email goes nowhere. Otherwise this is going to work great. Thanks for all the hard work. If I can help, I will.

bkosborne’s picture

Hi wxman, you must first apply the patch above to apply_for_role. Please do this on a copy of the site, or after backing up your database. It has not been tested extensively yet.

wxman’s picture

The site is going to be our live site once I take it out of maintenance mode. I tried it first on my laptop, but for some reason the whole site died with it. I backed everything up first for the online site, then installed it all.
Like I said, it worked ok, except for the db error. Here's the output of the tables:

mysql> show columns from users_roles_apply;
+--------------+---------------------+------+-----+---------+-------+
| Field        | Type                | Null | Key | Default | Extra |
+--------------+---------------------+------+-----+---------+-------+
| uid          | int(11)             | NO   | PRI | 0       |       |
| rid          | int(11)             | NO   | PRI | 0       |       |
| approved     | tinyint(3) unsigned | NO   |     | 0       |       |
| apply_date   | int(11)             | NO   |     | 0       |       |
| approve_date | int(11)             | NO   |     | 0       |       |
+--------------+---------------------+------+-----+---------+-------+
5 rows in set (0.01 sec)


mysql> show columns from users_roles_apply_webforms;
+-------+---------+------+-----+---------+-------+
| Field | Type    | Null | Key | Default | Extra |
+-------+---------+------+-----+---------+-------+
| aid   | int(11) | NO   | PRI | 0       |       |
| wid   | int(11) | NO   |     | 0       |       |
| sid   | int(11) | NO   | PRI | 0       |       |
+-------+---------+------+-----+---------+-------+
3 rows in set (0.01 sec)

I don't know if it helps, but here's apply_for_role.install after the patch:

<?php
// $Id: apply_for_role.install,v 1.6 2008/03/30 06:42:55 sorenjones Exp $

/**
 * Implementation of hook_install().
 */
function apply_for_role_install() {
  // Create tables.
  drupal_install_schema('apply_for_role');
}

/**
 * Implementation of hook_schema().
 */
function apply_for_role_schema() {
  $schema['users_roles_apply'] = array(
    'fields' => array(
      'aid' => array(
        'type' => 'serial',
        'description' => 'Primary Key: Unique role application ID',
        'not null' => TRUE,
        'unsigned' => TRUE,
      ),
      'uid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'rid' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'approved' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'size' => 'tiny',
      ),
      'apply_date' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'approve_date' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
//    'primary key' => array('uid', 'rid'),
    'primary key' => array('aid'),
  );

  return $schema;
}

/**
 * Implementation of hook_uninstall().
 */
function apply_for_role_uninstall() {
  //Remove tables
  drupal_uninstall_schema('apply_for_role');
  //Remove variables
  variable_del('users_apply_roles');
  variable_del('apply_for_role_multiple');
  variable_del('apply_for_role_register');
}

/**
 * Implementation of hook_update_N
 **/
function apply_for_role_update_6100() {
  $ret = array();
  
  $field_aid = array(
    'type' => 'serial',
    'description' => 'Primary Key: Unique role application ID',
    'not null' => TRUE,
    'unsigned' => TRUE,
  );
  $newkey = array(
    'primary key' => array('aid'),
  );
  
  db_drop_primary_key($ret, 'users_roles_apply');
  
  db_add_field($ret,'users_roles_apply','aid',$field_aid,$newkey);
  
  return $ret;
}
bkosborne’s picture

did you run update.php? I realize now that I never mentioned it needed to be run. The patch adds an update hook that needs to modify the user_roles_apply table to add the 'aid' field. Try that and LMK

wxman’s picture

That did it! Well sort of. It submitted the form, sent the email (link works now), and through the admin I was able to approve it. That's where I noticed my goof.

I don't know if others will be needing this, but I need it to remove the user from one role, then if approved, switch to the one applied for once approved. My example I'm using is switching a reader to a writer. Once the request was approved, I checked, and the user was now both roles. I guess I could see if something could be done using Rules or Actions. I might be just too tired tonight to see the obvious though.

bkosborne’s picture

I think apply_for_role does support rules/actions, so you may be able to do this. But yes, by default it will simply add the role and not replace an existing one.

wxman’s picture

I can work that out later for my case. Do you think it's going to be a problem having the tab in the user's profile? I don't think there is a way to shut the tab off, except for the Tab Tamer module. What I have in mind for us is adding another panel page to the user profile called Apply for Role, then make a page node with the instruction, and the links the the apply for role forms.

bkosborne’s picture

I'm glad you brought that up actually. I had meant to submit a patch that allows you to turn off that tab, but never got around to it. It's very easy to do, just look for the menu hook and remove that item.

wxman’s picture

That's exactly what I did.

bkosborne’s picture

Any status on getting this patch into 6.x?

Soren Jones’s picture

'aid' is being appended to the end of the table. It should be the first column after the update. Thank you.

westie’s picture

I think the webform module by bkosborne is a great as an optional extra. Providing the in-depth functionality of webforms is going to suit a lot of use cases.

However, Apply for Role without a doubt still needs a simple text area field "justification" for applying to a role.

bkosborne’s picture

Wow completely forgot about this. I'll try and re-roll this patch so 'aid' appears as the first column in the table.

bkosborne’s picture

I rerolled this patch w/ Git against the dev version.

I'm working on a way to get AID as the first column. I think I'll have to ditch the drupal db function and do a manual query.

bkosborne’s picture

FileSize
1.39 KB
dorys’s picture

I'm using apply for role 6x-1.9, Webform and apply for role-webform. does this patch still apply?

I'm asking because I have an issue where my webform is requiring the anonymous user to be logged in to submit the form with "apply for role" enabled which negates the whole purpose of this form on my site.

jnicola’s picture

Version: 6.x-1.9 » 7.x-2.x-dev
Issue summary: View changes
Status: Active » Closed (fixed)

Fixed in 7.x-2.x branch, won't be supporting 6.x branch any further.