Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Sign In
Not a member yet? Click here to register.

Add User Panel information to Theme Header

I'm trying to add some of the data from the user_info_panel.php file to the theme.php file for my custom theme.

When I attempt to achieve this and call:

CodeDownload  
$userdata['user_name']



Nothing appears. I assume I need to include maincore but I don't know how to include it from theme.php in my theme directory as I don't know the directory?
Put echo in front of it
Yes mate, I've echo'd it. The string is empty.
Are you logged in? Else the userdata is empty.
Yes I'm logged in, the following if statement recognises that the user is logged in...

CodeDownload  
if (iMEMBER) {



but the string

CodeDownload  
$userdata['user_name']



is empty.

Do you know how to include maincore from the theme.php file??
The maincore is already included otherwise there would be no iMEMBER constant.

I tested if i add a statement echo $userdata['user_name']; it displays my logon name.
Can you put the statement in an panel or something for testing?
It works in a panel, but I don't want it in a panel I want to be in the header so it's included on every page. Is there somewhere else I could put the code that isn't in the theme.php file?

Merged on Mar 18 2018 at 11:41:44:
Oh wow, I feel dumb.

Just had to

CodeDownload  
global $userdata;



at the beginning of the function. Doh'
You will never forget that:)
Thread Information
Replies
8 posts
Views
1,293 times
Last Post
Last updated on 1 year ago
You can view all discussion threads in this forum.
You cannot set up a bounty in this discussion thread.
You can start a new discussion thread in this forum.
You cannot reply in this discussion thread.
You cannot start on a poll in this forum.
You cannot upload attachments in this forum.
You can download attachments in this forum.
You cannot up or down-vote on the post in this discussion thread.
Users who participated in discussion: douwe_yntema, superchiefchief