Formidable Registration

Knowledge BaseExtend Formidable ProAdd Ons → Formidable Registration

Use a Formidable form to efficiently register users for your site and edit profiles. This add-on allows you to easily reference user meta and atuo-populate forms with their information.

Download and Set Up

  1. Download latest version at http://formidablepro.com/formidable-add-on-downloads/
    Note: Versions 1.0rc4+ require Formidable v1.6+
  2. In your WordPress admin, go to “Plugins” → “Add New” and click the “Upload” link at the top of the page.
  3. Click the “Browse” button and select the registration zip file you just downloaded.
  4. Click the “Activate” link which should appear after the add-on is installed, or go the the “Plugins” page, find “Formidable Registration” and click “Activate”.
  5. Go into the form that you would like to use for user registration or editing profiles.
  6. Click on “Settings” → “Registration” and set up your options.

  7. Don’t forget to hit “Update” so these settings will be saved.

Add a Login Form

You may easily add a login form to any page or widget.

In a Widget

The easiest way to add a login form is to use the “Login Form” widget.

  1. In your WordPress Admin, go to “Appearance” → “Widgets”.
  2. Drag the “Login Form” widget into the sidebar.
  3. Open up this widget and you can choose the title, labels, styling, and other settings.

If you don’t want this to display on all pages, install our Display Widgets plugin for additional settings.

On a Page

If you would like to add a simple login form to a page, add the following shortcode to your page.

[frm-login]

Parameters

  • remember – Show the checkbox to remember your users. Defaults to show it. Hide with remember=0
  • label_username – Change the label of the username box. label_username=”Username”
  • label_password – Change the label of the password field. label_password=”Password”
  • label_remember – Change the label on the remember me checkbox. label_remember=”Remember Me”
  • label_log_in – Change the label of the login button. label_log_in=”Login”
  • slide – Set your form to be hidden and require a click to show it. slide=1
  • style – Use Formidable styling on your form. Disable styling with style=0
  • layout – Show the fields either horizontally or vertically. layout=h or layout=v
  • value_username – Insert a default value into the username field. value_username=”Username”
  • value_remember – Check the remember me checkbox be default. value_remember=1

Customize the HTML ids:
form_id
id_username
id_password
id_remember
id_submit

Autopopulate Forms

Now that you have the Registration Add-on installed, you can easily autopopulate other forms with any information your users provide in the registration form.

  1. First, go into your registration form. Click on “Settings” → “Registration”.
  2. In the “User Meta” section, add a line for each field you would like to use to autopopulate other forms.

  3. Go into a form which you would like to autopopulate with user information. Add [user_meta key=whatever] to the field (if it is a text field) or in the field options in the Dynamic Default Value box (if it is not a text field). Replace whatever with the meta name that you gave this item in step 2 as shown below.

  4. Note: These fields will not autopopulate for users that existed before these settings were added.

Change Password Form

  1. Create a new form (make sure the registration add-on is active)
  2. Add two fields to this form. An email field and a “New Password” field (Password field type).
  3. Add the [email] dynamic default value to your email field. Also, set this field to “read only” or set the “Permissions” to “Administrator” to prevent users from changing the email address. Both these settings are found in the field options.
  4. Save your form. On the form settings page, Check these boxes: “Allow logged in users to edit previous responses.” and “Allow only one entry for each logged-in user”.
    You can find more information on allowing users to edit forms here.
  5. On the “Registration” settings tab for this form, set the email and password options to the appropriate fields created in step 1. You will probably also want to modify the email messages, but the other settings can be ignored.
  6. Note: this type of form does not work for administrators or other user roles that have been customized to allow user creation.

Read more about adding custom code.

Add this code to a new plugin or your theme functions.php. The only line that needs to be changed is line #3 ($user_meta_name = “frm_avatar”) unless you set “frm_avatar” as the user meta name for the file upload field in your “Settings” → “Registration”.

add_filter( 'get_avatar', 'get_frm_avatar', 10, 5 );
function get_frm_avatar( $avatar = '', $id_or_email, $size = '96', $default = '', $alt = false ){
  $user_meta_name = 'frm_avatar'; //change frm_avatar to whatever user meta name you have given the upload field in your registration settings
  if ( is_numeric($id_or_email) ){
    $user_id = (int) $id_or_email;
  }elseif ( is_string($id_or_email) ){
    if ( $user = get_user_by_email( $id_or_email ) )
      $user_id = $user->ID;	
  }elseif ( is_object($id_or_email) && !empty($id_or_email->user_id) ){
      $user_id = (int) $id_or_email->user_id;
  }
		
  if ( isset($user_id) ){
    $avatar_id = get_user_meta( $user_id, $user_meta_name, true );
    if($size < 150)
      $temp_size = 'thumbnail';
    else if($size < 250)
      $temp_size = 'medium';
    else
      $temp_size = 'full';
    $local_avatars = FrmProFieldsHelper::get_media_from_id($avatar_id, $temp_size);
  }
		
  if ( !isset($local_avatars) || empty($local_avatars) ){
    if ( !empty($avatar) )  // if called by filter
      return $avatar;
			
    remove_filter( 'get_avatar', 'get_frm_avatar' );
    $avatar = get_avatar( $id_or_email, $size, $default );
    add_filter( 'get_avatar', 'get_frm_avatar', 10, 5 );
    return $avatar;
  }
		
  if ( !is_numeric($size) ) // ensure valid size
    $size = '96';
			
  if ( empty($alt) )
    $alt = get_the_author_meta( 'display_name', $user_id );
		
  $author_class = is_author( $user_id ) ? ' current-author' : '' ;
  $avatar = "<img alt='" . esc_attr($alt) . "' src='" . $local_avatars . "' class='avatar avatar-{$size}{$author_class} photo' height='{$size}' width='{$size}' />";
		
  return $avatar;
}

Stop the registration email

add_filter('frm_send_new_user_notification', 'frm_stop_user_notification');
function frm_stop_user_notification($send){
  return false;
}

Set the user role

Sometimes the user role may be different for different options chosen in your form. Here’s an example of setting the role depending on what role is chosen in the form.

add_filter('frmreg_new_role', 'frmreg_new_role', 10, 2);
function frmreg_new_role($role, $atts){
  extract($atts);
  if($form->id == 5){
    if($_POST['item_meta'][125] == 'Author') //change 125 to the ID of your field and 'Author' to the value of your radio button
      $role = 'author';
  }
  return $role;
}

User Examples

http://demo.formidablepro.com/directory/register/