Editing navbar (logout link) via plugin

Get help from other users here.

Moderators: Developer, Contributor

Post Reply
Dominus
Posts: 10
Joined: 11 Aug 2020, 05:36

Editing navbar (logout link) via plugin

Post by Dominus »

I've been looking for a way to change the logout link for users within my plugin, but setLogoutPage() will result in it being a relative link, when I want it to go to an external site.

Ex. My site is example.com, so the link normally is example.com/logout.php. If I do setLogoutPage to https://foo.com, the link ends up being example.com/https://foo.com.

Is there a way to avoid the link being relative, or to add a new link there and remove the old one?
Mantis 2.25.1
PHP 7.4.19
cas
Posts: 1586
Joined: 11 Mar 2006, 16:08
Contact:

Re: Editing navbar (logout link) via plugin

Post by cas »

You can redirect with this setting:
/**
* Specify where the user should be sent after logging out.
* @global string $g_logout_redirect_page
*/
$g_logout_redirect_page = "http://www_mypage.com";
Dominus
Posts: 10
Joined: 11 Aug 2020, 05:36

Re: Editing navbar (logout link) via plugin

Post by Dominus »

That line doesn't seem to work. I've also tried using setLogoutRedirectPage. The link remains the same, and simply refreshes the same page when you click it.
Mantis 2.25.1
PHP 7.4.19
cas
Posts: 1586
Joined: 11 Mar 2006, 16:08
Contact:

Re: Editing navbar (logout link) via plugin

Post by cas »

In that case raise an issue on http://www.mantisbt.org/bugs
Dominus
Posts: 10
Joined: 11 Aug 2020, 05:36

Re: Editing navbar (logout link) via plugin

Post by Dominus »

Is there a way to just hide the link through a plugin?
Mantis 2.25.1
PHP 7.4.19
cas
Posts: 1586
Joined: 11 Mar 2006, 16:08
Contact:

Re: Editing navbar (logout link) via plugin

Post by cas »

Then you need to create that plugin.
In your case I would adjust logout.php with a fixed redirect :mrgreen:
Dominus
Posts: 10
Joined: 11 Aug 2020, 05:36

Re: Editing navbar (logout link) via plugin

Post by Dominus »

I considered it.

There really should be a hook or HTML ID on the logout button, though, since the only way I could get it in jQuery was find the logout icon, then go to the parent.
Mantis 2.25.1
PHP 7.4.19
Post Reply