Is there a module that would allow us to request an optional predefined pass-phrase/password at user registration?

So if the user fills in the pass-phrase he would be registered as a premium user or something, if not he would be set as a simple authenticated user.

By the way, I'm using Drupal 7.

  • I'm currently using Auto Assign Role and different registration paths which is similar. – lephleg Feb 2 '16 at 10:44
  1. Download Rules module

  2. Enable Rules and Rules UI

  3. In user fields, add a new text field. Name it ex: Catch Phrase (check mark the show on user registration)

  4. Add a new rule

    • React on (under user) After saving a new user account

    • Add Condition: Data comparison >> account:field-catch-phrase >> [enter catch phrase]

    • Add Action: (under user) Add user Role >> premium role

  5. (optional) Download and enable Field Permission. With this you can hide the catch phrase field so it doesn't show up when they edit their user account.

  • Looks great! I will try it soon and I'll come back with any comments. – lephleg Feb 2 '16 at 11:35
  • Oeps ....! Looks like "Rules" is the way to go, right? Now what, should I delete my "simultaeniously written answer"? – Pierre.Vriens Feb 2 '16 at 11:50
  • @Pierre.Vriens Sorry, I did say I was taking a pass on this (I deleted comment), but then I couldn't go to bed knowning that Kiamlaluno could close or even delete this Q. If you want to leave your answer, that's fine with me. – No Sssweat Feb 2 '16 at 12:00
  • 1
    Ehm.. sorry Pierre. I can't grant you both the answer. I was looking for a quick solution so the acceptance was almost instant. No Sssweat replied slightly first. :( You can have my up-vote of course if this could make up for it.. – lephleg Feb 2 '16 at 12:32
  • 1
    @Pierre.Vriens I don't think deleting an answer would be a proper reaction in ANY case. This question is gonna stay here for others to see, so maybe your approach fit them better or make the solution more clear to them. Please feel free to edit or enhance it, my upvote is permanent for your contribution. Thank you both! – lephleg Feb 2 '16 at 12:43

Use the Rules module to implement such feature, as further detailed below.

Step 1: Add a field to the registration form, which wil be used to have a user enter your passphrase. Even though you can use any "machine name" for that field, let's assume you call it "field_optionlist"

Step 2: Use a variation of the Rule included in my answer to "How to specify a Rules condition related to select list values?". Here is what you should tune in that rule:

  • Replace the Rules event to something like "After a new user submits a registration request"
  • Replace the "Value C" in the Rules condition to the value of your passphrase
  • For debugging reasons, start with a Drupal message to be shown (imilar to the rule mentioned above. After the message shows up as you want it to show, replace the Rules Action with something like "Assign role to user".

Not the answer you're looking for? Browse other questions tagged or ask your own question.