I am trying to write a SSI mod and I need to get the user id of the profile someone is viewing and use it in a mysql_query but I cannot figure out how to do it. From what I can tell $profile['ID_MEMBER'] should do that but how can I use it in a mysql_query?
Thanks in advance
OK, so far I have a query that works in theory but not on practise. here is my query.
global $context, $settings, $scripturl, $txt, $db_prefix, $ID_MEMBER, $user_info, $modSettings, $color_profile;
$optionsid = $profile['ID_MEMBER'];
$query = mysql_query("
SELECT `value`
FROM {$db_prefix}themes WHERE `ID_MEMBER` = '$optionsid' and `variable` = 'view'");
and also in SSI is this
//Add Colors to the Output link :)
if(!empty($colorids)) {
global $color_profile;
ssi_loadColors($colorids);
foreach($posts as $k => $p) {
$profile = $color_profile[$p['poster']['id']];
if(!empty($profile)) {
$posts[$k]['poster']['link'] = '<a href="' . $scripturl . '?action=profile;u=' . $profile['ID_MEMBER'] . '" ' . $profile['realName'] . '">' . (!empty($profile['member_group_color']) || !empty($profile['post_group_color']) ? '<font color="'. (!empty($profile['member_group_color']) ? $profile['member_group_color'] : $profile['post_group_color'] ) .'">' : '' ) . $profile['realName'] . (!empty($profile['member_group_color']) || !empty($profile['post_group_color']) ? '</font>' : '' ).'</a>';
can someone tell me what I am doing wrong? As it shows on this one above they use $profile['ID_MEMBER'] but when I use it I get nothing!!!
HELP!!!! :)
Thanks
The thing that seems to make it hard to work is the query that retrieves only one color of one member. How about something like this:
<?php
$list_of_members = array();
$colors = array();
// Get a list of all the members that have posted.
foreach ($posts as $k => $p)
$list_of_members[] = $p['poster']['id'];
// Skip the ones that occur more than once.
$list_of_members = array_unique($list_of_members);
if (!empty($list_of_members))
{
// Retrieve the colors for the posters.
$request = db_query("
SELECT ID_MEMBER, value
FROM {$db_prefix}themes
WHERE ID_THEME = 0
AND ID_MEMBER IN (" . implode(',', $list_of_members) . ")
AND variable = 'view'", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($request))
$color[$row['ID_MEMBER']] = $row['value'];
}
// Replace the links with colored links if a color is set.
foreach ($posts as $k => $p)
if (isset($color[$p['poster']['id']]))
$posts[$k]['poster']['link'] = strtr($p['poster']['link'], array('<a' => '<a style="color: ' . $color[$p['poster']['id']] . ';"'));
?>
Hi, Thanks for that, So one more thing I am looking for is how to pull the profile someone is looking for into SSI. I tried using $_REQUEST['u'] but that doesn't seem to work and profile['ID_MEMBER'] didn't either.
Any ideas?
what exactly do you mean by "the profile someone is looking for"?
Hi,
Basically when someone is viewing someone's profile at the summary page.
I am working on an SSI function that will display something when a user is viewing the summary. I need it to specifically work via SSI
It is similar to this query except it would work like but a different function:-
SELECT ID_MEMBER, value
FROM {$db_prefix}themes
WHERE ID_THEME = 0
AND ID_MEMBER = (*Member id of profile being viewed*)
AND variable = 'view'", __FILE__, __LINE__);