Title: Multiple custom login forms
Last modified: August 16, 2023

---

# Multiple custom login forms

 *  Resolved [redwiper](https://wordpress.org/support/users/redwiper/)
 * (@redwiper)
 * [2 years, 7 months ago](https://wordpress.org/support/topic/multiple-custom-login-forms/)
 * Hi there. I have two login forms for two roles(members , case study) and to links
   for login and registration in navbar. Why user with role for example member can
   login with link(page) in navigation for case study and vise versa? It should 
   be that user with login parameters and role for example member can access just
   in one login link-form for that role and vise versa.

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Support [andrewshu](https://wordpress.org/support/users/andrewshu/)
 * (@andrewshu)
 * [2 years, 7 months ago](https://wordpress.org/support/topic/multiple-custom-login-forms/#post-16988970)
 * Hello [@redwiper](https://wordpress.org/support/users/redwiper/)
 * Users can login from any login forms. Sorry, but this is how it works now.
 * Regards.
 *  [missveronica](https://wordpress.org/support/users/missveronicatv/)
 * (@missveronicatv)
 * [2 years, 7 months ago](https://wordpress.org/support/topic/multiple-custom-login-forms/#post-16989180)
 * [@redwiper](https://wordpress.org/support/users/redwiper/)
 * You can replace the UM login shortcode with this shortcode:
 * `[select_login_form member_form_id="385" user_form_id="3687"]`
 * This code snippet will use one of the forms for login.
 * `member_form_id` if the URL has a member parameter like
    `https://domain.com/
   login/?member=true`
 * and the `user_form_id` in all other cases.
 *     ```
       add_shortcode( 'select_login_form', 'custom_select_login_form', 10, 2 );
   
       function custom_select_login_form( $attrs, $content ) {
   
           $login_form_id = false;
           if ( isset( $_REQUEST['member'] ) && isset( $attrs['member_form_id'] )) {
               $login_form_id = sanitize_text_field( $attrs['member_form_id'] );
           } else {
               if ( isset( $attrs['user_form_id'] )) {
                   $login_form_id = sanitize_text_field( $attrs['user_form_id'] );
               }
           }
   
           if ( ! empty( $login_form_id ) && is_numeric( $login_form_id )) {
               if ( version_compare( get_bloginfo( 'version' ), '5.4', '<' ) ) {
                   echo do_shortcode( '[ultimatemember form_id="' . $login_form_id . '"/]' );
               } else {
                   echo apply_shortcodes( '[ultimatemember form_id="' . $login_form_id . '"/]' );
               }
           }
       }
       ```
   
 * Install the code snippet into your active theme’s `functions.php` file
    or use
   the “Code Snippets” plugin.
 * [https://wordpress.org/plugins/code-snippets/](https://wordpress.org/plugins/code-snippets/)
 *  Plugin Support [andrewshu](https://wordpress.org/support/users/andrewshu/)
 * (@andrewshu)
 * [2 years, 7 months ago](https://wordpress.org/support/topic/multiple-custom-login-forms/#post-17005233)
 * Hi [@redwiper](https://wordpress.org/support/users/redwiper/)
 * This thread has been inactive for a while so we’re going to go ahead and mark
   it Resolved.
 * Please feel free to re-open this thread if any other questions come up and we’d
   be happy to help. 🙂
 * Regards

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Multiple custom login forms’ is closed to new replies.

 * ![](https://ps.w.org/ultimate-member/assets/icon-256x256.png?rev=3160947)
 * [Ultimate Member – User Profile, Registration, Login, Member Directory, Content Restriction & Membership Plugin](https://wordpress.org/plugins/ultimate-member/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ultimate-member/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ultimate-member/)
 * [Active Topics](https://wordpress.org/support/plugin/ultimate-member/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ultimate-member/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ultimate-member/reviews/)

 * 3 replies
 * 3 participants
 * Last reply from: [andrewshu](https://wordpress.org/support/users/andrewshu/)
 * Last activity: [2 years, 7 months ago](https://wordpress.org/support/topic/multiple-custom-login-forms/#post-17005233)
 * Status: resolved