News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

How can i get user avatar from SSI?

Started by FXSubs, April 15, 2016, 04:12:52 PM

Previous topic - Next topic

FXSubs

How can i get the user avatar from SSI?
I mean, i made my own homepage wich include some SMF functions, and in this page i created a user "tooltip" where i want to show user avatar and some option.

obviously i already included the "require ('SSI.php')" part, and i already did some research and i found that using
', $context['user']['avatar']['image'], '
i can get the user avatar, BUT, im getting an error "undefined index: image"

what can i do?

Thanks in advance for all the comming help and support <3

Pipke

did you do the insert
global $context;
after the SSI call ?

To see what variables are available, create a test page with the following code and run it. This will display a huge array. Just search it for context.


<?php

require_once('./forums/SSI.php');

echo 
'<pre>'print_r($GLOBALS), '</pre>';
?>



and check this topic for more info http://www.simplemachines.org/community/index.php?topic=437964.0
"If something is wrong, fix it if you can. But train yourself not to worry: Worry never fixes anything."

Click here to view my mods for SMF

Hey 👋 Did i helped... you like what i do. You can now buy me a coffee! ☕

FXSubs

Helo, i already added this and still same, also i know $context variable is OK because i used it several times to define what to show if is guest or logged user

About ['avatar'] i see the doc with the code you wrote, his appears
[avatar] => Array
                (
                    [url] =>
                    [filename] =>
                    [custom_dir] =>
                    [id_attach] => 0
                )


Any clue how can i do this?

FXSubs

OK All done, that happened because i had my avatar empty lol, sorry for all

Advertisement: