MyBB Community Forums

Full Version: Avatar/Posts/Reputation doesn't show up in header_welcomeblock_member
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I figured out how to display avatar for a custom profile box, but it's not displaying in my header_welcomeblock_member.

Is there a specific script or code I need to include in my header/headerinclude templates to make these custom "postbit" to display?

I manage to get the avatar to display in my index template shown here.
https://gyazo.com/93b9c2b1652cc5659415c2951e35f349


Code used: <img src="{$avatar}" {$useravatar['width_height']} />

I use the exact code inside my header_welcomeblock_member page, but it's not being displayed (just an empty picture). Hopefully a MyBB pro could explain this unfortunate event.

Index Avatar HTML: https://gyazo.com/c901e1d5cc1425760592c13e1757f42f
Sidebar (Header) HTML: https://gyazo.com/ae888cc3eb9e948269fc57e2e4c8cc5f
For my custom profile box, I got the username working (woo!) by editing the global.php file and language file.
{$lang->welcome_back}

Still unable to get these commands to work inside my header_welcomeblock_member
{$useravatar['image']}" {$useravatar['width_height']}
{$memprofile['postnum']}
{$reputation}


They don't show up at all. Sad  I hope you guys can help me out, I keep getting ignored even though this is a MyBB-side issue.   

https://gyazo.com/771876903d2af6b041c9dda7e601a2ec


<div id="profile_box">
     <div id="avatar">
          <img src="{$useravatar['image']}" {$useravatar['width_height']} />
     </div>
     <div id="username">
          {$lang->welcome_back}
     </div>
     <div id="post_stats">
	  <p>Posts:</p><a href="#">{$memprofile['postnum']}</a>
     </div>
     <div id="reputation_stats">
         <p>Reputation:</p><a href="#">{$reputation}</a>
     </div>
</div>
It's not working because these values aren't available globally, they're not going to work in every single template, they have to be defined by the code, and in the place you're trying to use them, they're not defined. You'd need a plugin to load the values in before the template is rendered, then you'd be able to use them.
(2016-08-09, 05:52 PM)Matt Wrote: [ -> ]It's not working because these values aren't available globally, they're not going to work in every single template, they have to be defined by the code, and in the place you're trying to use them, they're not defined. You'd need a plugin to load the values in before the template is rendered, then you'd be able to use them.

Exactly what I needed to know. Thanks!! Moving on to plan B then. Smile
(2016-08-10, 12:13 AM)VisualizeEdits Wrote: [ -> ]
(2016-08-09, 05:52 PM)Matt Wrote: [ -> ]It's not working because these values aren't available globally, they're not going to work in every single template, they have to be defined by the code, and in the place you're trying to use them, they're not defined. You'd need a plugin to load the values in before the template is rendered, then you'd be able to use them.

Exactly what I needed to know. Thanks!! Moving on to plan B then. Smile

I am a noob about this,
can you explain to us the way how to achieve that??

Thanks
(2016-08-10, 02:31 AM)farisfath25 Wrote: [ -> ]
(2016-08-10, 12:13 AM)VisualizeEdits Wrote: [ -> ]
(2016-08-09, 05:52 PM)Matt Wrote: [ -> ]It's not working because these values aren't available globally, they're not going to work in every single template, they have to be defined by the code, and in the place you're trying to use them, they're not defined. You'd need a plugin to load the values in before the template is rendered, then you'd be able to use them.

Exactly what I needed to know. Thanks!! Moving on to plan B then. Smile

I am a noob about this,
can you explain to us the way how to achieve that??

Thanks

It's a pretty deep-core editing process which I'm sure you can do, but it will take a long time to study through the codes and understanding how each different set of codes represents each other. If I decide to look into it and play around with it, I will post my response/study and see if it might help you. Until then, my time is limited so it most likely wouldn't be for another couple of days.
The best way would be to have a plugin to hook into global_start, then just copy/refactor logic for everything you need to display, then it'll be available in the template you need.

If it's thing to do with the current logged in user, then $mybb->user will contain this which will already be available in templates, but then if you wanted things formatted etc, you'd need PHP behind it to load that in.