Hello again,
I was asked if I could add a logout button next to the save button on my cf form. However, since the <form> tag cannot be in the Form HTML I was not sure how to do this.
Any Ideas??
Thanks,
I was asked if I could add a logout button next to the save button on my cf form. However, since the <form> tag cannot be in the Form HTML I was not sure how to do this.
Any Ideas??
Thanks,
OK so taking a stab at is my self I added a logout submit
and then in the On Submit code added this little catch
and this does log the user out. Only problem is that it takes the user to a blank page. I would like the user to be logged out and taken to the welcome.html page. But if I am already redirecting them ??
I also tried:
$mainframe->logout();
but that takes me to a blank screen?
<input type="submit" name="submit" value="Logout" />
and then in the On Submit code added this little catch
<?php
if ( $_POST['submit'] == 'Logout') {
header ("Location: http://www.surgimap.com/index.php?option=com_user&task=logout");
exit;
}
?>
and this does log the user out. Only problem is that it takes the user to a blank page. I would like the user to be logged out and taken to the welcome.html page. But if I am already redirecting them ??
I also tried:
$mainframe->logout();
but that takes me to a blank screen?
Sorry for posting... I found the solution!
Just in-case any one else needs to know:
First, put the lougout input in the form HTML:
Then in the On Submit code add:
and then whatever url you give to the $return variable will be the redirection after the logout. This actually ended up being much simpler than I thought.
enjoy!
Just in-case any one else needs to know:
First, put the lougout input in the form HTML:
<input type="submit" name="submit" value="Logout" />
Then in the On Submit code add:
<?php
if ( $_POST['submit'] == 'Logout') {
global $mainframe;
//preform the logout action
$error = $mainframe->logout();
//create the redirect variable
$return = 'http://www.yoursite.com/welcome.html';
if(!JError::isError($error)){
if ($return) {
//there is probably a cleaner way to do this but you get the idea.
$return = 'http://www.yoursite.com/welcome.html';
}
}
exit;
}
?>
and then whatever url you give to the $return variable will be the redirection after the logout. This actually ended up being much simpler than I thought.
enjoy!
Glad you made it, thanks for posting the solution!🙂
Regards,
Max
Regards,
Max
This topic is locked and no more replies can be posted.