Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Aiheen aloitti: John. - helmikuu 25, 2014, 03:30:24 IP

Otsikko: Variables
Kirjoitti: John. - helmikuu 25, 2014, 03:30:24 IP
Hello,

I work dynamic signatures.
Now I have a variable for:
Forum name ($context['membername'] = $item_comm['lbuser']['name'];)
Posts ($context['posts'] = $item_comm['lbuser']['posts'];)
Karma ($context['karmaBad'] = $item_comm['lbuser']['karma']['bad/good'];)
sex ($context['gender'] = $item_comm['lbuser']['gender']['image'];)

How do I add to:
date of Registration
own title
Rank  with image

tnx
Otsikko: Re: Variables
Kirjoitti: IchBin™ - helmikuu 25, 2014, 08:26:54 IP
print_r($context) and print_r($user_info) are your friends. You'll likely find what you need in $user_info.
Otsikko: Re: Variables
Kirjoitti: margarett - helmikuu 27, 2014, 01:42:28 IP
Do note that $user_info isn't usually available in templates (but it can easily be globalized)
Otsikko: Re: Variables
Kirjoitti: John. - helmikuu 28, 2014, 04:59:23 AP
Problem:

For User own title:

$context['usertitle'] = $item_comm['lbuser']['usertitle'];

....

$usertitle = $context['usertitle'];

for show:

ImageString($image, 4, 20, 90, "Own Title: $usertitle", $blue);

and this not working. why?




For posts working normally.

$context['posts'] = $item_comm['lbuser']['posts'];

...

$posts = $context['posts'];

For show:
ImageString($image, 4, 20, 35, "Posts: $posts", $red);
Otsikko: Re: Variables
Kirjoitti: margarett - helmikuu 28, 2014, 08:41:01 AP
You say is not working. What exactly shows up?
Do an echo on your variables to check their values
Otsikko: Re: Variables
Kirjoitti: John. - helmikuu 28, 2014, 03:04:59 IP
Noting show.

solved
Otsikko: Re: Variables
Kirjoitti: margarett - helmikuu 28, 2014, 04:20:53 IP
So it's just the user title missing?
Otsikko: Re: Variables
Kirjoitti: John. - helmikuu 28, 2014, 05:20:21 IP
Lainaus käyttäjältä: margarett - helmikuu 28, 2014, 04:20:53 IP
So it's just the user title missing?
Yes. Maybe I wrote the wrong variable name (for user title) or what?

solved

Otsikko: Re: Variables
Kirjoitti: margarett - helmikuu 28, 2014, 05:37:30 IP
You should print_r($context['item_comms']);

After this code here:

$context['item_comms'][] = array(
    'lbuser' => $memberContext[$id_mem]
);
Otsikko: Re: Variables
Kirjoitti: John. - helmikuu 28, 2014, 05:53:08 IP
Lainaus käyttäjältä: margarett - helmikuu 28, 2014, 05:37:30 IP
You should print_r($context['item_comms']);

After this code here:

$context['item_comms'][] = array(
    'lbuser' => $memberContext[$id_mem]
);

When add this, don't show me signature.
Otsikko: Re: Variables
Kirjoitti: margarett - helmikuu 28, 2014, 05:57:09 IP
That's just a debug code, it is supposed to be removed after (but it's not supposed to stop current content from being displayed)