I have a website in which there are two types of user roles - mentor and mentee. Mentee can create a 'Request' node in which userreference field is one of the mentors.
I want to provide a button on each mentor profile. When a mentee clicks this button, then a node/add/request page opens in which the userreference filed is pre-selected (it is the mentor from whose profile the button is clicked).
How is this possible?
Thanks in advance.
Comments
Comment #1
huangja commentedI actually edited nodereference.module to allow the passage of arguments through the url.
Look here:
http://drupal.org/node/473670
I know that it's nodereference and not userreference, but I'm working on userreference right now and that solution should be up soon.
You can get this working where you can create a link on the mentor's page to 'node/add/request/mentor_name', thereby populating the field with the mentor name.
However, this might better suit your needs: http://drupal.org/project/prepopulate
Comment #2
helloanshul commentedthanks for your response :)
i am eager to see the userreference solution.
Comment #3
huangja commentedI posted the userreference solution in a patch:
http://drupal.org/node/473670#comment-1638842
I haven't tested it yet, so I can't guarantee it'll work, but you can give it a try.
Comment #4
comfort_drupal commented@helloanshul, i am looking for the same feature, can you please provide me the URL of site, so i can get the better visibility.
Comment #5
markus_petrux commentedExtending the user profile is not CCK issue per-se. You can use Drupal core APIs to do it. For example:
http://api.drupal.org/api/function/hook_user/6
Once you know how to modify the user profile, then you can build a link that uses Prepopulate module syntax to add the proper arguments, and that should do the trick.
http://drupal.org/project/prepopulate