Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Moving login to custom header  (Read 6753 times)

0 Members and 1 Guest are viewing this topic.

terrano

  • Coppermine regular visitor
  • **
  • Country: 00
  • Offline Offline
  • Posts: 55
Moving login to custom header
« on: July 18, 2014, 04:38:15 am »

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 ?
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Moving login to custom header
« Reply #1 on: July 18, 2014, 10:10:56 am »

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.
Logged

terrano

  • Coppermine regular visitor
  • **
  • Country: 00
  • Offline Offline
  • Posts: 55
Re: Moving login to custom header
« Reply #2 on: July 24, 2014, 07:25:49 am »

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 ?





 
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Moving login to custom header
« Reply #3 on: July 24, 2014, 09:49:38 am »

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.
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Moving login to custom header
« Reply #4 on: July 25, 2014, 11:21:10 am »

Added option to hide "register" button in version 2.6 (attached to initial post).
Logged

terrano

  • Coppermine regular visitor
  • **
  • Country: 00
  • Offline Offline
  • Posts: 55
Re: Moving login to custom header
« Reply #5 on: August 01, 2014, 06:53:05 am »

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','');
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Moving login to custom header
« Reply #6 on: August 01, 2014, 08:52:11 am »

Just add a simple link, like
Code: [Select]
<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
Code: [Select]
<?php if (!USER_ID) echo '<a href="login.php">Login</a>'?>
Logged

terrano

  • Coppermine regular visitor
  • **
  • Country: 00
  • Offline Offline
  • Posts: 55
Re: Moving login to custom header
« Reply #7 on: August 02, 2014, 02:16:40 am »

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 ?
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Moving login to custom header
« Reply #8 on: August 05, 2014, 01:42:24 pm »

You'd need something like this:
Code: [Select]
<?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).
Logged
Pages: [1]   Go Up
 

Page created in 0.021 seconds with 19 queries.