Logout Popup
3 posters
Page 1 of 1
Logout Popup
Is there anyway to edit the logout html to add an onclick function?
I would like to add this to ask my members are they sure they want to logout.
I would like to add this to ask my members are they sure they want to logout.
Re: Logout Popup
Rideem3 wrote:Yeah, here's a code that will ask them to confirm their log out
Go to Admin Panel -> Modules -> JavaScript Codes Management -> Create a new JavaScript:
Title: Logout
Check "In All the Pages"
Put this code:
- Code:
jQuery(document).ready(function() {
jQuery('a[href*="/login?logout"]').attr({
onclick: "logConfirm()",
id: "logout"
});
});
function logConfirm() {
var x = confirm("Are you sure you want to logout?");
if (x == true) {
return true;
}else{
jQuery(document).ready(function() {
jQuery('#logout').attr({
href: "#"
});
});
}
}
That didn't work.
Re: Logout Popup
Rideem3 wrote:All I see on your forum is this:
http://www.mystreetlife.com/99372.js
You must remove:
- Code:
$(function(){document.post.post.value="Post"});
Why do i need to remove that for? I use that to change the send button to post. I have a total of 3 JS
Logout http://www.mystreetlife.com/12372.js
Quote Box http://www.mystreetlife.com/11328.js
post instead of send http://www.mystreetlife.com/10000.js
I did create a new javascript
Re: Logout Popup
I have edited some of the templates but I'm not sure what would be blocking it. Is there anything else that you could do?
You are right i have to delete...
for it to work. So maybe you can help me with changing the send to post when people create a new or reply to a topic?
I don't understand why i cant use both js codes if they a seperated? So i was able to get the confirm box to pop up but when i hit cancel it still logs me out ?
You are right i have to delete...
- Code:
$(function() {
document.post.post.value="Post";
});
for it to work. So maybe you can help me with changing the send to post when people create a new or reply to a topic?
I don't understand why i cant use both js codes if they a seperated? So i was able to get the confirm box to pop up but when i hit cancel it still logs me out ?
Last edited by iamthestreets on January 19th 2012, 11:37 pm; edited 1 time in total (Reason for editing : got it to work a little)
Re: Logout Popup
Its because that script will crash on a page where a send button doesn't exist.
All you need to do is change it to this:
And here is the other code improved on AND with the first code included in it:
So this is the ONLY code you need for these two tasks.
Sorry for improving your code Rideem3, I meant no offence, but only for educational purposes.
All you need to do is change it to this:
- Code:
$(function() {
if (document.post) { document.post.post.value="Post"; }
});
And here is the other code improved on AND with the first code included in it:
So this is the ONLY code you need for these two tasks.
- Code:
$(function() {
if (document.post) { document.post.post.value="Post"; }
var x=document.getElementById('logout');
if (x) {
$(x.parentNode).click(function(e) {
if (!confirm("Are you sure you want to logout?")) { e.preventDefault(); }
});
}
});
Sorry for improving your code Rideem3, I meant no offence, but only for educational purposes.
LGforum- Hyperactive
- Posts : 2265
Reputation : 264
Language : English
Location : UK
Re: Logout Popup
LGforum wrote:Its because that script will crash on a page where a send button doesn't exist.
All you need to do is change it to this:
- Code:
$(function() {
if (document.post) { document.post.post.value="Post"; }
});
And here is the other code improved on AND with the first code included in it:
So this is the ONLY code you need for these two tasks.
- Code:
$(function() {
if (document.post) { document.post.post.value="Post"; }
var x=document.getElementById('logout');
if (x) {
$(x.parentNode).click(function(e) {
if (!confirm("Are you sure you want to logout?")) { e.preventDefault(); }
});
}
});
Sorry for improving your code Rideem3, I meant no offence, but only for educational purposes.
This works, but if i click on any one of my other buttons like forum, search, etc it opens the confirm box.
LGforum- Hyperactive
- Posts : 2265
Reputation : 264
Language : English
Location : UK
Re: Logout Popup
LGforum wrote:Change (x.parentNode) to just (x)
It Worked!!! Thanks goes to both you!
Similar topics
» The logout link
» Logout problem.
» Custom Logout URL
» Won't let members logout?
» cant hide navbar's "logout"
» Logout problem.
» Custom Logout URL
» Won't let members logout?
» cant hide navbar's "logout"
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum