PDA

View Full Version : Avatar in menu


SilverDragonTears
03-28-2012, 06:13 AM
Trying to get the user's avatar to show up by placing it in the functions.php with the links. I'm failing though... any ideas?

SilverDragonTears
03-28-2012, 07:09 AM
Of course 10 minutes after I posted I figured it out... Will post if anyone is interested.

AlexC
03-28-2012, 03:44 PM
I'm interested in that - I've wanted to do that for ages. D:

you have the coolest mods.

SilverDragonTears
03-28-2012, 05:38 PM
My script is different than yours.... so I don't know the proper lines but...


$sidebar = "You have {$GLOBALS['money']} {$GLOBALS['settings']['cost']}.<br />
<a href='donate.php'>Donate money to friends</a>";


$stmt = $GLOBALS['adopts']->query("SELECT * FROM {$GLOBALS['prefix']}users_profile WHERE username='{$loggedinname}'");

while($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
$avatar=$row['avatar'];
$sidebar .= "<img src='{$row['avatar']}' border='0' width='100px' height='100px'><br><br>
<a href='index.php'>Home</a>
<a href='adopt.php'>Dragon Lair</a>
<a href='pound.php'>Abandoned Lair</a>

Lemme know if you need help. And anything else on my site you like let me know. I can try to tell you how to do it.

AlexC
03-28-2012, 05:56 PM
I'll try it soon. Gotta do some homework. xD Thank you!

(den mod, deeeeennnn moooooddddd srsly it is awesome.)

solskenn
03-31-2012, 01:12 PM
I'm still having problems getting this to work. No matter where/how I put the code in it still says something like "error on line..." and when I check that line it was a code that worked before.

This is practically the default code, with minor edits for my site. Can you help?




//This function determines what shows in the side bar of the template
$isloggedin = $GLOBALS['isloggedin'];
$loggedinname = $GLOBALS['loggedinname'];
if($isloggedin == "yes") {
$msgctr = "<a href='messages.php'>Messages</a>";

$stmt = $GLOBALS['adopts']->query("SELECT * FROM {$GLOBALS['prefix']}messages WHERE touser='{$loggedinname}' and status='unread'");
$row = $stmt->fetchAll();

if(count($row) > 0) {
$msgctr = "<a href='messages.php'>Messages <b>(".count($row).")</b></a>";
}
$sidebar = "You have {$GLOBALS['money']} {$GLOBALS['settings']['cost']}.<br />
<a href='donate.php'>Donate money to friends</a><br />
<ul>
<li><a href='logout.php'>Log Out</a></li>";

StarGirl
03-31-2012, 01:29 PM
solskenn, try this:
//This function determines what shows in the side bar of the template
$isloggedin = $GLOBALS['isloggedin'];
$loggedinname = $GLOBALS['loggedinname'];
if($isloggedin == "yes") {
$msgctr = "<a href='messages.php'>Messages</a>";

$stmt = $GLOBALS['adopts']->query("SELECT * FROM {$GLOBALS['prefix']}messages WHERE touser='{$loggedinname}' and status='unread'");
$row = $stmt->fetchAll();

if(count($row) > 0) {
$msgctr = "<a href='messages.php'>Messages <b>(".count($row).")</b></a>";
}

$getavatar = $GLOBALS['adopts']->query("SELECT * FROM {$GLOBALS['prefix']}users_profile WHERE username='{$loggedinname}'");

while($row = $getavatar->fetch(PDO::FETCH_ASSOC)) {
$avatar=$row['avatar'];

$sidebar = "<img src='{$row['avatar']}' border='0' width='100px' height='100px'><br>
You have {$GLOBALS['money']} {$GLOBALS['settings']['cost']}.<br />
<a href='donate.php'>Donate money to friends</a><br />
<ul>
<li><a href='logout.php'>Log Out</a></li>";
[Sorry, I know the question wasn't directed towards me. :P]

SilverDragonTears
03-31-2012, 03:18 PM
What version are you using of the Mys script?

solskenn
03-31-2012, 04:15 PM
v1.3 and I've only made small edits to the software (usually microscopic changes in a file).

I tried yours Stargirl and I got another "error in line.." message.

SilverDragonTears
03-31-2012, 05:23 PM
Can you post your script here so I can take a look?

solskenn
03-31-2012, 06:20 PM
the whole thing? or just the sidebar part?

SilverDragonTears
03-31-2012, 08:08 PM
Just the sidebar part will be fine.

solskenn
04-01-2012, 06:42 AM
function getsidebar() {
//This function determines what shows in the side bar of the template
$isloggedin = $GLOBALS['isloggedin'];
$loggedinname = $GLOBALS['loggedinname'];
if($isloggedin == "yes") {
$msgctr = "<a href='messages.php'>Messages</a>";

$stmt = $GLOBALS['adopts']->query("SELECT * FROM {$GLOBALS['prefix']}messages WHERE touser='{$loggedinname}' and status='unread'");
$row = $stmt->fetchAll();

if(count($row) > 0) {
$msgctr = "<a href='messages.php'>Messages <b>(".count($row).")</b></a>";
}
$sidebar = "You have {$GLOBALS['money']} {$GLOBALS['settings']['cost']}.<br />
<a href='donate.php'>Donate money to friends</a><br />
<ul>
<li><a href='logout.php'>Log Out</a></li>";

$stmt = $GLOBALS['adopts']->query("SELECT * FROM {$GLOBALS['prefix']}users WHERE username='{$loggedinname}' and usergroup='1'");
$row = $stmt->fetch(PDO::FETCH_ASSOC);

if(is_array($row)) {
$sidebar .= "<li><a href='admincp/index.php'>Admin Center</a></li><br />";
}

$stmt1 = $GLOBALS['adopts']->query("SELECT * FROM {$GLOBALS['prefix']}online WHERE username != 'Visitor'");
$row1 = $stmt1->fetchAll();
$total1 = count($row1);
$stmt2 = $GLOBALS['adopts']->query("SELECT * FROM {$GLOBALS['prefix']}online WHERE username = 'Visitor'");
$row2 = $stmt2->fetchAll();
$total2 = count($row2);
$sidebar .= "<a href='online.php'>This site has {$total1} members and {$total2} guests online.</a></ul>";
}
else {
$sidebar = "<b><u>Member Login:</u></b><br />
<form name='form1' method='post' action='login.php'>
<p>Username:
<input name='username' type='text' id='username'>
</p>
<p>Password:
<p> <input name='password' type='password' id='password'>
</p>
<p>
<input type='submit' name='Submit' value='Log In'>
</p>
</form>Don't have an account?<br /><a href='register.php'>Register Free</a><br /><a href='forgotpass.php'>Forgot Password?</a>";
$stmt1 = $GLOBALS['adopts']->query("SELECT * FROM {$GLOBALS['prefix']}online WHERE username != 'Visitor'");
$row1 = $stmt1->fetchAll();
$total1 = count($row1);
$stmt2 = $GLOBALS['adopts']->query("SELECT * FROM {$GLOBALS['prefix']}online WHERE username = 'Visitor'");
$row2 = $stmt2->fetchAll();
$total2 = count($row2);
$sidebar .= "<br />This site currently has {$total1} members and {$total2} guests.";

}
return $sidebar;
}

I'm pretty sure this is all of it..

SilverDragonTears
04-01-2012, 06:44 PM
Where do you want your avatar to show up?

solskenn
04-01-2012, 08:18 PM
At the bottom, beneath where the "online members" is currently at.

While your poking in there, could I also ask that the "online members" be moved to above the links? If you just want to stick to adding the avatar then that's fine ^,^ Just thought I'd ask while you were already looking.

AlexC
04-08-2012, 09:23 AM
I tried doing this as well - as well as the edit posted, but I'm getting the same error. D:

Alaric
04-25-2012, 08:03 AM
It shows me this when i refresh the page

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/989717/public_html/functions/functions.php on line 252