News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

context user group and stuff

Started by SychO, April 16, 2016, 03:20:50 PM

Previous topic - Next topic

SychO

Hello,

i want to show the user's group in an external page using SSI, but when editing the SSI:

$context['user']['group'] or $context['user']['posts'] or $context['user']['group_stars'] ..etc doesn't work,

only $context['user']['name'] and $context['user']['avatar']['image'] and $context['user']['unread_messages'] do work

so what can i do :P to make this work, or can't I ? 

Regards.
Checkout My Themes:
-

Potato  •  Ackerman  •  SunRise  •  NightBreeze

Kindred

User user_info instead of context....

But even that won't pull the group stars or even the group name...   Only the group ID. You have to join the membergroup table
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

SychO

well, i found another way and it works fine,

i used ssi_fetchMember($context['user']['id']);

and from there i can edit that ssi to show : $query_members[$member]['group'] and other stuff

:P

Thanks You. Solved i guess
Checkout My Themes:
-

Potato  •  Ackerman  •  SunRise  •  NightBreeze

Pipke


<?php
require_once('{patch to}/SSI.php');

$request $smcFunc['db_query']('','
SELECT 
id_group, group_name 
FROM {db_prefix}membergroups'

);
while ($row $smcFunc['db_fetch_assoc']($request))
{
$group[$row['id_group']] = $row['group_name'];
}
$smcFunc['db_free_result']($request);

foreach (
$user_info['groups'] as $key => $value
{
//print user usergroups
echo '<li>'.$group[$value].'</li>';
}
?>

"If something is wrong, fix it if you can. But train yourself not to worry: Worry never fixes anything."

Click here to view my mods for SMF

Hey 👋 Did i helped... you like what i do. You can now buy me a coffee! ☕

SychO

Quote from: Pipke on April 16, 2016, 06:15:49 PM

<?php
require_once('{patch to}/SSI.php');

$request $smcFunc['db_query']('','
SELECT 
id_group, group_name 
FROM {db_prefix}membergroups'

);
while ($row $smcFunc['db_fetch_assoc']($request))
{
$group[$row['id_group']] = $row['group_name'];
}
$smcFunc['db_free_result']($request);

foreach (
$user_info['groups'] as $key => $value
{
//print user usergroups
echo '<li>'.$group[$value].'</li>';
}
?>



Thank you mate !  :)
Checkout My Themes:
-

Potato  •  Ackerman  •  SunRise  •  NightBreeze

Advertisement: