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 April 21st 2014, 4:58 pm

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 April 23rd 2014, 12:01 pm; edited 1 time in total

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 April 21st 2014, 5:59 pm

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

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 April 21st 2014, 6:22 pm

already tried this mate..

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 April 21st 2014, 6: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

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 April 21st 2014, 6:58 pm

although this code worked i want to change the logout linkloul

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 April 21st 2014, 7: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

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 April 21st 2014, 10: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.

Ange Tuteur
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: Custom Logout URL

Post by J0k3R^ on April 22nd 2014, 1:11 pm

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

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 April 22nd 2014, 9:43 pm

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

Ange Tuteur
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: Custom Logout URL

Post by J0k3R^ on April 23rd 2014, 7: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...

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 April 23rd 2014, 9:50 am

Did you copy the code correctly ? It works perfectly fine for me.

Ange Tuteur
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: Custom Logout URL

Post by J0k3R^ on April 23rd 2014, 11: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:

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 April 23rd 2014, 10: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';
});

Ange Tuteur
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: Custom Logout URL

Post by J0k3R^ on April 24th 2014, 8:03 am

*Solved*

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 April 24th 2014, 9:12 am

Moved

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