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.
Not a member yet? Click here to register.
Forgot Password?

Add User Panel information to Theme Header

Asked Modified Viewed 2,362 times
S
superchiefchief
S
  • Newbie, joined since
  • Contributed 4 posts on the community forums.
  • Started 1 thread in the forums
  • Started this discussions
asked
Newbie

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:

$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?
0 replies

7 posts

D
douwe_yntema
D
  • Senior Member, joined since
  • Contributed 667 posts on the community forums.
  • Started 57 threads in the forums
  • Answered 1 question
answered
Senior Member

Put echo in front of it
0 replies
S
superchiefchief
S
  • Newbie, joined since
  • Contributed 4 posts on the community forums.
  • Started 1 thread in the forums
  • Started this discussions
answered
Newbie

Yes mate, I've echo'd it. The string is empty.
0 replies
D
douwe_yntema
D
  • Senior Member, joined since
  • Contributed 667 posts on the community forums.
  • Started 57 threads in the forums
  • Answered 1 question
answered
Senior Member

Are you logged in? Else the userdata is empty.
0 replies
S
superchiefchief
S
  • Newbie, joined since
  • Contributed 4 posts on the community forums.
  • Started 1 thread in the forums
  • Started this discussions
answered
Newbie

Yes I'm logged in, the following if statement recognises that the user is logged in...

if (iMEMBER) {


but the string

$userdata['user_name']


is empty.

Do you know how to include maincore from the theme.php file??
0 replies
D
douwe_yntema
D
  • Senior Member, joined since
  • Contributed 667 posts on the community forums.
  • Started 57 threads in the forums
  • Answered 1 question
answered
Senior Member

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?
0 replies
S
superchiefchief
S
  • Newbie, joined since
  • Contributed 4 posts on the community forums.
  • Started 1 thread in the forums
  • Started this discussions
answered
Newbie

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

global $userdata;


at the beginning of the function. Doh'
Edited by superchiefchief on 18-03-2018 12:41,
0 replies
D
douwe_yntema
D
  • Senior Member, joined since
  • Contributed 667 posts on the community forums.
  • Started 57 threads in the forums
  • Answered 1 question
answered
Senior Member

You will never forget that:)
0 replies

Labels

None yet

Statistics

  • Views 0 views
  • Posts 7 posts
  • Votes 0 votes
  • Topic users 2 members

2 participants

D
D
  • Senior Member, joined since
  • Contributed 667 posts on the community forums.
  • Started 57 threads in the forums
  • Answered 1 question
S
S
  • Newbie, joined since
  • Contributed 4 posts on the community forums.
  • Started 1 thread in the forums
  • Started this discussions

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet