create custom login forms

Discussion in 'aMember Pro v.4' started by steveclarke, Jan 6, 2013.

  1. steveclarke

    steveclarke New Member

    Joined:
    Nov 27, 2012
    Messages:
    17
    hi,

    i've created and customised my own login form as per the documentation. however, the code for the _login.phtml has two <form>'s one visible and one hidden.

    as i'm using the twitter bootstrap modals plugin and framework this does not seem to work.

    what i'd like to be able to do is:
    1. create custom _forgot_passw.phtml
    2. link the button for 'lost password' to my custom _forgot_passw.phtml

    i've created it, but i don't know how to directly link to that newly created file using href="/...where is this file located or how to link to it?"

    linking to say, login, is easy.. href="/login/index"
    can i create (and how) easy links like the login link??

    cheers
    steve
  2. steveclarke

    steveclarke New Member

    Joined:
    Nov 27, 2012
    Messages:
    17
    found it... here --> http://www.amember.com/docs/API/Form

    also, i've attached my code as an example to anyone that is interested!

    PHP:
    <?php
    class ForgotController extends Am_Controller
    {
        function 
    indexAction()
        {
            
    $form = new Am_Form?>
           
                <div id="content" class=" txt-middle">
          <div class="container">
            <div class="row">
            <div class="span12">
              <div class="modal modal-flat">
                <div class="modal-header">
                  <h3>Forgot Password?</h3>
                </div>
               
                <form method="post" action="<?php echo REL_ROOT_URL ?>/sendpass/send">
               
                <div class="modal-body">
                  <fieldset>
                    <div class="control-group">
                      <div class="controls">
                        <div class="input-prepend">
                          <span class="add-on"><i class="icon-user"></i></span>
                          <input type="text" placeholder="Enter your E-Mail or Username" id="login" name="login" class="span5">
                         
                        </div>
                      </div>
                                 
                    </div>   
                  </fieldset>
                </div>
                <div class="modal-footer">
                  <a href="/login/index" class="btn btn-warning pull-left">Log in</a>
                  <button type="submit" class="btn btn-primary"><?php __e('Get Password'?></button>
                </div>
               
                <!-- hidden variables -->
                <?php echo Am_Controller::renderArrayAsInputHiddens($hidden?>
                <!-- end of hidden -->
               
                </form>
                   
              </div>
            </div> 
            </div>     
          </div>
        </div> <?php
     
            
    if ($form->isSubmitted() && $form->validate())
            {
                
    // form ok - do some actions here!
                
    $this->view->content print_r($form->getValue(), true);
            } else {
                
    // not submitted or validation fails
                
    $this->view->content = (string)$form;
            }
            
    $this->view->title "Forgot";
            
    $this->view->display('layout.phtml');
        }
    }
     
    ?>
  3. gogoseo

    gogoseo Member

    Joined:
    Nov 17, 2012
    Messages:
    36
    Hey steve,

    where did you find the documentation for creating a custom login form?
    I just need to create a simple login form that i will insert into a popup.
    Can i just use simple HTML or is this more complicated?
  4. steveclarke

    steveclarke New Member

    Joined:
    Nov 27, 2012
    Messages:
    17
    hi mate..

    documentation for custom login forms are here --> http://www.amember.com/docs/Custom_Signup_Forms

    depending on your html, i believe you can create your login form how you wish. but if you want a popup, or modal using jquery i am unsure as i've never tested it... but i think in theory it's possible.

    feel free to ask any questions and or post back here (or via PM) your code, i'd be more than happy to look and help!
  5. gogoseo

    gogoseo Member

    Joined:
    Nov 17, 2012
    Messages:
    36
    Hmm... the link is for "signup" forms...am i missing something?
    ..however i found an older post where custom "login" forms are mentioned:
    http://www.amember.com/forum/threads/integrated-login-form.13913/

    ...i used that as a starting point and until now everything is working...my only concern
    is if maybe login forms require some generated hidden input field to work after some time...
  6. steveclarke

    steveclarke New Member

    Joined:
    Nov 27, 2012
    Messages:
    17
    my apologies.. you were right. definitely the wrong page! my haste gave the wrong link...

    that link you provided gives a good example of a custom login form... just be sure that you include the needed code from the original code provided in login.phtml

Share This Page