Editing navbar (logout link) via plugin

Get help from other users here.

Moderators: Developer, Contributor

Post Reply
Dominus
Posts: 9
Joined: Aug 11, 2020 12:36 am

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.24.2
PHP 7.4.9

cas
Posts: 861
Joined: Mar 11, 2006 11:08 am
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: 9
Joined: Aug 11, 2020 12:36 am

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.24.2
PHP 7.4.9

cas
Posts: 861
Joined: Mar 11, 2006 11:08 am
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: 9
Joined: Aug 11, 2020 12:36 am

Re: Editing navbar (logout link) via plugin

Post by Dominus »

Is there a way to just hide the link through a plugin?
Mantis 2.24.2
PHP 7.4.9

cas
Posts: 861
Joined: Mar 11, 2006 11:08 am
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: 9
Joined: Aug 11, 2020 12:36 am

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.24.2
PHP 7.4.9

Post Reply