Support Forum

sp_render_inline_login_form() Mod request?

LH Lee H
Lee H
Member

Not huge. I thought I’d restyle the input fields of the login form because it’s been messing with me that they aren’t aligned (yeah silly detail). I found it wasn’t so easily done because the first two input fields are within the label tag, and the “Remember me” checkbox (or dot) was outside the label tag.

I rearranged a test function to get the input fields out of the label tags and it’s now possible to achieve what I’m after. And as far as I can “see” there is no change in how it appears in the default template with it’s current styling.

Is it possible to consider changing the form to the following? If there’s a reason I’ve overlooked, please disregard my request 🙂

The only changes are within the three span tags midway down.

function sp_render_inline_login_form($a) { 
    global $sfglobals; 
 
    extract($a, EXTR_SKIP); 
 
    $user_login = ''; 
    $user_pass = ''; 
    $using_cookie = false; 
    $sflogin = sp_get_option('sflogin'); 
    $redirect_to = $_SERVER['REQUEST_URI']; 
    do_action('login_head', 'sploginform'); 
 
    $message = ''; 
    $message = apply_filters('sf_filter_login_message', $message); 
    if (!empty($message)) $out.= $message."n"; 
 
    $out = ''; 
       $out.= "<fieldset class='$controlFieldset'>n"; 
    $out.= "<form name='loginform' id='loginform' action='".site_url('wp-login.php', 'login_post')."' method='post'>n"; 
 
    $sfrpx = sp_get_option('sfrpx'); 
    if ($sfrpx['sfrpxenable']) $out.= sp_rpx_loginform('spLoginForm', '100%', true); 
 
    $out.= "<span><label for='log'>$labelUserName: </label><input type='text' class='$controlInput' tabindex='84' name='log' id='log' value='".esc_attr($user_login)."' size='11' /></span><br />n"; 
    $out.= "<span><label for='login_password'>$labelPassword: </label><input type='password' class='$controlInput' tabindex='85' name='pwd' id='login_password' value='' size='11' /></span><br />n"; 
    $out.= "<span><label for='rememberme'> $labelRemember</label><input type='checkbox' tabindex='86' id='rememberme' name='rememberme' value='forever' /></span>n"; 
 
    $out.= sp_InsertBreak('echo=0'); 
    $out.= do_action('login_form'); 
    $out.= sp_InsertBreak('echo=0'); 
 
    $out.= "<img class='$controlIcon' src='".SPTHEMEICONS."$iconName' alt=''/>n"; 
    $out.= "<input type='submit' class='$controlSubmit' name='submit' id='submit' value='$labelSubmit' tabindex='87' />n"; 
    $out.= "<input type='hidden' name='redirect_to' value='".esc_attr($redirect_to)."' /><br /><br />n"; 
 
    $out.= "</form>n"; 
 
    if (TRUE == get_option('users_can_register') && !$sfglobals['lockdown'] && $sflogin['sfshowreg'] && $showRegister) { 
        $out.= "<a class='$controlLink' href='".site_url('wp-login.php?action=register', 'login')."'>$labelRegister</a>n"; 
        $out.= ' | '; 
    } 
    if ($showLostPass) { 
        $out.= "<a class='$controlLink' href='".site_url('wp-login.php?action=lostpassword', 'login')."'>$labelLostPass</a>n"; 
    } 
 
       $out.= "</fieldset>n"; 
    return $out; 
} 

7 Answers

New Answer

YS Yellow Swordfish
Yellow Swordfish
Member

So basically you just shunted the closing label tags around. Yes? Is that valid?

LH Lee H
Lee H
Member

It appears valid. I did check it out last night and all examples I saw had the label tag seperate. Didn’t think to check the html 5 spec until just now. It seems to be valid both ways, although it seems you could get away with a bit less markup with the input inside the label.

http://www.w3.org/wiki/HTML/Elements/label

LH Lee H
Lee H
Member

Just for giggles I copied the markup for Simple:Press (this site), edited the login form as suggested above and ran it through the w3 validator and the form code was valid for the xhtml transitional, and html 5 doctypes.

FYI: Not saying the rest of the code validated, lot’s of hits on “&” and “=” in the xhtml doctype.

MP Mr Papa
Mr Papa
Member

yeah, we havent run all our validation and wp debug issues to ground yet…  but are slowing checking them off…

YS Yellow Swordfish
Yellow Swordfish
Member

Sorry for not coming back sooner on this.

I see no reason not to implement your suggested changes. I am about to leave on vacation so if Steve doesn’t manage to fit the changes in give me a shout when I get back and I will do it then.

LH Lee H
Lee H
Member

I’ve concluded that I will have to supply my own version of the login form based off of the original anyway. Something I didn’t consider is the RPX login portion of the form. It’s causing me problems that I can’t overcome unless I make a custom version of the rpx form function. So to use the custom RPX form function, I will need a custom login form that calls it.

So unless my suggestion absolutely seems like a good idea for everyone else, I’d just let it go.

YS Yellow Swordfish
Yellow Swordfish
Member

OK. There is a pretty simple method of alignment that can be done with a couple of lines of javascript. Again – if I remember this when I get back I will try and look it up and work it in.