coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 bridging => Topic started by: formulx on March 24, 2008, 10:38:11 PM

Title: [Solved]: Member Specific Messages
Post by: formulx on March 24, 2008, 10:38:11 PM
Hello,
I bridged Coppermine with SMF and am having a small issue.

Im using the customheader.php file to allow myself to use PHP in my custom theme. The problem is that in the header I have a spot that displays a certain message (telling them to signup) if they arent logged in. Now ive tried the code im using on php file thats not linked to CP using SMF's SSI.php file and it works fine. When I try to use the exact code on customheader.php it doesnt seem to work at all.

What im using is:

      <?php
      if ($context['user']['is_guest'])
      {
                ... etc

At the top of the customheader.php file I have:
require_once('../forum/SSI.php');
(the gallery is located at domain.com/gallery and forum at domain.com/forum therefore the need to include the ../)

Im not sure why it isnt working so I was wondering if there was any coppermine specific code I could use to check if a user is logged in?
Title: Re: Member Specific Messages
Post by: formulx on March 24, 2008, 10:39:40 PM
Whoops forgot to mention that I would be more than happy to say the real domain but due to it containing adult material I would rather not post a direct link to protect any "minors" from reaching the page by accident.
Title: Re: Member Specific Messages
Post by: Nibbler on March 24, 2008, 11:14:47 PM
It doesn't work like that because the bridge already includes SSI.php. You can do it the Coppermine way instead.


if (USER_ID){
  echo 'You are logged in as ' . USER_NAME;
} else {
  echo 'You are not logged in';
}
Title: Re: Member Specific Messages
Post by: formulx on March 24, 2008, 11:17:54 PM
Ah I see, if I wanted to use the SSI.php file how would I go about doing it?
Title: Re: Member Specific Messages
Post by: Nibbler on March 24, 2008, 11:19:35 PM
Add a

global $context;

to bring the SSI info into scope.
Title: Re: Member Specific Messages
Post by: formulx on March 24, 2008, 11:24:04 PM
Thanks so much! Also im having one small problem. Perhaps my script is messed up (I might have messed it up unknowingly) but the first code you gave me wont work. Instead I have to use if (!USER_ID) as being if the user is logged in and the else conditional shows something if the user isnt logged in.
Title: Re: Member Specific Messages
Post by: formulx on March 24, 2008, 11:26:09 PM
Ignore my last post, it was my stupidity.