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

Recent

Welcome to TinyPortal. Please login or sign up.

Members
Stats
  • Total Posts: 196,026
  • Total Topics: 21,333
  • Online today: 519
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 155
  • Total: 155

Scripting Help...

Started by Xarcell, June 18, 2007, 08:57:55 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Xarcell

I was wondering is there a way to write descriptions, that vary from membergroup to membergroup?

For example:

You see:
Description A

IF in secondary membergroup you see
Discription B instead.

Any help on this?

IchBin

Are you talking in a php block or something?
I know the $user_info array holds the membergroup info.
Something like:
global $user_info;

if($user_info['groups'] == 1)
echo ' this to who is in group 1';

You could do additional checks for different group numbers. You looking for something more specific?

Xarcell

I tried it and it didn't seem to work.

Basically in a php block, I have a "room description". However, if a person is of a certain membergroup, I would like the description to appear differently.

IchBin

May have to check the array for the number. Try something like this. Dont' forget to keep the global line. :)

if (in_array(1, $userinfo['groups'])
echo 'stuff here for group 1';

Xarcell

I get an error:

QuoteParse error: syntax error, unexpected T_ECHO in /home/.abigaildryer/xarcell/feyorin.com/smf/Sources/Load.php(1741) : eval()'d code(10) : eval()'d code on line 7

Xarcell

Here is an exact example of what I'm doing:

global $user_info;

if (in_array(1, $userinfo['groups'])
echo 'you can't see';

if (in_array(9, $userinfo['groups'])
echo 'you can see just fine';

echo '
Obvious exits: Too Dark...<br />
Everyone here: ';

if (!empty($settings['display_who_viewing']))
{
if ($settings['display_who_viewing'] == 1)
echo count($context['view_members']), ' ', count($context['view_members']) == 1 ? $txt['who_member'] : $txt[19];
else
echo empty($context['view_members_list']) ? '0 ' . $txt[19] : implode(', ', $context['view_members_list']) . ((empty($context['view_num_hidden']) or $context['can_moderate_forum']) ? '' : ' (+ ' . $context['view_num_hidden'] . ' ' . $txt['hidden'] . ')');
echo $txt['who_and'], $context['view_num_guests'], ' ', $context['view_num_guests'] == 1 ? $txt['adventurer'] : $txt['adventurers'], $txt['who_viewing_board_adventurer'], '';
}

IchBin

Oops! Forgot the closing parenthesis.
Try this:
global $user_info;

if (in_array(1, $userinfo['groups']))
echo 'you can't see';

if (in_array(9, $userinfo['groups'])
echo 'you can see just fine';

echo '
Obvious exits: Too Dark...<br />
Everyone here: ';

if (!empty($settings['display_who_viewing']))
{
if ($settings['display_who_viewing'] == 1)
echo count($context['view_members']), ' ', count($context['view_members']) == 1 ? $txt['who_member'] : $txt[19];
else
echo empty($context['view_members_list']) ? '0 ' . $txt[19] : implode(', ', $context['view_members_list']) . ((empty($context['view_num_hidden']) or $context['can_moderate_forum']) ? '' : ' (+ ' . $context['view_num_hidden'] . ' ' . $txt['hidden'] . ')');
echo $txt['who_and'], $context['view_num_guests'], ' ', $context['view_num_guests'] == 1 ? $txt['adventurer'] : $txt['adventurers'], $txt['who_viewing_board_adventurer'], '';
}

Xarcell

Nope, I get this error:

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/.abigaildryer/xarcell/feyorin.com/smf/Sources/Load.php(1741) : eval()'d code(10) : eval()'d code on line 4

Xarcell

I tried this:

global $user_info;

if (in_array(1, $userinfo['groups']))
echo 'you can\'t see';

if (in_array(9, $userinfo['groups'])
echo 'you can see just fine';

echo '
Obvious exits: Too Dark...<br />
Everyone here: ';

if (!empty($settings['display_who_viewing']))
{
if ($settings['display_who_viewing'] == 1)
echo count($context['view_members']), ' ', count($context['view_members']) == 1 ? $txt['who_member'] : $txt[19];
else
echo empty($context['view_members_list']) ? '0 ' . $txt[19] : implode(', ', $context['view_members_list']) . ((empty($context['view_num_hidden']) or $context['can_moderate_forum']) ? '' : ' (+ ' . $context['view_num_hidden'] . ' ' . $txt['hidden'] . ')');
echo $txt['who_and'], $context['view_num_guests'], ' ', $context['view_num_guests'] == 1 ? $txt['adventurer'] : $txt['adventurers'], $txt['who_viewing_board_adventurer'], '';
}


and get this error:

Parse error: syntax error, unexpected T_ECHO in /home/.abigaildryer/xarcell/feyorin.com/smf/Sources/Load.php(1741) : eval()'d code(10) : eval()'d code on line 7

G6Cad


This website is proudly hosted on Crocweb Cloud Website Hosting.