Author |
Message |
srhh
Involved


Joined: Dec 27, 2005
Posts: 296
|
Posted:
Sat Sep 23, 2006 8:18 pm |
|
Hmm, I am trying to put two of the IsSet user function thingy into my main menu block.
I have one of the IsSet User thingy for my members control panel.
I wanted to put another one in the block for another section of sublinks I just want to show up when users log in.
I went the obvious route and copied the full function from the login section of the block and pasted it down below.
Apparently, the simplest solution is not the correct one because that just made my entire site go away.
How do I do this?
Here is truncated version of my failed code:
Code:
<?php
if (eregi("block-menuTest.php",$PHP_SELF)) {
Header("Location: index.php");
die();
}
global $user, $admin;
$title = "Main Menu";
$content = "
<div style=\"background-image: url(/themes/fiblue3d/images/menuback.gif); font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 100%\">
<br />
<strong><big>·</big></strong>
<a href=index.php>Home</a><br /> <strong><big>·</big></strong>
<a href=\"faq.html\">F.A.Q's</a><br ><br />
<u>Control Panel</u>
<br />";
if (!IsSet($user)) {
$content .= "
<strong><big>·</big></strong>
<a href=\"account.html\">Login</a><br >
<strong><big>·</big></strong>
<a href=\"modules.php?name=Your_Account&op=new_user\">Register</a><br />";
}
if ((IsSet($user)) or (IsSet($admin))) {
$content .= "
<strong><big>·</big></strong>
<a href=\"account.html\">Account Info</a><br >
<strong><big>·</big></strong>
<a href=\"modules.php?name=Your_Account&op=edituser\">Edit Profile</a><br />
<strong><big>·</big></strong>
<a href=\"modules.php?name=Your_Account&op=logout\">Logout</a><br />
";
}
$content .= "
<br />
<u>Community</u>
<br />
<strong><big>·</big></strong>
<a href=\"forums.html\">Forums</a><br >
<strong><big>·</big></strong>
<a href=\"modules.php?name=gallery2\">Gallery</a><br >
<strong><big>·</big></strong>
<a href=\"modules.php?name=Blog_List\">Blogs</a><br >
<strong><big>·</big></strong>
<a href=\"messages.html\">Private Messages</a><br />
<br />
<u>Musick & Media</u>
<br />
<br />";
if (!IsSet($user)) {
$content .= "
<strong><big>·</big></strong>
<a href=\"modules.php?name=NukeWrap&page=musick\">Music</a>
}
if ((IsSet($user)) or (IsSet($admin))) {
$content .= "
<strong><big>·</big></strong>
<a href=\"modules.php?name=NukeWrap&page=podcasts\">Podcast</a><br >
";
}
$content .= "
<br >
<br />
<u>Library</u><br />
<strong><big>·</big></strong>
<a href=\"content-cat-3.html\">Biographies</a><br >
<strong><big>·</big></strong>
<a href=\"content-cat-4.html\">Documents & Writings</a><br >
<strong><big>·</big></strong>
<a href=\"content-cat-2.html\">Misc.</a><br >
<br />
|
|
|
|
|
 |
fkelly
Former Moderator in Good Standing

Joined: Aug 30, 2005
Posts: 3312
Location: near Albany NY
|
Posted:
Sat Sep 23, 2006 8:42 pm |
|
I hadn't seen that isset(user) function before but I'm a relative newbie too. The one in mainfile is "function is_user($user) {" and there is a similar one for is_admin. Is that what you want to use? Or if not where did you copy the functions you are using from? |
|
|
|
 |
srhh

|
Posted:
Sat Sep 23, 2006 8:51 pm |
|
I really can't remember where I got this block from and I am pretty clueless about PHP.
I do know I want two seperate set of links to be visible to only members. The first set in the user control panel and the other for media.
If there is a better/easier way, I'm all ears.  |
|
|
|
 |
srhh

|
Posted:
Sat Sep 23, 2006 11:42 pm |
|
If it helps, I just checked my error logs and found this:
PHP Parse error: syntax error, unexpected '>' |
|
|
|
 |
montego
Site Admin

Joined: Aug 29, 2004
Posts: 9457
Location: Arizona
|
Posted:
Sun Sep 24, 2006 6:38 am |
|
This line here:
Code:
$content = "
<div style=\"background-image: url(/themes/fiblue3d/images/menuback.gif); font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 100%\">
|
Does not have a closing "; on the end. |
_________________ Only registered users can see links on this board! Get registered or login!
Only registered users can see links on this board! Get registered or login! |
|
|
 |
fkelly

|
Posted:
Sun Sep 24, 2006 7:17 am |
|
Brain dead on my part last night. Isset is a built in PHP function so that should work. Sorry. Just had to look up whether calls to functions were case sensitive and they weren't. So my lame excuse is that I'm used to seeing it as isset(). Maybe Montego's suggestion has you on track now, I hope. |
|
|
|
 |
srhh

|
Posted:
Mon Sep 25, 2006 6:18 pm |
|
montego wrote: | This line here:
Code:
$content = "
<div style=\"background-image: url(/themes/fiblue3d/images/menuback.gif); font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 100%\">
|
Does not have a closing "; on the end. |
I tried that, but didn't work. I had that line in there before and it worked fine |
|
|
|
 |
montego

|
Posted:
Tue Sep 26, 2006 6:02 am |
|
I'm sorry. I'm a dope. That is what happens when I am in a rush... I didn't see the continuation of the all the HTML in the string on the lines below...
Not sure what to tell you about your code. I have not seen it done this way. I use the following to determine if its an admin logged in vs. a registered user:
is_user( $user )
is_admin( $admin )
Just pay attention to whether you need to add the $user and $admin to a global statement. |
|
|
|
 |
srhh

|
Posted:
Tue Sep 26, 2006 12:11 pm |
|
I figured it out!
I tried it again and it worked. I don't know what happened, but after comparing the two codes, there was a "; missing after the music link.
Yay! (Gonna print it out and hang it on my fridge with a big star)
But, I've noticed, when I log out, the links that are only suppose to show for logged in members still show. No biggie, but is there a way to make it show only the anonymous users links when a member logs out? |
|
|
|
 |
montego

|
Posted:
Tue Sep 26, 2006 6:37 pm |
|
Just to be sure, are you logged out of both admin and the normal user? |
|
|
|
 |
srhh

|
Posted:
Wed Sep 27, 2006 10:56 am |
|
Yes I am logged out as both.
I have a feeling it has something to do with some kind of $cookie function.
Am I on the right track? |
|
|
|
 |
montego

|
Posted:
Wed Sep 27, 2006 5:20 pm |
|
Well, I have only used the two functions posted above and it seems to work perfectly. You may wish to switch to using those? |
|
|
|
 |
|