Moving login to custom header Moving login to custom header
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Moving login to custom header

Started by terrano, July 18, 2014, 04:38:15 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

terrano

Found the thread where the order of the system menu links can be changed in theme.php , thought might be able to delete rest of the links and just be left with login and logout and put
{SYS_MENU} in custom header but soon as delete any of the links causes an error.

What is the simplest way of shifting the login ?

Αndré

I assume you got an template error. This happens, as the theme engine tries to remove some buttons/blocks and cannot find them, as the mandatory "START / END" comments are missing.

I suggest to use the FinalExtract plugin to remove buttons. When done, you just need to add a new login button/link to your custom header.

terrano

Thanks Αndré, Yes it was a template error.

I see the register link is not an option for removal, presume I can just add it into the file with the list of link-buttons that can be removed ?






Αndré

If you want to extend the plugin to remove the register button, you need to update its database table, admin.php and codebase.php. Maybe I'll do that and release a new version. I'll have a look as soon as possible.

Αndré

Quote from: Αndré on July 25, 2014, 11:20:36 AM
Added option to hide "register" button in version 2.6 (attached to initial post).

terrano

Thanks Αndré - excellent.

Now the original Login/Logout is hidden to users, I need to show the Login/Logout in the custom header of the gallery.
Login from the custom header of the gallery is via a bridge with a phpBB3 forum but need a re-direct back to the gallery
instead of the forum index.

Can I somehow place/link the Login/Logout code from theme.php to show to users in the custom header ?

addbutton($sys_menu_buttons,'{LOGIN_LNK}','{LOGIN_TITLE}','{LOGIN_TGT}','login','');
addbutton($sys_menu_buttons,'{LOGOUT_LNK}','{LOGOUT_TITLE}','{LOGOUT_TGT}','logout','');

Αndré

Just add a simple link, like
<a href="login.php">Login</a>

Coppermine automatically redirects to the bridge login. Redirecting back to Coppermine needs to be a forum feature, there's nothing Coppermine can change if it doesn't work.

To hide the login link to already logged in users, use something like
<?php if (!USER_ID) echo '<a href="login.php">Login</a>'?>

terrano

Thanks again André

I've had redirect code working back to the gallery.

Just need to know please how to have the default logout code that final extract has hidden
to be displayed to a user in the custom header ?

Αndré

You'd need something like this:
<?php
list($timestamp$form_token) = getFormToken();
if (
USER_ID) echo "<a href=\"logout.php?form_token=$form_token&amp;timestamp=$timestamp\">Login</a>"
?>



This will probably not work, as I assume your custom header doesn't run in Coppermine's scope, thus the function getFormToken doesn't exist. Try to include /path/to/your/Coppermine/directory/include/functions.inc.php in your header file.

Alternatively, use the logout file of the application Coppermine is bridged to (phpBB in your case).