Revision 370 is a pre-publication revision. (Viewing current revision instead.)

Formidable Registration Goodies

  1. Download latest version at http://formidablepro.com/formidable-add-on-downloads/ Important: 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 zip file you just downloaded.
  4. Go the the “Plugins” page, find “Formidable Registration” and click “Activate”.
  5. Go to “Formidable” -> “Forms” and click “edit” for the form you would like to use for user registration or editing profiles.
  6. Go to “Registration Options” at the bottom of the page and set your options. Registration Options
  7. Click the “Update” button at the bottom of the page.

Add a login form

The easiest way to add a login form is to use the “Login Form” widget. If you don’t want this to display on all pages, install ourDisplay Widgets plugin for additional settings. If you would like to create a separate login page, you can add a shortcode to your page.

frm-login Shortcode

[frm-login]
Shortcode options: 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

Password change form

  • Set your form up with the registration add-on.
  • Include an email field selected as the user email in your form. Other than that, none of the fields are required. If you don’t want this field shown, add [admin_email] as the dynamic default value and check the “admin only” box.
  • To allow the user to change the password, check these boxes in the form settings: “Allow only one entry for each logged-in user” and “allow logged in users to edit previous responses.” You find find more on editing here.
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 unless you use “frm_avatar” as the user meta name in your registration settings: $user_meta_name = “frm_avatar”;
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 );
    $local_avatars = FrmProFieldsHelper::get_media_from_id($avatar_id, $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/  

Revisions

  • September 2, 2015 @ 14:25:52 [Current Revision] by PeterLugg
  • September 2, 2015 @ 14:25:52 by PeterLugg
  • February 22, 2013 @ 05:53:57 by PeterLugg

Revision Differences

February 22, 2013 @ 05:53:57Current Revision
Content
 Added: <ol>
 Added: <li>Download latest version at <a href="http:// formidablepro.com/ knowledgebase/ formidable-add- on-downloads/ ">http://formidablepro.com/ formidable-add- on-downloads/</a>
 Added: <strong>Important: </strong> Versions 1.0rc4+ require Formidable v1.6+</li>
 Added: <li>In your WordPress admin, go to “Plugins” -&gt; “Add New” and click the “Upload” link at the top of the page.</li>
 Added: <li>Click the “Browse” button and select the zip file you just downloaded.</li>
 Added: <li>Go the the “Plugins” page, find “Formidable Registration” and click “Activate”.</li>
 Added: <li>Go to “Formidable” -&gt; “Forms” and click “edit” for the form you would like to use for user registration or editing profiles.</li>
 Added: <li>Go to “Registration Options” at the bottom of the page and set your options. <img alt="Registration Options" src="http://wiki.pixelpress.com.au/ files/2013/02/ registration- options.png" /></li>
 Added: <li>Click the “Update” button at the bottom of the page.</li>
 Added: </ol>
 Added: <h2 id="kb-add-a- login-form">Add a login form</h2>
 Added: The easiest way to add a login form is to use the “Login Form” widget. If you don’t want this to display on all pages, install our<a href="http:// wordpress.org/ extend/plugins/ display-widgets/">Display Widgets</a> plugin for additional settings.
 Added: <img alt="" src="http://wiki.pixelpress.com.au/ files/2013/02/ login-widget.png" width="254" height="399" />
 Added: If you would like to create a separate login page, you can add a shortcode to your page.
 Added: <h4 id="kb-frm-login- shortcode">frm-login Shortcode</h4>
 Added: <pre>[frm-login]</pre>
 Added: Shortcode options:
 Added: <strong>remember< /strong> – Show the checkbox to remember your users. Defaults to show it. Hide with remember=0
 Added: <strong>label_ username</strong> – Change the label of the username box. label_username= ”Username”
 Added: <strong>label_ password</strong> – Change the label of the password field. label_password= ”Password”
 Added: <strong>label_ remember</strong> – Change the label on the remember me checkbox. label_remember=”Remember Me”
 Added: <strong>label_ log_in</strong> – Change the label of the login button. label_log_in=”Login”
 Added: <strong>slide< /strong> – Set your form to be hidden and require a click to show it. slide=1
 Added: <strong>style< /strong> – Use Formidable styling on your form. Disable styling with style=0
 Added: <strong>layout< /strong> – Show the fields either horizontally or vertically. layout=h or layout=v
 Added: <strong>value_ username</strong> – Insert a default value into the username field. value_username= ”Username”
 Added: <strong>value_ remember</strong> – Check the remember me checkbox be default. value_remember=1
 Added: Customize the HTML ids:
 Added: <strong>form_id</strong>
 Added: <strong>id_username</strong>
 Added: <strong>id_password</strong>
 Added: <strong>id_remember</strong>
 Added: <strong>id_submit</strong>
 Added: <h2 id="kb-password- change-form">Password change form</h2>
 Added: <ul>
 Added: <li>Set your form up with the registration add-on.</li>
 Added: <li>Include an email field selected as the user email in your form. Other than that, none of the fields are required. If you don’t want this field shown, add [admin_email] as the dynamic default value and check the “admin only” box.</li>
 Added: <li>To allow the user to change the password, check these boxes in the form settings: “Allow only one entry for each logged-in user” and “allow logged in users to edit previous responses.”
 Added: You find find more on editing <a href="http:// formidablepro.com/ knowledgebase/ allow-users-to- edit-previous- entries/">here</a>.</li>
 Added: </ul>
 Added: <a href="http:// formidablepro.com/ knowledgebase- category/advanced- for-developers/">Read more</a> about adding custom code.
 Added: <h4 id="kb-link-an- upload-field- to-user-avatars">Link an upload field to user avatars</h4>
 Added: Add this code to a new plugin or your theme functions.php. The only line that needs to be changed is line #3 unless you use “frm_avatar” as the user meta name in your registration settings: $user_meta_name = “frm_avatar”;
 Added: <pre>add_filter( 'get_avatar', 'get_frm_avatar', 10, 5 );
 Added: function get_frm_avatar( $avatar = '', $id_or_email, $size = '96', $default = '', $alt = false ){
 Added: $user_meta_name = 'frm_avatar'; //change frm_avatar to whatever user meta name you have given the upload field in your registration settings
 Added: if ( is_numeric($id_or_email) ){
 Added: $user_id = (int) $id_or_email;
 Added: }elseif ( is_string($id_or_email) ){
 Added: if ( $user = get_user_by_email( $id_or_email ) )
 Added: $user_id = $user-&gt;ID;
 Added: }elseif ( is_object($id_or_email) &amp;&amp; !empty($id_or_ email-&gt;user_id) ){
 Added: $user_id = (int) $id_or_email- &gt;user_id;
 Added: }
 Added: if ( isset($user_id) ){
 Added: $avatar_id = get_user_meta( $user_id, $user_meta_name, true );
 Added: $local_avatars = FrmProFieldsHelper: :get_media_from_ id($avatar_id, $size);
 Added: }
 Added: if ( !isset($local_avatars) || empty($local_avatars) ){
 Added: if ( !empty($avatar) ) // if called by filter
 Added: return $avatar;
 Added: remove_filter( 'get_avatar', 'get_frm_avatar' );
 Added: $avatar = get_avatar( $id_or_email, $size, $default );
 Added: add_filter( 'get_avatar', 'get_frm_avatar', 10, 5 );
 Added: return $avatar;
 Added: }
 Added: if ( !is_numeric($size) ) // ensure valid size
 Added: $size = '96';
 Added: if ( empty($alt) )
 Added: $alt = get_the_author_meta( 'display_name', $user_id );
 Added: $author_class = is_author( $user_id ) ? ' current-author' : '' ;
 Added: $avatar = "&lt;img alt='" . esc_attr($alt) . "' src='" . $local_avatars . "' class='avatar avatar-{$size}{$author_class} photo' height='{$size}' width='{$size}' /&gt;";
 Added: return $avatar;
 Added: }</pre>
 Added: <h4 id="kb-stop-the- registration-email">Stop the registration email</h4>
 Added: <pre>add_filter( 'frm_send_new_ user_notification', 'frm_stop_user_ notification');
 Added: function frm_stop_user_ notification($send){
 Added: return false;
 Added: }</pre>
 Added: <h4 id="kb-set-the- user-role">Set the user role</h4>
 Added: 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.
 Added: <pre>add_filter( 'frmreg_new_role', 'frmreg_new_role', 10, 2);
 Added: function frmreg_new_role($role, $atts){
 Added: extract($atts);
 Added: if($form-&gt;id == 5){
 Added: if($_POST['item_meta'][125] == 'Author') //change 125 to the ID of your field and 'Author' to the value of your radio button
 Added: $role = 'author';
Deleted: Added: }
 Added: return $role;
 Added: }</pre>
 Added: <h3 id="kb-user-examples">User Examples</h3>
 Added: <a href="http:// demo.formidablepro.com/ directory/register/" rel="nofollow" >http://demo.formidablepro.com/ directory/register/</a>
 Added: &nbsp;

Note: Spaces may be added to comparison text to allow better line wrapping.

Tags: , , ,

No comments yet.

Leave a Reply