PDA

View Full Version : Quick Login/Register Widget/Plugin ?



baadier
03-12-2010, 05:21 AM
A quick login form that can be added to any page as opposed to users clicking through to the Login page. The widget will adapt to whether the user uses RPX or not but most importantly they will be able to login from any page

Also it could be AJAX'd whereby its tabbed with Register | Login so people can sign up pretty easily as well and avoid having to click through to register. I think the register page has only 4 fields so it shouldnt take up too much screen real estate

Nick
03-12-2010, 12:24 PM
Not quite what you're asking, but the RPX plugin has a "replace" option which replaces login/register with "sign in" (if memory serves me correcty). Instead of redirecting to the login page, it overlays the current page with the RPX widget. When registering, your third-party provider sends you to a simplified registration page, though.

baadier
03-12-2010, 01:12 PM
I'm familiar with the replace feature, what I was thinking of was having a tabbed login module in your sidebar similar to the quick submit form. Users would be able to login or register directly from this

baadier
03-13-2010, 01:04 AM
http://twitpic.com/187laa thats kinda what i mean, but its tabbed with an option to LOGIN | REGISTER.

ties
04-01-2010, 08:31 AM
i think the login can be ajaxed thru the login retrun value
you need to set it to a page which only checks if a user is logedd in or not and return it in a format javascript can understand, i recommend JSON
little guide
http://www.footymix.com/index.php?page=login&return=http://www.footymix.com/checkUserStatus.php
with checkUserStatus.php is something like:

require_once('hotaru_settings.php');
require_once('Hotaru.php');
$h = new Hotaru();
$h->start();
if ($h->currentUser->loggedIn) echo json_encode(array('result'=>true));
else echo json_encode(array('result'=>false));
there is your ajax result
now you just need to add the form of the user signin plugin and add an onsubmit function
the return value must point to the checkUserStatus.php
<form ... onsubmit="ajaxLogin($(this)); return false;">...</form> and the javacsript function which will look something like this
function ajaxLogin(form){
$.post(form.attr('action'), form.serialize(), function(data) {
if(data.result) alert('login succeeded');
else alert('login failed');
// Do here what you want to do when login succeeded or failed
},'json');
}

but i dont know about the registering... it can be hard to ajax this or you need to write a plugin for it

ties
04-01-2010, 11:43 AM
maybe you can try to make a login widget with the code above!
hints:
hello world widget (http://hotarucms.org/showthread.php?t=65)
dependancies (http://hotarucms.org/showthread.php?t=31) ... for user_signin and widgets of course
include templates, css and javascript (http://hotarucms.org/showthread.php?t=45)
Its also recommended to use a test environment, disable caching and enable debug modes