Mysidia Adoptables Support Forum

Mysidia Adoptables Support Forum (http://www.mysidiaadoptables.com/forum/index.php)
-   Questions and Supports (http://www.mysidiaadoptables.com/forum/forumdisplay.php?f=18)
-   -   Link questions (http://www.mysidiaadoptables.com/forum/showthread.php?t=919)

FBFKids 06-06-2009 03:41 PM

Link questions
 
Is it possible to put a link on the menu only visible to admins?

Such as a link to the administration area.

Seapyramid 06-06-2009 03:47 PM

RE: Link questions
 
Users you are not authorized to access the admin area with get an error if they click on the admin link so it really can be placed anywhere

Bloodrun 06-06-2009 03:59 PM

RE: Link questions
 
Yes there is go to your functions.php page and in your sidebar function place this(right before the $sidebar = "):

PHP Code:

$group getgroup();
$cancp cancp($group);

if(
$cancp == "yes"){
$admin "<a href='admin.php'><b>ACP</b></a><br>";
}
else{
$admin "";


Then within the &sidebar = ", place this:

PHP Code:

".$admin." 

Hope I answered your question.

FBFKids 06-06-2009 04:22 PM

RE: Link questions
 
@ Seapyramid. I know they can't access it, and that's not the issue, I'd just like that button to not even be there for them, as it might lead to confusion.

@Bloodrun. That gave me the white screen of death. :/

PHP Code:

$group getgroup();
$cancp cancp($group);

if(
$cancp == "yes"){
$admin "<a href='admin.php'><b>ACP</b></a><br>";
}
else{
$admin "";


$sidebar "<b><u>".$loggedinname."'s Links:</u></b><br><br>
<a href='adopt.php'>Adopt Some Pets</a><br>
<a href='myadopts.php'>Manage Adoptables</a><br>
<a href='account.php'>Go to My Account</a><br>
"
.$msgctr."
<a href='logout.php'>Log Out</a>"
;
".$admin." 



Is this right?

Bloodrun 06-06-2009 04:31 PM

RE: Link questions
 
Quote:

Originally Posted by FBFKids
@ Seapyramid. I know they can't access it, and that's not the issue, I'd just like that button to not even be there for them, as it might lead to confusion.

@Bloodrun. That gave me the white screen of death. :/

PHP Code:

$group getgroup();
$cancp cancp($group);

if(
$cancp == "yes"){
$admin "<a href='admin.php'><b>ACP</b></a><br>";
}
else{
$admin "";


$sidebar "<b><u>".$loggedinname."'s Links:</u></b><br><br>
<a href='adopt.php'>Adopt Some Pets</a><br>
<a href='myadopts.php'>Manage Adoptables</a><br>
<a href='account.php'>Go to My Account</a><br>
"
.$msgctr."
<a href='logout.php'>Log Out</a>"
;
".$admin." 



Is this right?


You didn't end the &sidebar correctly

the ".$admin." goes within the ($sidebar = " ";)

FBFKids 06-06-2009 04:55 PM

RE: Link questions
 
So $sidebar = "<b><u>$admin."

???

Bloodrun 06-06-2009 05:01 PM

RE: Link questions
 
Quote:

Originally Posted by FBFKids
So $sidebar = "<b><u>$admin."

???

Use this:

PHP Code:

$group getgroup();
$cancp cancp($group);

if(
$cancp == "yes"){
$admin "<a href='admin.php'><b>ACP</b></a><br>";
}
else{
$admin "";


$sidebar "<b><u>".$loggedinname."'s Links:</u></b><br><br>
<a href='adopt.php'>Adopt Some Pets</a><br>
<a href='myadopts.php'>Manage Adoptables</a><br>
<a href='account.php'>Go to My Account</a><br>
"
.$msgctr."
<a href='logout.php'>Log Out</a>
"
.$admin."";




FBFKids 06-06-2009 05:13 PM

RE: Link questions
 
Thank you, works great now.

Bloodrun 06-06-2009 05:15 PM

RE: Link questions
 
Quote:

Originally Posted by FBFKids
Thank you, works great now.

Your welcome. =D

arlecchina 07-18-2009 12:21 AM

RE: Link questions
 
I searched the Forums and this was the most relevant topic I could find so I am posting this here.

I am trying to create links in the links bar that are only visible to users when logged in.

First I commented out this so that it wouldn't pull links from the database.
PHP Code:

/*
$links = "";

    $query = "SELECT * FROM ".$prefix."links ORDER BY id ASC";
    $result = mysql_query($query);
    $num = mysql_numrows($result);

    //Loop out code
    $i=0;
    while ($i < $num) {

    $linktext=@mysql_result($result,$i,"linktext");
    $linkurl=@mysql_result($result,$i,"linkurl");

    $linktext = stripslashes($linktext);

    $links = $links."<li><a href='".$linkurl."'>".$linktext."</a></li>";

    $i++;
    }
*/ 

Then I added this after right before $links:
PHP Code:

if($isloggedin == "yes"){
    
$royallinks "
        <li><a href='pages.php?page=royals'>My Royals</a>
        <ul>
            <li><a href='adopt.php'>Adopt a Royal</a></li>
            <li><a href='myadopts.php'>Care for Royals</a></li>
            <li><a href='promo.php'>Rare Royals</a></li>
        </ul>
        </li>
    "
;
}

else{
    
$royallinks "";


if(
$isloggedin == "yes"){
        
$accountlinks "
        <li><a href='account.php'>Account</a>
        <ul>
            <li><a href='profile.php?user="
.$username."'>View Profile</a></li>
            <li><a href='account.php?act=changeemail'>Change Email</a></li>
            <li><a href='account.php?act=changepass'>Change Password</a></li>
            <li><a href='forgotpass.php'>Reset Password</a></li>
            <li><a href='account.php?act=changesettings'>Settings</a></li>
        </ul>
        </li>"
;
}

else{
    
$accountlinks "";
}

if(
$isloggedin == "yes"){
    
$pmlinks ="
        <li><a href='messages.php'>Inbox</a></li>
        <li><a href='messages.php?act=send'>Compose Message</a></li>"
;
}

else{
    
$pmlinks ="";


Then I added all my menu links (I am using a drop-down menu which is working fine):
PHP Code:

$links "<ul id='nav' class='dropdown dropdown-horizontal'>
    <li><a href='index.php'>Home</a></li>

    <li><a href='pages.php?page=about'>About</a>
    <ul>
        <li><a href='pages.php?page=stages'>Stages</a></li>
        <li><a href='pages.php?page=predators'>Predators</a></li>
        <li><a href='pages.php?page=npcs'>NPCs</a></li>
        <li><a href='pages.php?page=environment'>Environment</a></li>
        <li><a href='pages.php?page=occupations'>Occupations</a></li>
    </ul>
    </li>

    "
.$royallinks."
    "
.$accountlinks."
    <li><a href='pages.php?page=communication'>Communication</a>
    <ul>
        <li><a href='site_news.php'>Announcements</a></li>
    "
.$pmlinks."
        <li><a href='stats.php'>Form Alliances</a></li>
        <li><a href='profile.php?user='>Members</a></li>
    </ul>
    </li>

    <li><a href='pages.php?page=premium'>Premium Members</a>
    <ul>
        <li><a href='pages.php?page=donate'>Premium Royals</a></li>
        <li><a href='pages.php?page=custom'>Custom Royals</a></li>
        <li><a href='pages.php?page=sponsor'>Become a Sponsor</a></li>
    </ul>
    </li>

    <li><a href='pages.php?page=help'>Help</a>
    <ul>
        <li><a href='pages.php?page=faq'>FAQ</a></li>
        <li><a href='pages.php?page=rules'>Rules & Guidelines</a></li>
        <li><a href='tos.php'>Terms of Service</a></li>
        <li><a href='pages.php?page=privacy'>Privacy Policy</a></li>
        <li><a href='pages.php?page=safety'>Safety Tips</a></li>
        <li><a href='pages.php?page=parents'>Info for Parents</a></li>
        <li><a href='contactus.php'>Contact Us</a></li>
    </ul>
    </li>
</ul>"


What is NOT working is that even when LOGGED IN the user-only links are still NOT visible. What am I doing wrong? Please advise. Thank you!


All times are GMT -5. The time now is 07:31 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.