TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,973
  • Latest: NonStop
Stats
  • Total Posts: 196,250
  • Total Topics: 21,354
  • Online today: 626
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online

Member Name in php?

Started by Zetan, May 06, 2007, 04:37:18 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Zetan

Does anybody know what pulls the member name into the User block, or where it displays "Hello Zetan"?
I've been searching for a while now, and nothing I've tried works.

Here is how I'm trying to use it:

.php block
elseif (in_array(4, $user_info['groups']))
echo '
Text Text Text, USERNAME HERE, TEXT.
';


I want to display the member name of the person logged in, in a php block.

Thanks


ZTN

G6Cad

Have you checked the block code and snippets board Zetan ?
I think there is a block made this way already, or if it was a request  ???
I know i have read it in here some time ago though.

Also SMF have the docsection where they have a lot info on how to pull in things diffrent way to the theme or site.

Zetan

I've looked at the snippets.. I seem to get errors with the way I try, I've been looking through the doc section at SMF.
http://support.simplemachines.org/function_db/index.php

I so wanted to be clever and do it myself..
* Zetan is still a code n00ber  :uglystupid2:

Nokonium

If it is any help

// If the user is logged in, display stuff like their name, new messages, etc.
if ($context['user']['is_logged']){
echo '<span class="normaltext">', $txt['hello_member'], ' <b>', $context['user']['name'], '</b></span>';


$txt['hello_member'] = 'Hey,';

Zetan

Thanks.. it doesn't work in the middle of my echo statement.
Theres few things in the script and it works as it is, I just want to add the member name.

Some random words here, MEMBER NAME, Some more words paragraphed here.

I'm sure it does work on it's own, but it gives me this error:
Parse error: syntax error, unexpected '<' in /home/zetan/public_html/somesite/Sources/Load.php(1737) : eval()'d code(35) : eval()'d code on line 15

I've been staring at it for a few days and I'm sure it's really simple. I have to go out, I'll stare at it some more later.

Nokonium

Quoteunexpected '<'

Quite often means that you need to add before an echo' and a '; at the end.

Zetan

Thank you, I will have to fix it later .. It's Bank Hols here this weekend... Theres beer to drink with friends in the pub  :buck2:

bloc

the variable for the member name is quite easy..and the whole "hello" string goes like:

echo $txt['hello_member_ndt'] , ' ' , $context['user']['name'];

This website is proudly hosted on Crocweb Cloud Website Hosting.