Using highslide with Website Membership Plugin

6 posts by 2 authors in: Forums > CMS Builder
Last Post: July 28, 2011   (RSS)

By Tim_cmsb - July 24, 2011

Hi,

Can someone help me with the closing of popups if the username and password are ok.
I sure hope someone can help me with this.

Normally the highslide popups can be closed in one of the following ways with one of the following codes:

1 ------------------------------------------------------------
With a submit button you can redirect the main page like this:
<input type="submit" name="submit" value="Login" onclick="parent.location.href = 'http://www.highslide.com/'" />
Or do it with a delay like this:
<input type="submit" name="submit" value="Login" onclick="setTimeout(function () {
try {
parent.location.href = 'http://www.highslide.com/';
} catch (e) {}
}, 5000);" />

2 ------------------------------------------------------------
If your submit button belongs to a Login form that will automatically go to another page after you’ve clicked the button, you shouldn’t do any changes to the submit button. Instead you can add this to the confirmation page (the page that opens in the iframe after you’ve clicked the submit button):
<script type='text/javascript'>
setTimeout(function () {
try {
parent.window.hs.getExpander().close();
} catch (e) {}
}, 3000);
</script>
This will close the popup after 3000 ms.

3 ------------------------------------------------------------
If you want to close the popup and redirect the main page, you can use this:
<script type='text/javascript'>
setTimeout(function () {
try {
parent.window.hs.getExpander().close();
parent.location.href = 'http://www.highslide.com/';
} catch (e) {}
}, 3000);
</script>

But the forms of the Website Membership Plugin need to check e few things like: username, password, invalid fields, etc.
And after this it goes to the desired link. If I use this now and I get an error message it still jumps to the link used after the popup is closed!
I want to know how I can do this in the http://www.YourDomain.com/cmsAdmin/plugins/websiteMembership/websiteMembership.php .
I think it's possible in the websiteMembership.php page. Especially in this part of code (I changed the error reports to a different language):

<!-- part of code of the websiteMembership.php page -->

function _websiteLogin_login() {
global $CURRENT_USER;

// set cookies
// header line must be first or other cookies won't be set.
// HttpOnly is only supported in PHP 5.2 so we do this manually
$_SESSION['username'] = @$_REQUEST['username']; //
$_SESSION['passwordHash'] = md5(@$_REQUEST['password']);

// check for valid login
$CURRENT_USER = _websiteLogin_getCurrentUser();
if (alert()) { return; }

// error checking
if ([url "mailto:!@$_REQUEST['username'"]!@$_REQUEST['username'[/url]]) { alert("Por fabor hinka un username!<br/>\n"); }
else if ([url "mailto:!@$_REQUEST['password'"]!@$_REQUEST['password'[/url]]) { alert("Por fabor hinka un password!<br/>\n"); }
else if (!$CURRENT_USER) { alert("Username òf password invalido!<br/>\n"); }
if (function_exists('wsms_login_errorchecking')) { alert(wsms_login_errorchecking($CURRENT_USER)); }
if (alert()) {
$CURRENT_USER = false;
return;
}

// clear form values
$_REQUEST['username'] = '';
$_REQUEST['password'] = '';

// redirect on success
if (@$_SESSION['lastUrl']) { $postLoginUrl = @$_SESSION['lastUrl']; }
else if ($GLOBALS['WEBSITE_LOGIN_POST_LOGIN_URL']) { $postLoginUrl = $GLOBALS['WEBSITE_LOGIN_POST_LOGIN_URL']; }
else { $postLoginUrl = thisPageUrl(); }
$redirectUrl = $GLOBALS['WEBSITE_LOGIN_POST_LOGIN_URL'];

unset($_SESSION['lastUrl']);
redirectBrowserToURL("$postLoginUrl");
exit;

}

<!-- /part of code of the websiteMembership.php page -->

If somebody know the solution, please give me a hand with this.

Regards,

Tim

Re: [ross] Using highslide with Website Membership Plugin

By Tim_cmsb - July 25, 2011

Hi Ross,

You could check http://www.vigilantekorsou.com and click on login...

Regards,

Tim

Re: [Tim_cmsb] Using highslide with Website Membership Plugin

By ross - July 25, 2011

Hi Tim

Thanks for that link :). I think I get it now. What's happening is when you log in successfully, CMS Builder is stuck inside that little popup window. What you are trying to do is have the popup close and the admin page come up in the main frame.

All the changes I can think of would need to be done in the plugin itself as that's where it decides if you are logged in properly or not. The main thing with this is that once you make a change to the plugin, you'll need to re-do that change each time you upgrade the plugin.

How comfortable are you working with PHP?

Thanks!
-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/

Re: [ross] Using highslide with Website Membership Plugin

By Tim_cmsb - July 25, 2011

Ross,

If I know what to do maybe I can do this in the future..!
I'm not very advanced, but know a bit.
Could you help me with this?

Regards,

Tim

Re: [Tim_cmsb] Using highslide with Website Membership Plugin

By Tim_cmsb - July 28, 2011

Hi Ross,

I did it an easier way... I Used a confirmation page, which redirects and for the profile.php I added text saying to close the popup an refresh.
Sure would have been nice if this could refresh and close automatically.
if you guys have something still, please let me know... especially for the profile.php page.

Regards,

Tim