I'm working on a project that let any user (anonymous) register for an event. An event is a content type that has duration, name and price and possibly a date. So, when a user browse through different events, they can register for an event by simply clicking on the "Register for this Event" What needs to happen when they click on Register.. is: the info related to that event needs to pre populate to the member login form so that they don't have to fill the event info again.

The user must be a member before they can register for the event but I am trying to give a nice user experience to the user so that he/she can simply click on the Register link and then they will be redirected to the user login/sign up form the event info pre-loaded and they provide the rest of the info. I have already extended the standard Drupal login form to my need and also created the event content type. Thinking to use flag module to make Register link but have NO idea how to pre populate that event info into the login form. Any help or guide will be highly appreciated. Thanks in advance.

  • Perhaps you should use the webform module for this and create different forms for each event.
    – No Sssweat
    Sep 9, 2016 at 23:15
  • Thanks for the reply but how would webform be used for account sign up (as a site user). In other words, Im trying to combine the sign up form with event registration.
    – SamNeupa
    Sep 9, 2016 at 23:19
  • What about users that already have an account and want to register for another event? I assume, you don't want them to create a new user and pass again...
    – No Sssweat
    Sep 9, 2016 at 23:24
  • well, this site doesn't allow a standard user signup method like in a normal Drupal site. The only reason anybody comes to this site is to sign up for the event. And to sign up for an event, the event info is to be the part of account sign up and its a required filed. They can manually choose that event info but Im trying to give them an advantage of the fact they already selected an event.
    – SamNeupa
    Sep 9, 2016 at 23:30
  • Further more, they can only chose one event. They can change the event once they become user but in the begining they would only choose one event.
    – SamNeupa
    Sep 9, 2016 at 23:32

1 Answer 1


I have already extended the standard Drupal login form

Sounds like you're already using hook_form_alter(), so all you have to do is add the #default_value attribute to your form array.


$form['my_field_name'] = array(
    '#type' => 'textfield',
    '#title' => t('something'),
    '#default_value' => t('Hello World'),

OR Use the Profile2 module suggested by @Kevin

Profile2 allows for creating multiple profile types, which may be assigned to roles via permissions (e.g. a general profile + a customer profile)

  • To be honest, I haven't thought of using hook_form_alter(). I extended login form, I meant I have added extra field I need. I was looking for a point n click/ configuration type of solution. So, the question still exist if someone clicks on register how would we take the event info and pre load that into the login/sign up form.
    – SamNeupa
    Sep 9, 2016 at 23:46
  • If this is Drupal 7, that is more up Profile2's alley.
    – Kevin
    Sep 9, 2016 at 23:49
  • Hey Kevin, I'm making a heavy use of profile2 later once they sign up. But the prepopulate thing is where I am stuck right now. Thanks for the suggestion.
    – SamNeupa
    Sep 9, 2016 at 23:52
  • Only because you can create a Profile (lets say, Registration) and set that to appear on the user register form. Then when the user is authenticated later, signing up for events, the data is attached within the current user object. In a form_alter, you can load the profile2 entity for the current user. Event registration can take so many forms, its a real case by case scenario.
    – Kevin
    Sep 10, 2016 at 0:16
  • @SamNeupa go to Manage Fields and edit the field in question, you should see a default value box there.
    – No Sssweat
    Sep 10, 2016 at 0:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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