The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

Custom Logout URL

View previous topic View next topic Go down

Solved Custom Logout URL

Post by J0k3R^ on Mon Apr 21, 2014 10:58 am

Hey, how can i make a custom logout URL for my forum?
the reason i want this is because i edit my navbar in css but i cant edit the "logout" one because the link is its different for every user...

Spoiler:


i found a tutorial about it which had the following code for js but it didnt work for me (i ofc tried to put new link there). Im using punbb, thanks againVery Happy

Spoiler:

Code:
var logoutlink = document.getElementById("i_icon_mini_logout").parentNode.href;
document.getElementById("newlogoutlink").href = logoutlink;



Last edited by J0k3R^ on Wed Apr 23, 2014 6:01 am; edited 1 time in total
avatar
J0k3R^
Forumember

Male Posts : 742
Reputation : 28
Language : Greek > English > Russian > Spanish
Location : C:\>r00t

http://fmplanet.forumgreek.com

Back to top Go down

Solved Re: Custom Logout URL

Post by Pizza Boi on Mon Apr 21, 2014 11:59 am

Hi Very Happy

Well, there's a general logout link: /login?logout so the script should look something like:

Code:
var logoutlink = document.getElementById("i_icon_mini_logout").parentNode.href;
document.getElementById("New Logout Link // Replace this").href = login?logout;

Regards,
Pizza Boi
avatar
Pizza Boi
Hyperactive

Male Posts : 2016
Reputation : 160
Language : French
Location : Pizza Hut!

http://redlustempire.forumtl.com/

Back to top Go down

Solved Re: Custom Logout URL

Post by J0k3R^ on Mon Apr 21, 2014 12:22 pm

already tried this mate..
avatar
J0k3R^
Forumember

Male Posts : 742
Reputation : 28
Language : Greek > English > Russian > Spanish
Location : C:\>r00t

http://fmplanet.forumgreek.com

Back to top Go down

Solved Re: Custom Logout URL

Post by Pizza Boi on Mon Apr 21, 2014 12:29 pm

Hi Very Happy

So you want the word to change? I experimented here in FM and this works fine for me:

Code:
a#logout {
  font-size: 0px !important;
}
a#logout:after {
  font-size: 12px !important;
  content: "Log Out Boi";
}

Regards,
Pizza Boi
avatar
Pizza Boi
Hyperactive

Male Posts : 2016
Reputation : 160
Language : French
Location : Pizza Hut!

http://redlustempire.forumtl.com/

Back to top Go down

Solved Re: Custom Logout URL

Post by J0k3R^ on Mon Apr 21, 2014 12:58 pm

although this code worked i want to change the logout linkloul
avatar
J0k3R^
Forumember

Male Posts : 742
Reputation : 28
Language : Greek > English > Russian > Spanish
Location : C:\>r00t

http://fmplanet.forumgreek.com

Back to top Go down

Solved Re: Custom Logout URL

Post by Pizza Boi on Mon Apr 21, 2014 1:11 pm

Hi Very Happy

Can you link me to the tutorial? I think the code's incomplete so let me see if I can check it. Here's what I got so far after snitching but I don't think this works:

Code:
var logoutlink = document.getElementById("a#logout").parentNode.href;
document.getElementById("newlogoutlink").href = logoutlink;
if
    {
    elem.innerHTML = "Can't logout";
    }
    else
    {
    elem.innerHTML = "Custom log out";
    }

Regards,
Pizza Boi
avatar
Pizza Boi
Hyperactive

Male Posts : 2016
Reputation : 160
Language : French
Location : Pizza Hut!

http://redlustempire.forumtl.com/

Back to top Go down

Solved Re: Custom Logout URL

Post by Ange Tuteur on Mon Apr 21, 2014 4:43 pm

Hello J0k3R^,

You can edit the default logout navlink by selecting the 'logout' Id. See the script below :
Code:
$(function() {
  var logout = document.getElementById('logout');
  logout.href = '/login?logout=1';
  logout.innerHTML = 'My logout link';
});

We set the href content; taking out the tid and key will open a prompt instead of instantly logging you out. Then we set the text content by changing the inner HTML of the logout link.
avatar
Ange Tuteur
Forumaster

Male Posts : 13120
Reputation : 2804
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: Custom Logout URL

Post by J0k3R^ on Tue Apr 22, 2014 7:11 am

okey, its working @Ange
but how can i avoid the confirm page? ("u sure want to logout?")
avatar
J0k3R^
Forumember

Male Posts : 742
Reputation : 28
Language : Greek > English > Russian > Spanish
Location : C:\>r00t

http://fmplanet.forumgreek.com

Back to top Go down

Solved Re: Custom Logout URL

Post by Ange Tuteur on Tue Apr 22, 2014 3:43 pm

Remove where we change its href content :
Code:
$(function() {
    var logout = document.getElementById('logout');
    logout.innerHTML = 'My logout link';
});
avatar
Ange Tuteur
Forumaster

Male Posts : 13120
Reputation : 2804
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: Custom Logout URL

Post by J0k3R^ on Wed Apr 23, 2014 1:09 am

@Ange Tuteur wrote:Remove where we change its href content :
Code:
$(function() {
  var logout = document.getElementById('logout');
  logout.innerHTML = 'My logout link';
});

this didnt work, the link is the default. :/
but i use your privious code and im fine i guess...
avatar
J0k3R^
Forumember

Male Posts : 742
Reputation : 28
Language : Greek > English > Russian > Spanish
Location : C:\>r00t

http://fmplanet.forumgreek.com

Back to top Go down

Solved Re: Custom Logout URL

Post by Ange Tuteur on Wed Apr 23, 2014 3:50 am

Did you copy the code correctly ? It works perfectly fine for me.
avatar
Ange Tuteur
Forumaster

Male Posts : 13120
Reputation : 2804
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: Custom Logout URL

Post by J0k3R^ on Wed Apr 23, 2014 5:50 am

@Ange Tuteur wrote:Did you copy the code correctly ? It works perfectly fine for me.

EDIT: i want to change the logout url not the text at nav bar.
ur code changes the text at nav bar, i want to change this:
to a custom url for all users, because this one is different for every user. Smile

sorry for the missunderstanding:rose:
avatar
J0k3R^
Forumember

Male Posts : 742
Reputation : 28
Language : Greek > English > Russian > Spanish
Location : C:\>r00t

http://fmplanet.forumgreek.com

Back to top Go down

Solved Re: Custom Logout URL

Post by Ange Tuteur on Wed Apr 23, 2014 4:57 pm

If you remove the tid and key then you will be met with a confirmation page each time you logout.

Code:
$(function() {
  var logout = document.getElementById('logout');
  logout.href = '/login?logout=1';
});
avatar
Ange Tuteur
Forumaster

Male Posts : 13120
Reputation : 2804
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: Custom Logout URL

Post by J0k3R^ on Thu Apr 24, 2014 2:03 am

*Solved*
avatar
J0k3R^
Forumember

Male Posts : 742
Reputation : 28
Language : Greek > English > Russian > Spanish
Location : C:\>r00t

http://fmplanet.forumgreek.com

Back to top Go down

Solved Re: Custom Logout URL

Post by Jophy on Thu Apr 24, 2014 3:12 am

Moved
avatar
Jophy
ForumGuru

Male Posts : 17924
Reputation : 835
Language : English
Location : Somewhere

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum