News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Show member info if logged in

Started by GalaticNetwork, March 10, 2011, 06:18:59 PM

Previous topic - Next topic

GalaticNetwork

Hi i've nearly got it now just need a couple of tweaks and i was hopeing someone could help.

Basicly i have a page named member.php useing this code. <?php
require_once('forum/SSI.php');
$_SESSION['login_url'] = 'http://galaticnetwork.co.uk' . $_SERVER['PHP_SELF'];
$_SESSION['logout_url'] = 'http://galaticnetwork.co.uk' . $_SERVER['PHP_SELF'];
global
$context, $memberContext;
if (
$context['user']['is_logged'])
{
 
$return = loadMemberData($context['user']['id'], false, 'profile');
 if (!empty(
$return))
 {
   
loadMemberContext($context['user']['id']);
   
$member = &$memberContext[$context['user']['id']];
 }
}
if (
$context['user']['is_guest'])
  echo $txt['welcome_guest'];
              else
echo
$context;

{
 
is_not_guest();
}
?>
<style type="text/css">
.center {
text-align: center;
}
</style>
<p class="center">Hello <?php echo $member['name']; ?> and welcome to the member lounge, here you will be able to view your Profile details, view your PM's check the latest Trailers or just Chat to your freinds and view your Posts, please bear in mind everything is still in Beta so don't expect loads of extras just yet. Thanks</p>
<p class="center"><a href="profile.php">View Profile</a></p>
<p class="center"><a href="mposts.php">View Posts</a></p>
<p class="center"><a href="pms.php">View PM's</a></p>
<p class="center"><a href="mstats.php">View Stats</a></p>
<p>&nbsp;</p>

What i want it to do and it does do but in the wrong way, is show ssi_welcome if guest but other wise show the content of this page if member is logged in. And it does do that but it brings this along with the guest message.

As you can see at the top it shows welcome guest ect but brings the Forum theme with it and the login page. I don't want the Forum theme showing up, Is there a way i can stop this?
And this is when i'm logged in

As you can see it gives me exactly what i want. So it's just finding the code so it shows only ssi_welcome guest and doesn't bring the forum and theme with it.

Thanks

Thanks
Time controlls everyone, if we could master time we could master anything.
_________________________________________
Where space folds into one :D

Arantor

Sorry, but you should have been more specific when I first wrote the code for you. I'm sure I even told you that's what it would do.

Take out the is_not_guest() line and put the other content in there that should be shown to guests. Note that you still have to deal with hiding the other stuff since is_not_guest() deals with that too.
Holder of controversial views, all of which my own.


GalaticNetwork

Well the member info code you wrote for me works perfect, except the forum time date made the html mess up. So i removed that. But member.php holds the link to profile.php. In the picture where im logged on i want that hidden if your a guest. As you have guest lol.

Is there no easy way of doing this then? I mean all that member.php is my site template with a include then the code i posted written in the include.php file.

Will i have to edit ssi.php? as i have done enough of that to get it working with my site,

Thanks
Time controlls everyone, if we could master time we could master anything.
_________________________________________
Where space folds into one :D

Arantor

-sigh- No, you won't have to rewrite SSI.php (which is an insanely bad idea anyway, since when you upgrade to 2.0 final, it will be replaced during the upgrade, as in completely replaced by the upgrade)

QuoteIs there no easy way of doing this then? I mean all that member.php is my site template with a include then the code i posted written in the include.php file.

Depends on your definition of easy, really. And it depends on you being VERY SPECIFIC about what you want, since I wrote exactly what you asked for last time, and it's wrong.

Hopefully someone else can help you, because until you bother to be specific (and not just 'in the picture i want that hidden') I won't help you any further.
Holder of controversial views, all of which my own.


GalaticNetwork

Ok i will be as specific as i can, What i want to be hidden is this codeing write here <p class="center">Hello <?php echo $member['name']; ?> and welcome to the member lounge, here you will be able to view your Profile details, view your PM's check the latest Trailers or just Chat to your freinds and view your Posts, please bear in mind everything is still in Beta so don't expect loads of extras just yet. Thanks</p>
<p class="center"><a href="profile.php">View Profile</a></p>
<p class="center"><a href="mposts.php">View Posts</a></p>
<p class="center"><a href="pms.php">View PM's</a></p>
<p class="center"><a href="mstats.php">View Stats</a></p>
<p>&nbsp;</p>
So pretty much all i want member.php saying is if it's not a member logged in.
Hello guest you are not signed in, Please sign in 'here' or 'Register' if you havn't got a account yet.

But if you a member then all this can be shown <p class="center">Hello <?php echo $member['name']; ?> and welcome to the member lounge, here you will be able to view your Profile details, view your PM's check the latest Trailers or just Chat to your freinds and view your Posts, please bear in mind everything is still in Beta so don't expect loads of extras just yet. Thanks</p>
<p class="center"><a href="profile.php">View Profile</a></p>
<p class="center"><a href="mposts.php">View Posts</a></p>
<p class="center"><a href="pms.php">View PM's</a></p>
<p class="center"><a href="mstats.php">View Stats</a></p>
<p>&nbsp;</p>
Is that better? I don't know how more clear i can be

Thanks for your help
Time controlls everyone, if we could master time we could master anything.
_________________________________________
Where space folds into one :D

Arantor

You could have just written that originally instead of being vague about it ;)

<?php
require_once('forum/SSI.php');
$_SESSION['login_url'] = 'http://galaticnetwork.co.uk' . $_SERVER['PHP_SELF'];
$_SESSION['logout_url'] = 'http://galaticnetwork.co.uk' . $_SERVER['PHP_SELF'];
global
$context, $memberContext;
if (
$context['user']['is_logged'])
{
 
$return = loadMemberData($context['user']['id'], false, 'profile');
 if (!empty(
$return))
 {
   
loadMemberContext($context['user']['id']);
   
$member = &$memberContext[$context['user']['id']];
 }
}
if (
$context['user']['is_guest'])
{
  echo $txt['welcome_guest'];
}
else
?>
<style type="text/css">
.center {
text-align: center;
}
</style>
<p class="center">Hello <?php echo $member['name']; ?> and welcome to the member lounge, here you will be able to view your Profile details, view your PM's check the latest Trailers or just Chat to your freinds and view your Posts, please bear in mind everything is still in Beta so don't expect loads of extras just yet. Thanks</p>
<p class="center"><a href="profile.php">View Profile</a></p>
<p class="center"><a href="mposts.php">View Posts</a></p>
<p class="center"><a href="pms.php">View PM's</a></p>
<p class="center"><a href="mstats.php">View Stats</a></p>
<p>&nbsp;</p>
<?php
}
?>


All I've done is moved the { } block around.
Holder of controversial views, all of which my own.


GalaticNetwork

Sorry i thought i was being clear, Thanks for that im such a idiot lol.
You always end up helping me.

Thanks alot  ;D
Time controlls everyone, if we could master time we could master anything.
_________________________________________
Where space folds into one :D

Advertisement: