We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

How to call username and password fields | Forum

Umair
Umair Apr 4 '15
I want to show login username and password fields on join form with forgot password, remember me and login/sign-in button. How I can do it?
Taissa Team
Taissa Apr 8 '15
Topic was moved from General Questions.
Nickolay
Nickolay Apr 10 '15

First look at \ow_system_plugins\base\views\controllers\join_index.html template file.


Simplest way, but not the best, is just to call BASE_CMP_SignIn component like this (in specific place you want sign-in form to appear):


<div id="static-sign-in-form">

            {component class='BASE_CMP_SignIn'}

</div>

<script type="text/javascript">

            jQuery('#static-sign-in-form').find('form').attr('action', '{url_for_route for="static_sign_in"}');

</script>


The right way, considering you want more control over the form will be to create additional Smarty function file \ow_smarty\plugin\function.signin_form.php containing:


<?php

 

function smarty_function_signin_form( $params, &$smarty )

{

    $form = BOL_UserService::getInstance()->getSignInForm('sign-in', true);

    $form->setAction(OW::getRouter()->urlForRoute('static_sign_in'));

 

    $vr = OW_ViewRenderer::getInstance();

 

    $assignedForms = $vr->getAssignedVar('_owForms_');

    $assignedForms[$params['name']] = $form;

 

    $vr->assignVar('_owForms_', $assignedForms);

}



And then insert actual form content into join_index.html and our new function call before:


{signin_form name='sign-in'}

{form name='sign-in'}

<div class="clearfix">

            <div class="ow_sign_in">

                        {block_decorator name='box' langLabel='base+base_sign_in_cap_label'}

 

                        <div class="ow_user_name">

                                   {input name='identity'}

                        </div>

                        <div class="ow_password">

                                   {input name='password'}

                        </div>

                        <div class="ow_form_options clearfix">

                                   <div class="ow_right">

                                               {submit name='submit' class='ow_positive'}

                                   </div>

                                   <p class="ow_remember_me">{input name='remember'}{label name='remember'}</p>

                                   <p class="ow_forgot_pass"><a href="{url_for_route for='base_forgot_password'}">{text key='base+forgot_password_label'}</a></p>

                        </div>

                        {/block_decorator}

            </div>

</div>

{/form}

Umair
Umair Apr 13 '15
The solution you provided worked perfectly. See the attached file for description of my need. Let me know if it is possible
Attachments:
  Picture3.png (1145Kb)
Nickolay
Nickolay Apr 17 '15
It's possible, you just have to be more specific when describing the topic. I've attached you an example plugin, just install it and style the form according to your needs.


Besides you'll probably want to edit \ow_system_plugins\base\classes\console_event_handler.php file and delete the following:


$cmp = new BASE_CMP_SignIn(true);

$signInMarkup = '<div style="display:none"><div id="base_cmp_floatbox_ajax_signin">' . $cmp->render() . '</div></div>';

 

$item = new BASE_CMP_ConsoleItem();

$item->setControl($signInMarkup . '<span class="ow_signin_label' . (empty($buttonList) ? '' : ' ow_signin_delimiter') . '">' . $language->text('base', 'sign_in_submit_label') . '</span>' . $iconListMarkup);

$event->addItem($item, 2);

 

OW::getDocument()->addOnloadScript("

               $('#".$item->getUniqId()."').click(function(){new OW_FloatBox({ \$contents: $('#base_cmp_floatbox_ajax_signin')});});

");


To remove the original login popup (or just hide it via css).

Attachments:
  cilogin.zip (8Kb)
Umair
Umair Apr 17 '15
thanks. I will try it and let you know. I am sorry for not being specific. I realized it later.
Umair
Umair Apr 18 '15
hey stranger thanks. I do not have development skills. Finally after fighting with the html file, I managed to get what i wanted. If you remember, previously you helped me with console avatar. You are great. Appreciate your help. See the attachment. I am sure you will be happy to see the result. I would not mind if you say "well done"
Attachments:
  join-mod.png (877Kb)