Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
themes-topic
sp_render_inline_login_form() Mod request?
Avatar
Lee H
Coastal New England (USA)
Member
Free Members
sp_UserOfflineSmall Offline
Sep 15, 2011 - 8:36 pm

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; 
} 

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Sep 16, 2011 - 2:24 pm

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

andy-signature.png
YELLOW
SWORDFISH
Avatar
Lee H
Coastal New England (USA)
Member
Free Members
sp_UserOfflineSmall Offline
Sep 16, 2011 - 2:54 pm

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/El.....ents/label

Avatar
Lee H
Coastal New England (USA)
Member
Free Members
sp_UserOfflineSmall Offline
Sep 16, 2011 - 3:39 pm

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.

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Sep 16, 2011 - 10:49 pm

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

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Sep 19, 2011 - 3:52 pm

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.

andy-signature.png
YELLOW
SWORDFISH
Avatar
Lee H
Coastal New England (USA)
Member
Free Members
sp_UserOfflineSmall Offline
Sep 19, 2011 - 4:02 pm

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.

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Sep 19, 2011 - 4:26 pm

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.

andy-signature.png
YELLOW
SWORDFISH
Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 650
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 619
Members: 17361
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10127
Posts: 79625