TinyPortal

Development => Block Codes => Topic started by: rebelrose on September 13, 2006, 11:55:32 PM

Title: Add a group to this code
Post by: rebelrose on September 13, 2006, 11:55:32 PM
How would I make this show more than one group?


global $txt, $scripturl, $user_info;
global $context, $modSettings, $ID_MEMBER;
global $board_info, $settings, $db_prefix;

$groupnumber = 1;
$loaded_ids = array();
    $user_profile=array();
    $memberContext=array();
    $profile=array();
    $context['TPortal']['team']=array();

$select_columns = "
IFNULL(lo.logTime, 0) AS isOnline, IFNULL(a.ID_ATTACH, 0) AS ID_ATTACH, a.filename, a.attachmentType,
mem.personalText, mem.avatar, mem.ID_MEMBER, mem.memberName,
mem.realName,mem.lastLogin, mem.websiteTitle, mem.websiteUrl, mem.location,   
                        mem.posts,
                        them.value AS teamtext";
$select_tables = "
LEFT JOIN {$db_prefix}log_online AS lo ON (lo.ID_MEMBER = mem.ID_MEMBER)
LEFT JOIN {$db_prefix}attachments AS a ON (a.ID_MEMBER = mem.ID_MEMBER)
                        LEFT JOIN {$db_prefix}themes AS them ON (mem.ID_MEMBER = them.ID_MEMBER AND them.variable = 'teamtext' AND them.ID_THEME=1)";

// Load the member's data.
$request = db_query("
SELECT$select_columns
FROM {$db_prefix}members AS mem$select_tables
WHERE mem.ID_GROUP = $groupnumber
                        OR mem.ID_GROUP = 1 ORDER BY mem.memberName ASC", __FILE__, __LINE__);
$new_loaded_ids = array();
while ($row = mysql_fetch_assoc($request))
{

$avatar_width = '';
$avatar_height = '';

$context['TPortal']['team'][] = array(
'username' => $row['memberName'],
'name' => $row['realName'],
'posts' => $row['posts'],
'location' => $row['location'],
'href' => $scripturl . '?action=profile;u=' . $row['ID_MEMBER'],
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '" title="' . $txt[92] . ' ' . $row['realName'] . '">' . $row['realName'] . '</a>',
'blurb' => $row['personalText'],
'avatar' => array(
'name' => $row['avatar'],
'image' => $row['avatar'] == '' ? ($row['ID_ATTACH'] > 0 ? '<img  src="' . (empty($row['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $row['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) . '" alt="" class="avatar2" border="0" />' : '') : (stristr($row['avatar'], 'http://') ? '<img src="' . $row['avatar'] . '"' . $avatar_width . $avatar_height . ' alt="" class="avatar2" border="0" />' : '<img src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($row['avatar']) . '" alt="" class="avatar2" border="0" />'),
'href' => $row['avatar'] == '' ? ($row['ID_ATTACH'] > 0 ? (empty($row['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $row['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) : '') : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar']),
'url' => $row['avatar'] == '' ? '' : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar'])
),
'last_login' => empty($row['lastLogin']) ? $txt['never'] : timeformat($row['lastLogin']),
'last_login_timestamp' => empty($row['lastLogin']) ? 0 : forum_time(0, $row['lastLogin']),
'website' => array(
'title' => $row['websiteTitle'],
'url' => $row['websiteUrl']),
'online' => array(
'is_online' => $row['isOnline'],
'text' => &$txt[$row['isOnline'] ? 'online2' : 'online3'],
'image_href' => $settings['images_url'] . '/' . ($row['isOnline'] ? 'useron' : 'useroff') . '.gif',
),
'teamtext' => $row['teamtext'],
);


}
mysql_free_result($request);



        echo '<table align="center" width="95%" cellpadding="0" cellspacing="0"><tr>
                 <td colspan="4" style="border-bottom: 2px solid #d0d0d0; padding-bottom: 4px; "><h2>Meet the team!</h2>
<span class="smalltext">The people you will run into while visiting rebelrosenetworks.com</span><br /><br />
</td></tr><tr><td colspan="4"><br /> </td></tr><tr>';
        $newrow=0;
foreach($context['TPortal']['team'] as $team)
        {
            echo '
<td valign="top">'.$team['avatar']['image'].'</td>
<td valign="top" width="50%" class="middletext" style="padding: 5px;">
<h2 style="margin-top: 0; margin-bottom: 6px;">'.$team['link'].'</h2>
<b>Last seen</b>: '.$team['last_login'].'<br />
<b>Posts</b>: '.$team['posts'].'<br />
' , !empty($team['location']) ? '<b>Location</b>: '.$team['location'].'<br />' : '' , '
' , !empty($team['website']['title']) ? '<b>Website</b>: <a href="'.$team['website']['url'].'" target="_blank">'.$team['website']['title'].'</a><br />' : '' , '
' ,  $team['online']['is_online'] ? '<img src="'.$team['online']['image_href'].'" alt="" /> '.$team['online']['text'].'<br />' : $team['online']['text'].'<br />' , '

' , !empty($team['blurb']) ? '<i>- '.$team['blurb'].'</i><br />' : '' , '

' ,  !empty($team['teamtext']) ? $team['teamtext'].'<br />' : '' , '

    </div></td>';
            $newrow++;
            if($newrow>1){
               $newrow=0;
               echo '</tr><tr><td colspan="4"><br /><br /> </td></tr><tr>';
            }
        }
echo '</tr></table>';

Title: Re: Add a group to this code
Post by: akulion on September 14, 2006, 12:02:43 AM
im just hazzarding a guess here

but have u tried    $groupnumber = 1,2,3,etc;

like that?
Title: Re: Add a group to this code
Post by: rebelrose on September 14, 2006, 12:04:24 AM
yes it does not work like that
Title: Re: Add a group to this code
Post by: jacortina on September 14, 2006, 12:07:47 AM
A little more info?

More than one group at the same time or one group followed by another group?

Are you interested in checking only the primary group?
Title: Re: Add a group to this code
Post by: rebelrose on September 14, 2006, 12:09:06 AM
One group followed by another,

admin,
Global
and so on

4 groups
Title: Re: Add a group to this code
Post by: jacortina on September 14, 2006, 12:14:37 AM
Try:


global $txt, $scripturl, $user_info;
global $context, $modSettings, $ID_MEMBER;
global $board_info, $settings, $db_prefix;

//////////////////////////////////////////////////////////////// List of group numbers here
$groups_list = array(12, 11, 9, 10, 25);
////////////////////////////////////////////////////////////////

foreach($groups_list as $groupnumber)
{

$loaded_ids = array();
    $user_profile=array();
    $memberContext=array();
    $profile=array();
    $context['TPortal']['team']=array();

$select_columns = "
IFNULL(lo.logTime, 0) AS isOnline, IFNULL(a.ID_ATTACH, 0) AS ID_ATTACH, a.filename, a.attachmentType,
mem.personalText, mem.avatar, mem.ID_MEMBER, mem.memberName,
mem.realName,mem.lastLogin, mem.websiteTitle, mem.websiteUrl, mem.location,   
                        mem.posts,
                        them.value AS teamtext";
$select_tables = "
LEFT JOIN {$db_prefix}log_online AS lo ON (lo.ID_MEMBER = mem.ID_MEMBER)
LEFT JOIN {$db_prefix}attachments AS a ON (a.ID_MEMBER = mem.ID_MEMBER)
                        LEFT JOIN {$db_prefix}themes AS them ON (mem.ID_MEMBER = them.ID_MEMBER AND them.variable = 'teamtext' AND them.ID_THEME=1)";

// Load the member's data.
$request = db_query("
SELECT$select_columns
FROM {$db_prefix}members AS mem$select_tables
WHERE mem.ID_GROUP = $groupnumber
                        OR mem.ID_GROUP = 1 ORDER BY mem.memberName ASC", __FILE__, __LINE__);
$new_loaded_ids = array();
while ($row = mysql_fetch_assoc($request))
{

$avatar_width = '';
$avatar_height = '';

$context['TPortal']['team'][] = array(
'username' => $row['memberName'],
'name' => $row['realName'],
'posts' => $row['posts'],
'location' => $row['location'],
'href' => $scripturl . '?action=profile;u=' . $row['ID_MEMBER'],
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '" title="' . $txt[92] . ' ' . $row['realName'] . '">' . $row['realName'] . '</a>',
'blurb' => $row['personalText'],
'avatar' => array(
'name' => $row['avatar'],
'image' => $row['avatar'] == '' ? ($row['ID_ATTACH'] > 0 ? '<img  src="' . (empty($row['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $row['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) . '" alt="" class="avatar2" border="0" />' : '') : (stristr($row['avatar'], 'http://') ? '<img src="' . $row['avatar'] . '"' . $avatar_width . $avatar_height . ' alt="" class="avatar2" border="0" />' : '<img src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($row['avatar']) . '" alt="" class="avatar2" border="0" />'),
'href' => $row['avatar'] == '' ? ($row['ID_ATTACH'] > 0 ? (empty($row['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $row['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) : '') : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar']),
'url' => $row['avatar'] == '' ? '' : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar'])
),
'last_login' => empty($row['lastLogin']) ? $txt['never'] : timeformat($row['lastLogin']),
'last_login_timestamp' => empty($row['lastLogin']) ? 0 : forum_time(0, $row['lastLogin']),
'website' => array(
'title' => $row['websiteTitle'],
'url' => $row['websiteUrl']),
'online' => array(
'is_online' => $row['isOnline'],
'text' => &$txt[$row['isOnline'] ? 'online2' : 'online3'],
'image_href' => $settings['images_url'] . '/' . ($row['isOnline'] ? 'useron' : 'useroff') . '.gif',
),
'teamtext' => $row['teamtext'],
);


}
mysql_free_result($request);



        echo '<table align="center" width="95%" cellpadding="0" cellspacing="0"><tr>
                 <td colspan="4" style="border-bottom: 2px solid #d0d0d0; padding-bottom: 4px; "><h2>Meet the team!</h2>
<span class="smalltext">The people you will run into while visiting rebelrosenetworks.com</span><br /><br />
</td></tr><tr><td colspan="4"><br /> </td></tr><tr>';
        $newrow=0;
foreach($context['TPortal']['team'] as $team)
        {
            echo '
<td valign="top">'.$team['avatar']['image'].'</td>
<td valign="top" width="50%" class="middletext" style="padding: 5px;">
<h2 style="margin-top: 0; margin-bottom: 6px;">'.$team['link'].'</h2>
<b>Last seen</b>: '.$team['last_login'].'<br />
<b>Posts</b>: '.$team['posts'].'<br />
' , !empty($team['location']) ? '<b>Location</b>: '.$team['location'].'<br />' : '' , '
' , !empty($team['website']['title']) ? '<b>Website</b>: <a href="'.$team['website']['url'].'" target="_blank">'.$team['website']['title'].'</a><br />' : '' , '
' ,  $team['online']['is_online'] ? '<img src="'.$team['online']['image_href'].'" alt="" /> '.$team['online']['text'].'<br />' : $team['online']['text'].'<br />' , '

' , !empty($team['blurb']) ? '<i>- '.$team['blurb'].'</i><br />' : '' , '

' ,  !empty($team['teamtext']) ? $team['teamtext'].'<br />' : '' , '

    </div></td>';
            $newrow++;
            if($newrow>1){
               $newrow=0;
               echo '</tr><tr><td colspan="4"><br /><br /> </td></tr><tr>';
            }
        }
echo '</tr></table>'
}


Main code is the same as yours, so only based on Primary Group.
Title: Re: Add a group to this code
Post by: rebelrose on September 14, 2006, 12:19:03 AM
Parse error: syntax error, unexpected $end, expecting ',' or ';' in xxxxxxxxxx/Sources/Load.php(1708) : eval()'d code(225) : eval()'d code on line 104
Title: Re: Add a group to this code
Post by: jacortina on September 14, 2006, 12:24:22 AM
Yeah, sorry.

I dropped the ';' from the last echo line:

echo '</tr></table>'
   should be
echo '</tr></table>';
Title: Re: Add a group to this code
Post by: rebelrose on September 14, 2006, 12:27:58 AM
Oh that is so close, but it list the admins a few times in each group
Title: Re: Add a group to this code
Post by: jacortina on September 14, 2006, 12:32:12 AM
Yeah, the Admin check is hard-coded. has to be taken out.

Change:
// Load the member's data.
$request = db_query("
SELECT$select_columns
FROM {$db_prefix}members AS mem$select_tables
WHERE mem.ID_GROUP = $groupnumber
                        OR mem.ID_GROUP = 1 ORDER BY mem.memberName ASC", __FILE__, __LINE__);


To:
// Load the member's data.
$request = db_query("
SELECT$select_columns
FROM {$db_prefix}members AS mem$select_tables
WHERE mem.ID_GROUP = $groupnumber
                        ORDER BY mem.memberName ASC", __FILE__, __LINE__);
Title: Re: Add a group to this code
Post by: rebelrose on September 14, 2006, 12:36:33 AM
That is almost perfect, I have to take out the wording and work it out, it shows more than once.
Title: Re: Add a group to this code
Post by: rebelrose on September 14, 2006, 12:40:02 AM
is there a way to show the position of the member as well, I do so much appreciate your help
Title: Re: Add a group to this code
Post by: jacortina on September 14, 2006, 12:42:30 AM
Right. You have the heading embedded in the table so it
repeats for each group at the top of the group's table.

And, again, this won't pick up members of groups where
the membership is one of their secondary groups.

Position? You mean Group name or...?
Title: Re: Add a group to this code
Post by: rebelrose on September 14, 2006, 12:43:30 AM
Yes Group Name
Title: Re: Add a group to this code
Post by: jacortina on September 14, 2006, 12:56:40 AM
OK. Another shot (moved the page title up and added 'subtitles' for group names). Remember to put your group number in:

global $txt, $scripturl, $user_info;
global $context, $modSettings, $ID_MEMBER;
global $board_info, $settings, $db_prefix;

/////////////////////////////////////////////////////////////////  Enter the desired groups in order of Appearance
$groups_list = array(12, 11, 9, 10, 25);
/////////////////////////////////////////////////////////////////

        echo '<table align="center" width="95%" cellpadding="0" cellspacing="0"><tr>
                <td style="border-bottom: 2px solid #d0d0d0; padding-bottom: 4px; "><h2>Meet the team!</h2>
<span class="smalltext">The people you will run into while visiting rebelrosenetworks.com</span><br /><br />
</td></tr></table>';



foreach($groups_list as $groupnumber)
{

$loaded_ids = array();
    $user_profile=array();
    $memberContext=array();
    $profile=array();
    $context['TPortal']['team']=array();

// get the name of the group
$request = db_query("
                        SELECT groupName FROM {$db_prefix}membergroups WHERE ID_GROUP=$groupnumber", __FILE__, __LINE__);
if(mysql_num_rows($request)>0){
$row = mysql_fetch_row($request);
$groupname=$row[0];
mysql_free_result($request);
}


$select_columns = "
IFNULL(lo.logTime, 0) AS isOnline, IFNULL(a.ID_ATTACH, 0) AS ID_ATTACH, a.filename, a.attachmentType,
mem.personalText, mem.avatar, mem.ID_MEMBER, mem.memberName,
mem.realName,mem.lastLogin, mem.websiteTitle, mem.websiteUrl, mem.location,   
                        mem.posts,
                        them.value AS teamtext";
$select_tables = "
LEFT JOIN {$db_prefix}log_online AS lo ON (lo.ID_MEMBER = mem.ID_MEMBER)
LEFT JOIN {$db_prefix}attachments AS a ON (a.ID_MEMBER = mem.ID_MEMBER)
                        LEFT JOIN {$db_prefix}themes AS them ON (mem.ID_MEMBER = them.ID_MEMBER AND them.variable = 'teamtext' AND them.ID_THEME=1)";

// Load the member's data.
$request = db_query("
SELECT$select_columns
FROM {$db_prefix}members AS mem$select_tables
WHERE mem.ID_GROUP = $groupnumber
                        ORDER BY mem.memberName ASC", __FILE__, __LINE__);
$new_loaded_ids = array();
while ($row = mysql_fetch_assoc($request))
{

$avatar_width = '';
$avatar_height = '';

$context['TPortal']['team'][] = array(
'username' => $row['memberName'],
'name' => $row['realName'],
'groupname' => $groupname,
'posts' => $row['posts'],
'location' => $row['location'],
'href' => $scripturl . '?action=profile;u=' . $row['ID_MEMBER'],
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '" title="' . $txt[92] . ' ' . $row['realName'] . '">' . $row['realName'] . '</a>',
'blurb' => $row['personalText'],
'avatar' => array(
'name' => $row['avatar'],
'image' => $row['avatar'] == '' ? ($row['ID_ATTACH'] > 0 ? '<img  src="' . (empty($row['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $row['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) . '" alt="" class="avatar2" border="0" />' : '') : (stristr($row['avatar'], 'http://') ? '<img src="' . $row['avatar'] . '"' . $avatar_width . $avatar_height . ' alt="" class="avatar2" border="0" />' : '<img src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($row['avatar']) . '" alt="" class="avatar2" border="0" />'),
'href' => $row['avatar'] == '' ? ($row['ID_ATTACH'] > 0 ? (empty($row['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $row['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) : '') : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar']),
'url' => $row['avatar'] == '' ? '' : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar'])
),
'last_login' => empty($row['lastLogin']) ? $txt['never'] : timeformat($row['lastLogin']),
'last_login_timestamp' => empty($row['lastLogin']) ? 0 : forum_time(0, $row['lastLogin']),
'website' => array(
'title' => $row['websiteTitle'],
'url' => $row['websiteUrl']),
'online' => array(
'is_online' => $row['isOnline'],
'text' => &$txt[$row['isOnline'] ? 'online2' : 'online3'],
'image_href' => $settings['images_url'] . '/' . ($row['isOnline'] ? 'useron' : 'useroff') . '.gif',
),
'teamtext' => $row['teamtext'],
);


}
mysql_free_result($request);





echo '<table align="center" width="95%" cellpadding="5" cellspacing="5"><tr>
<td colspan="4" style="border-bottom: 2px solid #d0d0d0; padding-bottom: 4px; "><h2>' . $groupname . '</h2>
</td></tr><tr><td colspan="4"><br /> </td></tr><tr>';


        $newrow=0;
foreach($context['TPortal']['team'] as $team)
        {
            echo '
<td valign="top">'.$team['avatar']['image'].'</td>
<td valign="top" width="50%" class="middletext" style="padding: 5px;">
<h2 style="margin-top: 0; margin-bottom: 6px;">'.$team['link'].'</h2>
<b>Last seen</b>: '.$team['last_login'].'<br />
<b>Posts</b>: '.$team['posts'].'<br />
' , !empty($team['location']) ? '<b>Location</b>: '.$team['location'].'<br />' : '' , '
' , !empty($team['website']['title']) ? '<b>Website</b>: <a href="'.$team['website']['url'].'" target="_blank">'.$team['website']['title'].'</a><br />' : '' , '
' ,  $team['online']['is_online'] ? '<img src="'.$team['online']['image_href'].'" alt="" /> '.$team['online']['text'].'<br />' : $team['online']['text'].'<br />' , '

' , !empty($team['blurb']) ? '<i>- '.$team['blurb'].'</i><br />' : '' , '

' ,  !empty($team['teamtext']) ? $team['teamtext'].'<br />' : '' , '

    </div></td>';
            $newrow++;
            if($newrow>1){
               $newrow=0;
               echo '</tr><tr><td colspan="4"><br /><br /> </td></tr><tr>';
            }
        }
echo '</tr></table>';
}
Title: Re: Add a group to this code
Post by: rebelrose on September 14, 2006, 12:59:27 AM
Perfect, thank you so much for your help.
Title: Re: Add a group to this code
Post by: pvcblue on September 25, 2006, 08:08:28 PM
OK this worked perfectly, now another question maybe someone knows the answer and code for -  I want something just like this with a link to a board that will be done on each team member in the member info lines. Any ideas??  :uglystupid2:

Title: Re: Add a group to this code
Post by: jacortina on September 25, 2006, 08:45:07 PM
Just to make sure I know what you're seeking, each team member is going to have a full board to which you want a link included in their entry.

i.e. URL ending with index.php?board=##.0

Title: Re: Add a group to this code
Post by: pvcblue on September 25, 2006, 10:32:05 PM
Quote from: jacortina on September 25, 2006, 08:45:07 PM
Just to make sure I know what you're seeking, each team member is going to have a full board to which you want a link included in their entry.

i.e. URL ending with index.php?board=##.0



Yes that is what I am saying!! YEA!! :)
Title: Re: Add a group to this code
Post by: jacortina on September 25, 2006, 10:58:14 PM
Well, 'enhancing' the code listed earlier, you could try this:

global $txt, $scripturl, $user_info;
global $context, $modSettings, $ID_MEMBER;
global $board_info, $settings, $db_prefix;

///////////////////
//
// Format - $member_boards['<member userid #>'] = '<forum board #>';
//
$member_boards = array();
$member_boards['101'] = '27';
$member_boards['152'] = '29';


/////////////////////////////////////////////////////////////////  Enter the desired groups in order of Appearance
$groups_list = array(12, 11, 9, 10, 25);
/////////////////////////////////////////////////////////////////

        echo '<table align="center" width="95%" cellpadding="0" cellspacing="0"><tr>
                <td style="border-bottom: 2px solid #d0d0d0; padding-bottom: 4px; "><h2>Meet the team!</h2>
<span class="smalltext">The people you will run into while visiting rebelrosenetworks.com</span><br /><br />
</td></tr></table>';


foreach($groups_list as $groupnumber)
{

$loaded_ids = array();
    $user_profile=array();
    $memberContext=array();
    $profile=array();
    $context['TPortal']['team']=array();

// get the name of the group
$request = db_query("
                        SELECT groupName FROM {$db_prefix}membergroups WHERE ID_GROUP=$groupnumber", __FILE__, __LINE__);
if(mysql_num_rows($request)>0){
$row = mysql_fetch_row($request);
$groupname=$row[0];
mysql_free_result($request);
}


$select_columns = "
IFNULL(lo.logTime, 0) AS isOnline, IFNULL(a.ID_ATTACH, 0) AS ID_ATTACH, a.filename, a.attachmentType,
mem.personalText, mem.avatar, mem.ID_MEMBER, mem.memberName,
mem.realName,mem.lastLogin, mem.websiteTitle, mem.websiteUrl, mem.location,   
                        mem.posts,
                        them.value AS teamtext";
$select_tables = "
LEFT JOIN {$db_prefix}log_online AS lo ON (lo.ID_MEMBER = mem.ID_MEMBER)
LEFT JOIN {$db_prefix}attachments AS a ON (a.ID_MEMBER = mem.ID_MEMBER)
                        LEFT JOIN {$db_prefix}themes AS them ON (mem.ID_MEMBER = them.ID_MEMBER AND them.variable = 'teamtext' AND them.ID_THEME=1)";

// Load the member's data.
$request = db_query("
SELECT$select_columns
FROM {$db_prefix}members AS mem$select_tables
WHERE mem.ID_GROUP = $groupnumber
                        ORDER BY mem.memberName ASC", __FILE__, __LINE__);
$new_loaded_ids = array();
while ($row = mysql_fetch_assoc($request))
{

$avatar_width = '';
$avatar_height = '';

$context['TPortal']['team'][] = array(
'username' => $row['memberName'],
'name' => $row['realName'],
'groupname' => $groupname,
'posts' => $row['posts'],
'location' => $row['location'],
'href' => $scripturl . '?action=profile;u=' . $row['ID_MEMBER'],
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '" title="' . $txt[92] . ' ' . $row['realName'] . '">' . $row['realName'] . '</a>',
'blurb' => $row['personalText'],
'avatar' => array(
'name' => $row['avatar'],
'image' => $row['avatar'] == '' ? ($row['ID_ATTACH'] > 0 ? '<img  src="' . (empty($row['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $row['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) . '" alt="" class="avatar2" border="0" />' : '') : (stristr($row['avatar'], 'http://') ? '<img src="' . $row['avatar'] . '"' . $avatar_width . $avatar_height . ' alt="" class="avatar2" border="0" />' : '<img src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($row['avatar']) . '" alt="" class="avatar2" border="0" />'),
'href' => $row['avatar'] == '' ? ($row['ID_ATTACH'] > 0 ? (empty($row['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $row['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) : '') : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar']),
'url' => $row['avatar'] == '' ? '' : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar'])
),
'last_login' => empty($row['lastLogin']) ? $txt['never'] : timeformat($row['lastLogin']),
'last_login_timestamp' => empty($row['lastLogin']) ? 0 : forum_time(0, $row['lastLogin']),
'website' => array(
'title' => $row['websiteTitle'],
'url' => $row['websiteUrl']),
'online' => array(
'is_online' => $row['isOnline'],
'text' => &$txt[$row['isOnline'] ? 'online2' : 'online3'],
'image_href' => $settings['images_url'] . '/' . ($row['isOnline'] ? 'useron' : 'useroff') . '.gif',
),
'teamtext' => $row['teamtext'],
'member_page' => empty($member_boards[$row['ID_MEMBER']]) ? '' : '<a href="' . $scripturl . '?board=' . $member_boards[$row['ID_MEMBER']] . '"><u>Board for ' . $row['realName'] . '</u></a>',
);


}
mysql_free_result($request);





echo '<table align="center" width="95%" cellpadding="5" cellspacing="5"><tr>
<td colspan="4" style="border-bottom: 2px solid #d0d0d0; padding-bottom: 4px; "><h2>' . $groupname . '</h2>
</td></tr><tr><td colspan="4"><br /> </td></tr><tr>';


        $newrow=0;
foreach($context['TPortal']['team'] as $team)
        {
            echo '
<td valign="top">'.$team['avatar']['image'].'</td>
<td valign="top" width="50%" class="middletext" style="padding: 5px;">
<h2 style="margin-top: 0; margin-bottom: 6px;">'.$team['link'].'</h2>
<b>Last seen</b>: '.$team['last_login'].'<br />
<b>Posts</b>: '.$team['posts'].'<br />
' , !empty($team['location']) ? '<b>Location</b>: '.$team['location'].'<br />' : '' , '
' , !empty($team['website']['title']) ? '<b>Website</b>: <a href="'.$team['website']['url'].'" target="_blank">'.$team['website']['title'].'</a><br />' : '' , '
' ,  $team['online']['is_online'] ? '<img src="'.$team['online']['image_href'].'" alt="" /> '.$team['online']['text'].'<br />' : $team['online']['text'].'<br />' , '

' , !empty($team['blurb']) ? '<i>- '.$team['blurb'].'</i><br />' : '' , '

' ,  !empty($team['teamtext']) ? $team['teamtext'].'<br />' : '' , '

' ,  !empty($team['member_page']) ? $team['member_page'].'<br />' : '' , '

    </div></td>';
            $newrow++;
            if($newrow>1){
               $newrow=0;
               echo '</tr><tr><td colspan="4"><br /><br /> </td></tr><tr>';
            }
        }
echo '</tr></table>';
}


Remember to change your group list and whatever other changes (reference to rebelrosenetworks). Or insert the following in the appropriate places in your article.

There at the top, you'll see:
///////////////////
//
// Format - $member_boards['<member userid #>'] = '<forum board #>';
//
$member_boards = array();
$member_boards['101'] = '27';
$member_boards['152'] = '29';


For each of the members that have a board assigned, include a line where the member id # is the index of the array and the value is the board #.

The actual link format (including the text 'Board for ') is specified in the line:
'member_page' => empty($member_boards[$row['ID_MEMBER']]) ? '' : '<a href="' . $scripturl . '?board=' . $member_boards[$row['ID_MEMBER']] . '"><u>Board for ' . $row['realName'] . '</u></a>',

Then toward the end, this actual outputs it:

' ,  !empty($team['member_page']) ? $team['member_page'].'<br />' : '' , '


That's it. User<->Board specifications and two single lines.

And if a given member doesn't yet have a board set up, simply don't include a line for them. Nothing should show up.
Title: Re: Add a group to this code
Post by: Svaha on September 26, 2006, 10:26:48 AM
Thanks for this Jacortina  :up:
Title: Re: Add a group to this code
Post by: rebelrose on September 26, 2006, 09:35:42 PM
Jacortina, I appreciate all the help you give. Thank you so much
Title: Re: Add a group to this code
Post by: mandos on October 02, 2006, 08:18:28 PM
well... since my php knowledge is 'null' i'm going to ask the question
hope it is not too lame :P

Here:
http://www.tinyportal.net/smf/index.php?page=29
in each member there is a "Position:" entry

in my site the position is listed on top of each category
(http://www.tio.gr/index.php?page=25)
I can't figure out how to change it and make it like Blocs... any ideas?

and the other thing that i can't figure is how to add some custom text after each member and some custom profile fields that I have added in my forum (using Custom Profile Field Mod for SMF)

I'll try to find a solution again later, it might help seeing it with a clear mind, but I don't think i'll manage to do it :P

Great work all of you :)
Title: Re: Add a group to this code
Post by: G6Cad on October 02, 2006, 08:22:37 PM
Please dont hijack the threads, start a new thread with your questions so we can keep the topic clean as it is  ;)
Title: Re: Add a group to this code
Post by: mandos on October 02, 2006, 08:25:51 PM
eeeerr... it is already here:
http://www.tinyportal.net/smf/index.php?topic=9207.new;topicseen#new

but I thought it would be better to have it all gathered
after all we are talking about enchancing the very same thing that is described in the previous pages  ???
Title: Re: Add a group to this code
Post by: brianjw on October 05, 2006, 02:56:27 AM
Deleted by PhilH

Hijacking is allowed
Title: Re: Add a group to this code
Post by: IchBin on October 05, 2006, 05:16:01 AM
Brianjw, please for the love of all things holy, READ AND SEARCH THIS SITE! ALL of the answers have been posted to everything that you have a question for I guarantee it!!! We have a hundred+ posts everyday with legitimate questions. We can't waste our time answering the same questions that have already been answered.
Title: Re: Add a group to this code
Post by: akulion on October 13, 2006, 01:34:02 AM
hey are "board moderators" a secondary group?

Title: Re: Add a group to this code
Post by: jacortina on October 13, 2006, 01:46:38 AM
Quote from: akulion on October 13, 2006, 01:34:02 AM
hey are "board moderators" a secondary group?

I don't believe so. Moderator status for a member is really a property of the BOARD they're a moderator for and not so much a property of the member. Actually, that info is in its very own table (independent of both boards and members - called {$db_prefix}moderators which has only two columns: ID_BOARD and ID_MEMBER).
Title: Re: Add a group to this code
Post by: akulion on October 13, 2006, 01:48:03 AM
thanks for the info :up:

oh that sucks! my board moderators will kill me :2funny: if their names dont show up

ill just stick to my old fashioned manual html coded page for now :D
Title: Re: Add a group to this code
Post by: jacortina on October 13, 2006, 01:59:29 AM
Well, appending what would basically be a second 'copy' of the groups based code above, modified to work off of the moderators table instead, would get them listed.
Title: Re: Add a group to this code
Post by: akulion on October 13, 2006, 02:04:21 AM
too complicated for me to be honest

and i dont wana trouble u either since ur already over loaded with code requests everyday

thanks anyways :up: :D
Title: Re: Add a group to this code
Post by: HiroshimaPriest on October 13, 2006, 07:11:43 PM
A quick question here.... the code is great btw...

How can you control the avatar size?  I've got a few members where the forums have scaled down their avatar automatically, but the images with the code are full size...

Any help would be appreciated.

Thanks.
Title: Re: Add a group to this code
Post by: jacortina on October 14, 2006, 05:42:48 AM
You want primary group only? You got it.
You want to include additional membergroups? You got it.
You want to include board moderators? You got it.
You want to include post-count groups? You got it.
You want choice of groups broken out or single consolidated list? You got it.

Sort by id # (which is generally seniority), display name, or post count.
Include teamtext (if present).
Include links to board or article page by member.
Uses $txt values from standard language file.
Output entries in separate 'echo' statements to make shuffling and/or exclusion by commenting out easier.

(And it 'should' limit avatar width to that set in admin.)


global $txt, $scripturl, $user_info, $context, $modSettings, $ID_MEMBER, $board_info, $settings, $db_prefix;

////////////////////////////////////////  Enter the desired groups - in order of appearance, if listing by group
$groups_list = array(12, 11, 9, 10, 25);
////////////////////////////////////////

$list_by_group = true; // 'true' for separate sections by group; 'false' for consolidated list
$include_nonprimary_groups = true; // 'true' to check for group membership in additional groups; 'false' for primary only
$include_post_groups = false; // 'true' to include post-count based group in membership search
$include_moderators = false; // 'true' to include board moderators on page
$repeats_allowed = false; // 'true' to allow multiple appearances by member on page (for $list_by_group = true only)

$sort_by = 'name'; // choices - 'id' ascending(default), 'posts' descending, 'name' ascending

$extra_type = 'none'; // choices - 'none'(default), 'board' links, 'page' (article) links
///////////////////
// Format - $extra_links['<member userid #>'] = '<forum board #>';
//       or $extra_links['<member userid #>'] = '<TP article #>';
$extra_links = array();
$extra_links['3'] = '5';
$extra_links['2'] = '11';

$extra_label_prefix = 'Page of '; // text to precede member's name in link label for extra link
$extra_label_suffix = ''; // text to append to member's name in link label for extra link

$page_title = 'Meet the Team!';
$page_subtitle = 'The people around the place';

$moderator_group = 3;
///////////////////////////////////////////////////////////////////////////////////////

$sort_ord = 'mem.ID_MEMBER ASC';
if ($sort_by == 'posts') $sort_ord = 'mem.posts DESC';
if ($sort_by == 'name') $sort_ord = 'mem.realName ASC';

if (($extra_type != 'board') && ($extra_type != 'page')) $extra_type = 'none';

if ($include_moderators)
{if (!in_array($moderator_group, $groups_list)) $groups_list[] = $moderator_group;}

$groups_to_use = array();
if ($list_by_group)
{$groups_to_use = $groups_list;}
else
{$groups_to_use[] = 0;}

$users_already_listed = array();
$users_already_listed[] = 0;

loadLanguage('Profile');

echo '<table align="center" width="96%" cellpadding="3" cellspacing="2"><tr>
<td colspan="4"><h2>', $page_title, '</h2>
<span class="smalltext">', $page_subtitle, '</span><br /></td></tr>';

if (!$list_by_group)
echo '<tr><td colspan="4"><br /></td></tr><tr width="95%" style="margin-top: 4px;">
<td class="windowbg3" colspan="4" style="border-top: 2px solid #d0d0d0; padding-top: 4px; "><h2> </h2>
</td></tr>';

foreach($groups_to_use as $groupnumber)
{
$loaded_ids = array();
$user_profile=array();
$memberContext=array();
$profile=array();
$context['TPortal']['team']=array();

// get the name of the group
$request = db_query("
SELECT groupName FROM {$db_prefix}membergroups WHERE ID_GROUP=$groupnumber", __FILE__, __LINE__);
if(mysql_num_rows($request)>0){
$row = mysql_fetch_row($request);
$groupNameX=$row[0];
mysql_free_result($request);
}

if ($list_by_group) {
$select_where = 'mem.ID_GROUP = '.$groupnumber;
if ($include_nonprimary_groups) $select_where .= ' OR FIND_IN_SET('.$groupnumber.', mem.additionalGroups)';
if ($include_post_groups) $select_where .= ' OR mem.ID_POST_GROUP = '.$groupnumber;
if ($include_moderators && ($groupnumber == $moderator_group)) $select_where = 'mem.ID_MEMBER = m.ID_MEMBER';
}
else {
$select_where = 'mem.ID_GROUP IN (' . implode(', ', $groups_list) . ')';
if ($include_nonprimary_groups) $select_where .= ' OR FIND_IN_SET(' . implode(', mem.additionalGroups) OR FIND_IN_SET(', $groups_list) . ', mem.additionalGroups)';
if ($include_post_groups) $select_where .= ' OR mem.ID_POST_GROUP IN (' . implode(', ', $groups_list) . ')';
if ($include_moderators) $select_where .= 'OR mem.ID_MEMBER = m.ID_MEMBER';
}

$select_where = '(' . $select_where . ') AND mem.ID_MEMBER NOT IN (' . implode(', ', $users_already_listed) . ')';

// Load the member's data.
$request = db_query("
SELECT IFNULL(lo.logTime, 0) AS isOnline, IFNULL(a.ID_ATTACH, 0) AS ID_ATTACH, a.filename, a.attachmentType,
mem.personalText, mem.avatar, mem.additionalGroups, mem.ID_MEMBER as memnum, mem.memberName, mem.ID_GROUP,
mem.usertitle, mem.karmaBad, mem.karmaGood, mem.realName, mem.lastLogin, mem.websiteTitle,
mem.websiteUrl, mem.location, mem.posts, them.value AS teamtext, m.ID_MEMBER as modmem, g.groupName
FROM ({$db_prefix}members AS mem)
LEFT JOIN {$db_prefix}moderators AS m ON (m.ID_MEMBER = mem.ID_MEMBER)
LEFT JOIN {$db_prefix}membergroups AS g ON (g.ID_GROUP = mem.ID_GROUP)
LEFT JOIN {$db_prefix}log_online AS lo ON (lo.ID_MEMBER = mem.ID_MEMBER)
LEFT JOIN {$db_prefix}attachments AS a ON (a.ID_MEMBER = mem.ID_MEMBER)
LEFT JOIN {$db_prefix}themes AS them ON (mem.ID_MEMBER = them.ID_MEMBER AND them.variable = 'teamtext' AND them.ID_THEME=1)
WHERE $select_where
GROUP BY mem.ID_MEMBER
ORDER BY $sort_ord", __FILE__, __LINE__);
$new_loaded_ids = array();
$member_count = 0;

while ($row = mysql_fetch_assoc($request))
{
if (!$repeats_allowed) $users_already_listed[$row['memnum']] = $row['memnum'];

$member_count += 1;

$avatar_width = '';
$avatar_height = '';
if($context['browser']['is_ie6']) $avatar_width = 'width="' . $modSettings['avatar_max_width_external'] . '"';

$context['TPortal']['team'][] = array(
'username' => $row['memberName'],
'usertitle' => $row['usertitle'],
'name' => $row['realName'],
'groupname' => ($groupnum == 0) ? $row['groupName'] : $groupNameX ,
'posts' => $row['posts'],
'karmabad' => $row['karmaBad'],
'karmagood' => $row['karmaGood'],
'location' => $row['location'],
'href' => $scripturl . '?action=profile;u=' . $row['memnum'],
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['memnum'] . '" title="' . $txt[92] . ' ' . $row['realName'] . '">' . $row['realName'] . '</a>',
'blurb' => $row['personalText'],
'avatar' => array(
'name' => $row['avatar'],
'image' => $row['avatar'] == '' ? ($row['ID_ATTACH'] > 0 ? '<img  src="' . (empty($row['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $row['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) . '" alt="" style="max-height:280px;max-width:180px;" border="0" />' : '') : (stristr($row['avatar'], 'http://') ? '<img src="' . $row['avatar'] . '"' . $avatar_width . $avatar_height . ' alt="" style="max-height:280px;max-width:180px;" border="0" />' : '<img src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($row['avatar']) . '" alt="" style="max-height:280px;max-width:180px;" border="0" />'),
'href' => $row['avatar'] == '' ? ($row['ID_ATTACH'] > 0 ? (empty($row['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $row['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) : '') : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar']),
'url' => $row['avatar'] == '' ? '' : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar'])
),
'last_login' => empty($row['lastLogin']) ? $txt['never'] : timeformat($row['lastLogin']),
'last_login_timestamp' => empty($row['lastLogin']) ? 0 : forum_time(0, $row['lastLogin']),
'website' => array(
'title' => $row['websiteTitle'],
'url' => $row['websiteUrl']
),
'online' => array(
'is_online' => $row['isOnline'],
'text' => &$txt[$row['isOnline'] ? 'online2' : 'online3'],
'image_href' => $settings['images_url'] . '/' . ($row['isOnline'] ? 'useron' : 'useroff') . '.gif',
),
'teamtext' => $row['teamtext'],
'member_page' => ($extra_type == 'none') ? '' : empty($extra_links[$row['memnum']]) ? '' : $extra_links[$row['memnum']],
);

}
mysql_free_result($request);

if ($member_count > 0)
{
if ($list_by_group)
echo '<tr><td colspan="4"><br /></td></tr><tr width="95%" style="margin-top: 4px;">
<td class="windowbg3" colspan="4" style="border-top: 2px solid #d0d0d0; padding-top: 4px; "><h2>' . $groupNameX . '</h2>
</td></tr>';

echo '<tr>';
        $newrow=0;

foreach($context['TPortal']['team'] as $team)
        {
echo '
<td valign="top" width="18%">'.$team['avatar']['image'].'</td>';

echo ' <td valign="top" class="middletext" style="padding: 2px;">';

echo '<h2 style="margin-top: 0; margin-bottom: 4px;"><b>'.$team['link'].'</b></h2>';

echo '<b>'. $team['usertitle'].'</b><br />';

if (!$list_by_group)
echo '<b>'.$txt[87].'</b>: '.$team['groupname'].'<br />';

if ($modSettings['karmaMode'] == '1')
echo '<b>', $modSettings['karmaLabel'], '</b> ', $team['karmagood'] - $team['karmabad'], '<br />';
elseif ($modSettings['karmaMode'] == '2')
echo '<b>', $modSettings['karmaLabel'], '</b> +', $team['karmagood'], ' | -', $team['karmabad'], '<br />';

echo '<b>'.$txt['lastLoggedIn'].'</b>: '.$team['last_login'].'<br />';

echo !empty($team['location']) ? '<b>'.$txt[227].'</b>: '.$team['location'].'<br />' : '';

echo !empty($team['website']['title']) ? '<b>'.$txt[96].'</b>: <a href="'.$team['website']['url'].'" target="_blank"><u>'.$team['website']['title'].'</u></a><br />' : '';

echo $team['online']['is_online'] ? '<img src="'.$team['online']['image_href'].'" alt="" /> '.$team['online']['text'].'<br />' : $team['online']['text'].'<br />';

echo '<b>'.$txt[86].'</b>: '.$team['posts'].'<br />';

echo !empty($team['blurb']) ? '<i>- '.$team['blurb'].'</i><br />' : '';

echo !empty($team['teamtext']) ? $team['teamtext'].'<br />' : '';

if (($extra_type == 'board') && !empty($team['member_page']))
echo '<a href="' . $scripturl . '?board=' . $team['member_page'] . '"><u>'. $extra_label_prefix . $team['name'] . $extra_label_suffix . '</u></a><br />';
if (($extra_type == 'page') && !empty($team['member_page']))
echo '<a href="' . $scripturl . '?page=' . $team['member_page'] . '"><u>'. $extra_label_prefix . $team['name'] . $extra_label_suffix . '</u></a><br />';

echo '
</td>';

$newrow++;
if($newrow>1){
$newrow=0;
echo '</tr><tr><td colspan="4"></td></tr><tr>';
}
        }
if($newrow=1) echo '<td colspan="2"></td>';
echo '</tr>';
}

}
echo '</table>';


Edit 1: Fix for moderators repeating.

Edit 2: Fix for MySQL versioning (?) issue.
Title: Re: Add a group to this code
Post by: G6Cad on October 14, 2006, 08:38:27 AM
Great work dont here jacortina :)
Title: Re: Add a group to this code
Post by: bloc on October 14, 2006, 09:56:33 AM
Whats really a drawback in this routine, is that the more groups you add, the more resource intensive db calls you make. Rather it should just one call that fetch the info from all the groups added.

Gotta save that poor server lol. :)
Title: Re: Add a group to this code
Post by: jacortina on October 14, 2006, 02:23:39 PM
Quote from: Bloc on October 14, 2006, 09:56:33 AM
Whats really a drawback in this routine, is that the more groups you add, the more resource intensive db calls you make. Rather it should just one call that fetch the info from all the groups added.

Gotta save that poor server lol. :)

True (though the consolidated list only does one call, no matter the number of groups).

What makes a sinlge query for the broken-out list more than a little problematic is that there's no easily defined way for the ordering by groups the current method provides. As you see in my example, the 12-11-9-10-25 ordering (along with the fact that the 'qualifying' group matching can be from any of a number of columns - including the additionalGroups column which itself is an array of possible values to match - or even due to the existence of a record in a separate table) makes attempts to sort/break the the fetched results something I can't readily envision.  :-\
Title: Re: Add a group to this code
Post by: Lesmond on October 14, 2006, 08:04:55 PM
thanks for this, but I am getting multiple instances of the moderator, but none of admin, what do I change to fix this?

Thanks Les
Title: Re: Add a group to this code
Post by: jacortina on October 14, 2006, 08:10:06 PM
How have you set the 'switches' at the top of script?

EDIT: And what is the group list?
Title: Re: Add a group to this code
Post by: Lesmond on October 14, 2006, 08:59:39 PM
$groups_list = array(1, 12, 11, 9, 10, 25);

Is this the switches? then I have the Mod to True, just one thing I only have one moderator on my board.
$list_by_group = true;
$include_nonprimary_groups = true;
$include_post_groups = false;
$include_moderators = true;
$repeats_allowed = false;


Thanks Les
Title: Re: Add a group to this code
Post by: jacortina on October 14, 2006, 09:10:18 PM
The 'switches' seem fine for a grouped list (separate sections) which includes checks for matching on both primary and additional membergroups.

I see the groups that I left in the script. Not sure right now why those extra groups would cause a repeat on the moderator, though.

Are you looking to list Admin(s) and Moderator(s)?
Each in their own section, right?
$groups_list = array(1);

How about Global Moderators?
$groups_list = array(1, 2);

(In both cases, board moderators are pulled in by the: $include_moderators = true;)
Title: Re: Add a group to this code
Post by: Lesmond on October 14, 2006, 09:24:38 PM
if I set $include_moderators = true; this (http://www.lesmonds.co.uk/smf/index.php?action=team) is what it looks like for moderators, all the rest are ok
Title: Re: Add a group to this code
Post by: jacortina on October 14, 2006, 09:34:33 PM
Arrrrghhh!

Does this member, by any chance, moderate 13 boards?

Let me look into it.
Title: Re: Add a group to this code
Post by: Lesmond on October 14, 2006, 10:11:02 PM
yes I see what it is now, not that I could fix it :)

Thanks Les
Title: Re: Add a group to this code
Post by: G6Cad on October 14, 2006, 10:15:56 PM
I know now how you look like Lesmond :)
Just saw your gallery on your site, love the enviroment there, great pictures, and very nice to see how you look like, it's fun to have a face to put with all the words :)
Title: Re: Add a group to this code
Post by: jacortina on October 14, 2006, 10:29:11 PM
OK. Fixed (hopefully) code put in place in original message:
http://www.tinyportal.net/smf/index.php?topic=8555.msg79951#msg79951

(remember to check/fix the group list for your needs)
Title: Re: Add a group to this code
Post by: Lesmond on October 14, 2006, 10:43:26 PM
Thank you very much jacortina that done the trick :) sorry to have put you to all this trouble.

Quote from: G6 on October 14, 2006, 10:15:56 PM
I know now how you look like Lesmond :)
Just saw your gallery on your site, love the enviroment there, great pictures, and very nice to see how you look like, it's fun to have a face to put with all the words :)

Hope I didn't scare you too much G6 :)  you are more than welcome any time
Title: Re: Add a group to this code
Post by: jacortina on October 14, 2006, 10:46:58 PM
Quote from: Lesmond on October 14, 2006, 10:43:26 PM
Thank you very much jacortina that done the trick :) sorry to have put you to all this trouble.

Not at all. The original code was incorrect. If you hadn't caught it, someone else would.
Title: Re: Add a group to this code
Post by: Joachim on October 15, 2006, 08:17:12 AM
@ jacortina - one notice

In my case i have only admin and one global mod. Your changed code works only if minimum 1 moderator is defined, otherwise it shows only the "intro text".

Joachim
Title: Re: Add a group to this code
Post by: jacortina on October 15, 2006, 02:11:35 PM
Quote from: Joachim on October 15, 2006, 08:17:12 AM
@ jacortina - one notice

In my case i have only admin and one global mod. Your changed code works only if minimum 1 moderator is defined, otherwise it shows only the "intro text".

Joachim

Just put in fix for what appears to be a MySQL versioning issue.

Code working fine on my site mirror on my PC wasn't even working on my own live site. ;)

Changing from the implied JOIN type to explicit for the moderator's table appears to have fixed it. Have changed the code in the message:

http://www.tinyportal.net/smf/index.php?topic=8555.msg79951#msg79951

Try it (change groups/switches/title) and see if that straightens it out.
Title: Re: Add a group to this code
Post by: Joachim on October 15, 2006, 04:15:23 PM
Now it works like charm :up:

Thank you!
Title: Re: Add a group to this code
Post by: Lesmond on January 23, 2007, 06:48:22 PM
I am getting a Database Error with this now, dont know why though I have not changed anything :o anyone know whats going on?
QuoteThe SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET SQL_MAX_JOIN_SIZE=# if the SELECT is okay
File: /home/sites/xxxxxxxx/public_html/smf/Sources/Load.php(1733) : eval()'d code(9) : eval()'d code
Line: 106
Title: Re: Add a group to this code
Post by: Lesmond on January 24, 2007, 07:53:58 PM
here is the code I am using, if it helps :) this is for the meet the team page

global $txt, $scripturl, $user_info, $context, $modSettings, $ID_MEMBER, $board_info, $settings, $db_prefix;

////////////////////////////////////////  Enter the desired groups - in order of appearance, if listing by group
$groups_list = array(1, 2, 11);
////////////////////////////////////////

$list_by_group = true; // \'true\' for separate sections by group; \'false\' for consolidated list
$include_nonprimary_groups = true; // \'true\' to check for group membership in additional groups; \'false\' for primary only
$include_post_groups = false; // \'true\' to include post-count based group in membership search
$include_moderators = true; // \'true\' to include board moderators on page
$repeats_allowed = false; // \'true\' to allow multiple appearances by member on page (for $list_by_group = true only)

$sort_by = \'name\'; // choices - \'id\' ascending(default), \'posts\' descending, \'name\' ascending

$extra_type = \'none\'; // choices - \'none\'(default), \'board\' links, \'page\' (article) links
///////////////////
// Format - $extra_links[\'<member userid #>\'] = \'<forum board #>\';
//       or $extra_links[\'<member userid #>\'] = \'<TP article #>\';
$extra_links = array();
$extra_links[\'3\'] = \'5\';
$extra_links[\'2\'] = \'11\';

$extra_label_prefix = \'Page of \'; // text to precede member\'s name in link label for extra link
$extra_label_suffix = \'\'; // text to append to member\'s name in link label for extra link

$page_title = \'Meet the team at Lesmonds Place!\';
$page_subtitle = \'The people you will run into while visiting\';

$moderator_group = 3;
///////////////////////////////////////////////////////////////////////////////////////

$sort_ord = \'mem.ID_MEMBER ASC\';
if ($sort_by == \'posts\') $sort_ord = \'mem.posts DESC\';
if ($sort_by == \'name\') $sort_ord = \'mem.realName ASC\';

if (($extra_type != \'board\') && ($extra_type != \'page\')) $extra_type = \'none\';

if ($include_moderators)
{if (!in_array($moderator_group, $groups_list)) $groups_list[] = $moderator_group;}

$groups_to_use = array();
if ($list_by_group)
{$groups_to_use = $groups_list;}
else
{$groups_to_use[] = 0;}

$users_already_listed = array();
$users_already_listed[] = 0;

loadLanguage(\'Profile\');

echo \'<table align=\"center\" width=\"96%\" cellpadding=\"3\" cellspacing=\"2\"><tr>
<td colspan=\"4\"><h2>\', $page_title, \'</h2>
<span class=\"smalltext\">\', $page_subtitle, \'</span><br /></td></tr>\';

if (!$list_by_group)
echo \'<tr><td colspan=\"4\"><br /></td></tr><tr width=\"95%\" style=\"margin-top: 4px;\">
<td class=\"windowbg3\" colspan=\"4\" style=\"border-top: 2px solid #d0d0d0; padding-top: 4px; \"><h2> </h2>
</td></tr>\';

foreach($groups_to_use as $groupnumber)
{
$loaded_ids = array();
$user_profile=array();
$memberContext=array();
$profile=array();
$context[\'TPortal\'][\'team\']=array();

// get the name of the group
$request = db_query(\"
SELECT groupName FROM {$db_prefix}membergroups WHERE ID_GROUP=$groupnumber\", __FILE__, __LINE__);
if(mysql_num_rows($request)>0){
$row = mysql_fetch_row($request);
$groupNameX=$row[0];
mysql_free_result($request);
}

if ($list_by_group) {
$select_where = \'mem.ID_GROUP = \'.$groupnumber;
if ($include_nonprimary_groups) $select_where .= \' OR FIND_IN_SET(\'.$groupnumber.\', mem.additionalGroups)\';
if ($include_post_groups) $select_where .= \' OR mem.ID_POST_GROUP = \'.$groupnumber;
if ($include_moderators && ($groupnumber == $moderator_group)) $select_where = \'mem.ID_MEMBER = m.ID_MEMBER\';
}
else {
$select_where = \'mem.ID_GROUP IN (\' . implode(\', \', $groups_list) . \')\';
if ($include_nonprimary_groups) $select_where .= \' OR FIND_IN_SET(\' . implode(\', mem.additionalGroups) OR FIND_IN_SET(\', $groups_list) . \', mem.additionalGroups)\';
if ($include_post_groups) $select_where .= \' OR mem.ID_POST_GROUP IN (\' . implode(\', \', $groups_list) . \')\';
if ($include_moderators) $select_where .= \'OR mem.ID_MEMBER = m.ID_MEMBER\';
}

$select_where = \'(\' . $select_where . \') AND mem.ID_MEMBER NOT IN (\' . implode(\', \', $users_already_listed) . \')\';

// Load the member\'s data.
$request = db_query(\"
SELECT IFNULL(lo.logTime, 0) AS isOnline, IFNULL(a.ID_ATTACH, 0) AS ID_ATTACH, a.filename, a.attachmentType,
mem.personalText, mem.avatar, mem.additionalGroups, mem.ID_MEMBER as memnum, mem.memberName, mem.ID_GROUP,
mem.usertitle, mem.karmaBad, mem.karmaGood, mem.realName, mem.lastLogin, mem.websiteTitle,
mem.websiteUrl, mem.location, mem.posts, them.value AS teamtext, m.ID_MEMBER as modmem, g.groupName
FROM ({$db_prefix}members AS mem, {$db_prefix}moderators AS m)
LEFT JOIN {$db_prefix}membergroups AS g ON (g.ID_GROUP = mem.ID_GROUP)
LEFT JOIN {$db_prefix}log_online AS lo ON (lo.ID_MEMBER = mem.ID_MEMBER)
LEFT JOIN {$db_prefix}attachments AS a ON (a.ID_MEMBER = mem.ID_MEMBER)
LEFT JOIN {$db_prefix}themes AS them ON (mem.ID_MEMBER = them.ID_MEMBER AND them.variable = \'teamtext\' AND them.ID_THEME=1)
WHERE $select_where
GROUP BY mem.ID_MEMBER
ORDER BY $sort_ord\", __FILE__, __LINE__);
$new_loaded_ids = array();
$member_count = 0;

while ($row = mysql_fetch_assoc($request))
{
if (!$repeats_allowed) $users_already_listed[$row[\'memnum\']] = $row[\'memnum\'];

$member_count += 1;

$avatar_width = \'\';
$avatar_height = \'\';
if($context[\'browser\'][\'is_ie6\']) $avatar_width = \'width=\"\' . $modSettings[\'avatar_max_width_external\'] . \'\"\';

$context[\'TPortal\'][\'team\'][] = array(
\'username\' => $row[\'memberName\'],
\'usertitle\' => $row[\'usertitle\'],
\'name\' => $row[\'realName\'],
\'groupname\' => ($groupnum == 0) ? $row[\'groupName\'] : $groupNameX ,
\'posts\' => $row[\'posts\'],
\'karmabad\' => $row[\'karmaBad\'],
\'karmagood\' => $row[\'karmaGood\'],
\'location\' => $row[\'location\'],
\'href\' => $scripturl . \'?action=profile;u=\' . $row[\'memnum\'],
\'link\' => \'<a href=\"\' . $scripturl . \'?action=profile;u=\' . $row[\'memnum\'] . \'\" title=\"\' . $txt[92] . \' \' . $row[\'realName\'] . \'\">\' . $row[\'realName\'] . \'</a>\',
\'blurb\' => $row[\'personalText\'],
\'avatar\' => array(
\'name\' => $row[\'avatar\'],
\'image\' => $row[\'avatar\'] == \'\' ? ($row[\'ID_ATTACH\'] > 0 ? \'<img  src=\"\' . (empty($row[\'attachmentType\']) ? $scripturl . \'?action=dlattach;attach=\' . $row[\'ID_ATTACH\'] . \';type=avatar\' : $modSettings[\'custom_avatar_url\'] . \'/\' . $row[\'filename\']) . \'\" alt=\"\" style=\"max-height:280px;max-width:180px;\" border=\"0\" />\' : \'\') : (stristr($row[\'avatar\'], \'http://\') ? \'<img src=\"\' . $row[\'avatar\'] . \'\"\' . $avatar_width . $avatar_height . \' alt=\"\" style=\"max-height:280px;max-width:180px;\" border=\"0\" />\' : \'<img src=\"\' . $modSettings[\'avatar_url\'] . \'/\' . htmlspecialchars($row[\'avatar\']) . \'\" alt=\"\" style=\"max-height:280px;max-width:180px;\" border=\"0\" />\'),
\'href\' => $row[\'avatar\'] == \'\' ? ($row[\'ID_ATTACH\'] > 0 ? (empty($row[\'attachmentType\']) ? $scripturl . \'?action=dlattach;attach=\' . $row[\'ID_ATTACH\'] . \';type=avatar\' : $modSettings[\'custom_avatar_url\'] . \'/\' . $row[\'filename\']) : \'\') : (stristr($row[\'avatar\'], \'http://\') ? $row[\'avatar\'] : $modSettings[\'avatar_url\'] . \'/\' . $row[\'avatar\']),
\'url\' => $row[\'avatar\'] == \'\' ? \'\' : (stristr($row[\'avatar\'], \'http://\') ? $row[\'avatar\'] : $modSettings[\'avatar_url\'] . \'/\' . $row[\'avatar\'])
),
\'last_login\' => empty($row[\'lastLogin\']) ? $txt[\'never\'] : timeformat($row[\'lastLogin\']),
\'last_login_timestamp\' => empty($row[\'lastLogin\']) ? 0 : forum_time(0, $row[\'lastLogin\']),
\'website\' => array(
\'title\' => $row[\'websiteTitle\'],
\'url\' => $row[\'websiteUrl\']
),
\'online\' => array(
\'is_online\' => $row[\'isOnline\'],
\'text\' => &$txt[$row[\'isOnline\'] ? \'online2\' : \'online3\'],
\'image_href\' => $settings[\'images_url\'] . \'/\' . ($row[\'isOnline\'] ? \'useron\' : \'useroff\') . \'.gif\',
),
\'teamtext\' => $row[\'teamtext\'],
\'member_page\' => ($extra_type == \'none\') ? \'\' : empty($extra_links[$row[\'memnum\']]) ? \'\' : $extra_links[$row[\'memnum\']],
);

}
mysql_free_result($request);

if ($member_count > 0)
{
if ($list_by_group)
echo \'<tr><td colspan=\"4\"><br /></td></tr><tr width=\"95%\" style=\"margin-top: 4px;\">
<td class=\"windowbg3\" colspan=\"4\" style=\"border-top: 2px solid #d0d0d0; padding-top: 4px; \"><h2>\' . $groupNameX . \'</h2>
</td></tr>\';

echo \'<tr>\';
        $newrow=0;

foreach($context[\'TPortal\'][\'team\'] as $team)
        {
echo \'
<td valign=\"top\" width=\"18%\">\'.$team[\'avatar\'][\'image\'].\'</td>\';

echo \' <td valign=\"top\" class=\"middletext\" style=\"padding: 2px;\">\';

echo \'<h2 style=\"margin-top: 0; margin-bottom: 4px;\"><b>\'.$team[\'link\'].\'</b></h2>\';

echo \'<b>\'. $team[\'usertitle\'].\'</b><br />\';

if (!$list_by_group)
echo \'<b>\'.$txt[87].\'</b>: \'.$team[\'groupname\'].\'<br />\';

if ($modSettings[\'karmaMode\'] == \'1\')
echo \'<b>\', $modSettings[\'karmaLabel\'], \'</b> \', $team[\'karmagood\'] - $team[\'karmabad\'], \'<br />\';
elseif ($modSettings[\'karmaMode\'] == \'2\')
echo \'<b>\', $modSettings[\'karmaLabel\'], \'</b> +\', $team[\'karmagood\'], \' | -\', $team[\'karmabad\'], \'<br />\';

echo \'<b>\'.$txt[\'lastLoggedIn\'].\'</b>: \'.$team[\'last_login\'].\'<br />\';

echo !empty($team[\'location\']) ? \'<b>\'.$txt[227].\'</b>: \'.$team[\'location\'].\'<br />\' : \'\';

echo !empty($team[\'website\'][\'title\']) ? \'<b>\'.$txt[96].\'</b>: <a href=\"\'.$team[\'website\'][\'url\'].\'\" target=\"_blank\"><u>\'.$team[\'website\'][\'title\'].\'</u></a><br />\' : \'\';

echo $team[\'online\'][\'is_online\'] ? \'<img src=\"\'.$team[\'online\'][\'image_href\'].\'\" alt=\"\" /> \'.$team[\'online\'][\'text\'].\'<br />\' : $team[\'online\'][\'text\'].\'<br />\';

echo \'<b>\'.$txt[86].\'</b>: \'.$team[\'posts\'].\'<br />\';

echo !empty($team[\'blurb\']) ? \'<i>- \'.$team[\'blurb\'].\'</i><br />\' : \'\';

echo !empty($team[\'teamtext\']) ? $team[\'teamtext\'].\'<br />\' : \'\';

if (($extra_type == \'board\') && !empty($team[\'member_page\']))
echo \'<a href=\"\' . $scripturl . \'?board=\' . $team[\'member_page\'] . \'\"><u>\'. $extra_label_prefix . $team[\'name\'] . $extra_label_suffix . \'</u></a><br />\';
if (($extra_type == \'page\') && !empty($team[\'member_page\']))
echo \'<a href=\"\' . $scripturl . \'?page=\' . $team[\'member_page\'] . \'\"><u>\'. $extra_label_prefix . $team[\'name\'] . $extra_label_suffix . \'</u></a><br />\';

echo \'
</td>\';

$newrow++;
if($newrow>1){
$newrow=0;
echo \'</tr><tr><td colspan=\"4\"></td></tr><tr>\';
}
        }
if($newrow=1) echo \'<td colspan=\"2\"></td>\';
echo \'</tr>\';
}

}
echo \'</table>\';
Title: Re: Add a group to this code
Post by: jacortina on January 25, 2007, 03:37:10 AM
Well, I'm lost.  ???

The main query there does a lot of table joins, but it's not really any more extensive than some of the queries used in the SMF scripts.

Also, looking into this, SQL_BIG_SELECTS is supposedly ON (1) by default at connection time.
Title: Re: Add a group to this code
Post by: Lesmond on January 25, 2007, 11:17:49 AM
Thanks J.A, I just don't know what happened it was working fine, then this pops up from nowhere, I haven't added any mods since or changed anything, so I to am lost :(
Title: Re: Add a group to this code
Post by: Brian on April 13, 2007, 09:29:40 AM
Using your code everything is working great.  I have it so it displays the way I want but when a user clicks the link to go to the team page one time I get all the following errors.  Anyone send me in the right direction to get this fixed?
Thank you in advance
Brian

George   Today at 03:13:26 AM 
xx.xx.xxx.xxx     c25303645927c373bb529ec3a8942c5f 
http://mysite/forum2/index.php?page=17 
8: Undefined index: 1
File: /home/xxxxx/public_html/forum2/Themes/default/languages/Profile.english.php (eval?)
Line: 151

   George   Today at 03:13:26 AM 
xx.xx.xxx.xxx     c25303645927c373bb529ec3a8942c5f 
http://mysite/forum2/index.php?page=17 
8: Undefined variable: groupnum
File: /home/xxxxx/public_html/forum2/Themes/default/languages/Profile.english.php (eval?)
Line: 125

   George   Today at 03:13:26 AM 
xx.xx.xxx.xxx     c25303645927c373bb529ec3a8942c5f 
http://mysite/forum2/index.php?page=17 
8: Undefined index: 5
File: /home/xxxxx/public_html/forum2/Themes/default/languages/Profile.english.php (eval?)
Line: 151

   George   Today at 03:13:26 AM 
xx.xx.xxx.xxx     c25303645927c373bb529ec3a8942c5f 
http://mysite/forum2/index.php?page=17 
8: Undefined variable: groupnum
File: /home/xxxxx/public_html/forum2/Themes/default/languages/Profile.english.php (eval?)
Line: 125

   George   Today at 03:13:26 AM 
xx.xx.xxx.xxx     c25303645927c373bb529ec3a8942c5f 
http://mysite/forum2/index.php?page=17 
8: Undefined variable: groupnum
File: /home/xxxxx/public_html/forum2/Themes/default/languages/Profile.english.php (eval?)
Line: 125

   George   Today at 03:13:26 AM 
xx.xx.xxx.xxx     c25303645927c373bb529ec3a8942c5f 
http://mysite/forum2/index.php?page=17 
8: Undefined variable: groupnum
File: /home/xxxxx/public_html/forum2/Themes/default/languages/Profile.english.php (eval?)
Line: 125

   George   Today at 03:13:26 AM 
xx.xx.xxx.xxx     c25303645927c373bb529ec3a8942c5f 
http://mysite/forum2/index.php?page=17 
8: Undefined index: 4
File: /home/xxxxx/public_html/forum2/Themes/default/languages/Profile.english.php (eval?)
Line: 151

   George   Today at 03:13:26 AM 
xx.xx.xxx.xxx     c25303645927c373bb529ec3a8942c5f 
http://mysite/forum2/index.php?page=17 
8: Undefined variable: groupnum
File: /home/xxxxx/public_html/forum2/Themes/default/languages/Profile.english.php (eval?)
Line: 125

Title: Re: Add a group to this code
Post by: G6Cad on April 13, 2007, 09:51:39 AM
Look for the language files from the snippets and add it to the language files you get the errors from.
Title: Re: Add a group to this code
Post by: JPDeni on April 13, 2007, 02:10:32 PM
The problem with the undefined variable is due to this line:


\'groupname\' => ($groupnum == 0) ? $row[\'groupName\'] : $groupNameX ,


From a cursory glance over your code, I think that if you change it to


\'groupname\' => ($groupnumber == 0) ? $row[\'groupName\'] : $groupNameX ,


you should be all right.

I'm not sure where your undefined index error is coming from, but you should look for some place that uses a conditional statement and a numerical array.
Title: Re: Add a group to this code
Post by: Brian on April 13, 2007, 07:04:52 PM
That fixed the Undefined variable: groupnum
error on line 125. 
Thank You very much
The only errors left are the three Undefined index errors on line 151.
Here is the code I am using on line 151
'member_page' => ($extra_type == 'none') ? '' : empty($extra_links[$row['memnum']]) ? '' : $extra_links[$row['memnum']],
Title: Re: Add a group to this code
Post by: Brian on April 13, 2007, 10:10:52 PM
Ok I have deleted that line and everything seems to be working fine now with no errors.  But since I do not understand php at all even though I have spent countless hours working with it I probably have some pretty messed up code.  This is what I have ended up with.
global $txt, $scripturl, $user_info, $context, $modSettings, $ID_MEMBER, $board_info, $settings, $db_prefix;

////////////////////////////////////////  Enter the desired groups - in order of appearance, if listing by group
$groups_list = array(10, 9, 1);
////////////////////////////////////////

$list_by_group = true; // 'true' for separate sections by group; 'false' for consolidated list
$include_nonprimary_groups = false; // 'true' to check for group membership in additional groups; 'false' for primary only
$include_post_groups = false; // 'true' to include post-count based group in membership search
$include_moderators = false; // 'true' to include board moderators on page
$repeats_allowed = false; // 'true' to allow multiple appearances by member on page (for $list_by_group = true only)

$sort_by = 'name'; // choices - 'id' ascending(default), 'posts' descending, 'name' ascending

$extra_type = 'none'; // choices - 'none'(default), 'board' links, 'page' (article) links
///////////////////
// Format - $extra_links['<member userid #>'] = '<forum board #>';
//       or $extra_links['<member userid #>'] = '<TP article #>';
$extra_links = array();
$extra_links['3'] = '5';
$extra_links['2'] = '11';

$extra_label_prefix = 'Page of '; // text to precede member's name in link label for extra link
$extra_label_suffix = ''; // text to append to member's name in link label for extra link

$page_title = 'Meet the Team!';
$page_subtitle = 'The people you will meet when you come to camp';

$moderator_group = 3;
///////////////////////////////////////////////////////////////////////////////////////

$sort_ord = 'mem.ID_MEMBER ASC';
if ($sort_by == 'posts') $sort_ord = 'mem.posts DESC';
if ($sort_by == 'name') $sort_ord = 'mem.realName ASC';

if (($extra_type != 'board') && ($extra_type != 'page')) $extra_type = 'none';

if ($include_moderators)
{if (!in_array($moderator_group, $groups_list)) $groups_list[] = $moderator_group;}

$groups_to_use = array();
if ($list_by_group)
{$groups_to_use = $groups_list;}
else
{$groups_to_use[] = 0;}

$users_already_listed = array();
$users_already_listed[] = 0;

loadLanguage('Profile');

echo '<table align="center" width="96%" cellpadding="3" cellspacing="2"><tr>
<td colspan="4"><h2>', $page_title, '</h2>
<span class="smalltext">', $page_subtitle, '</span><br /></td></tr>';

if (!$list_by_group)
echo '<tr><td colspan="4"><br /></td></tr><tr width="95%" style="margin-top: 4px;">
<td class="windowbg3" colspan="4" style="border-top: 2px solid #d0d0d0; padding-top: 4px; "><h2> </h2>
</td></tr>';

foreach($groups_to_use as $groupnumber)
{
$loaded_ids = array();
$user_profile=array();
$memberContext=array();
$profile=array();
$context['TPortal']['team']=array();

// get the name of the group
$request = db_query("
SELECT groupName FROM {$db_prefix}membergroups WHERE ID_GROUP=$groupnumber", __FILE__, __LINE__);
if(mysql_num_rows($request)>0){
$row = mysql_fetch_row($request);
$groupNameX=$row[0];
mysql_free_result($request);
}

if ($list_by_group) {
$select_where = 'mem.ID_GROUP = '.$groupnumber;
if ($include_nonprimary_groups) $select_where .= ' OR FIND_IN_SET('.$groupnumber.', mem.additionalGroups)';
if ($include_post_groups) $select_where .= ' OR mem.ID_POST_GROUP = '.$groupnumber;
if ($include_moderators && ($groupnumber == $moderator_group)) $select_where = 'mem.ID_MEMBER = m.ID_MEMBER';
}
else {
$select_where = 'mem.ID_GROUP IN (' . implode(', ', $groups_list) . ')';
if ($include_nonprimary_groups) $select_where .= ' OR FIND_IN_SET(' . implode(', mem.additionalGroups) OR FIND_IN_SET(', $groups_list) . ', mem.additionalGroups)';
if ($include_post_groups) $select_where .= ' OR mem.ID_POST_GROUP IN (' . implode(', ', $groups_list) . ')';
if ($include_moderators) $select_where .= 'OR mem.ID_MEMBER = m.ID_MEMBER';
}

$select_where = '(' . $select_where . ') AND mem.ID_MEMBER NOT IN (' . implode(', ', $users_already_listed) . ')';

// Load the member's data.
$request = db_query("
SELECT IFNULL(lo.logTime, 0) AS isOnline, IFNULL(a.ID_ATTACH, 0) AS ID_ATTACH, a.filename, a.attachmentType,
mem.personalText, mem.avatar, mem.additionalGroups, mem.ID_MEMBER as memnum, mem.memberName, mem.ID_GROUP,
mem.usertitle, mem.karmaBad, mem.karmaGood, mem.realName, mem.lastLogin, mem.websiteTitle,
mem.websiteUrl, mem.location, mem.posts, them.value AS teamtext, m.ID_MEMBER as modmem, g.groupName
FROM ({$db_prefix}members AS mem)
LEFT JOIN {$db_prefix}moderators AS m ON (m.ID_MEMBER = mem.ID_MEMBER)
LEFT JOIN {$db_prefix}membergroups AS g ON (g.ID_GROUP = mem.ID_GROUP)
LEFT JOIN {$db_prefix}log_online AS lo ON (lo.ID_MEMBER = mem.ID_MEMBER)
LEFT JOIN {$db_prefix}attachments AS a ON (a.ID_MEMBER = mem.ID_MEMBER)
LEFT JOIN {$db_prefix}themes AS them ON (mem.ID_MEMBER = them.ID_MEMBER AND them.variable = 'teamtext' AND them.ID_THEME=1)
WHERE $select_where
GROUP BY mem.ID_MEMBER
ORDER BY $sort_ord", __FILE__, __LINE__);
$new_loaded_ids = array();
$member_count = 0;

while ($row = mysql_fetch_assoc($request))
{
if (!$repeats_allowed) $users_already_listed[$row['memnum']] = $row['memnum'];

$member_count += 1;

$avatar_width = '';
$avatar_height = '';
if($context['browser']['is_ie6']) $avatar_width = 'width="' . $modSettings['avatar_max_width_external'] . '"';

$context['TPortal']['team'][] = array(
'username' => $row['memberName'],
'usertitle' => $row['usertitle'],
'name' => $row['realName'],
'groupname' => ($groupnumber == 0) ? $row['groupName'] : $groupNameX ,
'posts' => $row['posts'],
'karmabad' => $row['karmaBad'],
'karmagood' => $row['karmaGood'],
'location' => $row['location'],
'href' => $scripturl . '?action=profile;u=' . $row['memnum'],
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['memnum'] . '" title="' . $txt[92] . ' ' . $row['realName'] . '">' . $row['realName'] . '</a>',
'blurb' => $row['personalText'],
'avatar' => array(
'name' => $row['avatar'],
'image' => $row['avatar'] == '' ? ($row['ID_ATTACH'] > 0 ? '<img  src="' . (empty($row['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $row['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) . '" alt="" style="max-height:280px;max-width:180px;" border="0" />' : '') : (stristr($row['avatar'], 'http://') ? '<img src="' . $row['avatar'] . '"' . $avatar_width . $avatar_height . ' alt="" style="max-height:280px;max-width:180px;" border="0" />' : '<img src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($row['avatar']) . '" alt="" style="max-height:280px;max-width:180px;" border="0" />'),
'href' => $row['avatar'] == '' ? ($row['ID_ATTACH'] > 0 ? (empty($row['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $row['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) : '') : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar']),
'url' => $row['avatar'] == '' ? '' : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar'])
),
'last_login' => empty($row['lastLogin']) ? $txt['never'] : timeformat($row['lastLogin']),
'last_login_timestamp' => empty($row['lastLogin']) ? 0 : forum_time(0, $row['lastLogin']),
'website' => array(
'title' => $row['websiteTitle'],
'url' => $row['websiteUrl']
),
'online' => array(
'is_online' => $row['isOnline'],
'text' => &$txt[$row['isOnline'] ? 'online2' : 'online3'],
'image_href' => $settings['images_url'] . '/' . ($row['isOnline'] ? 'useron' : 'useroff') . '.gif',
),
'teamtext' => $row['teamtext'],

);

}
mysql_free_result($request);

if ($member_count > 0)
{
if ($list_by_group)
echo '<tr><td colspan="4"><br /></td></tr><tr width="95%" style="margin-top: 4px;">
<td class="windowbg3" colspan="4" style="border-top: 2px solid #d0d0d0; padding-top: 4px; "><h2>' . $groupNameX . '</h2>
</td></tr>';

echo '<tr>';
        $newrow=0;

foreach($context['TPortal']['team'] as $team)
        {
echo '
<td valign="top" width="18%">'.$team['avatar']['image'].'</td>';

echo ' <td valign="top" class="middletext" style="padding: 2px;">';

echo '<h2 style="margin-top: 0; margin-bottom: 4px;"><b>'.$team['link'].'</b></h2>';

echo '<b>'. $team['usertitle'].'</b><br />';

if (!$list_by_group)
echo '<b>'.$txt[87].'</b>: '.$team['groupname'].'<br />';


echo !empty($team['location']) ? '<b>'.$txt[227].'</b>: '.$team['location'].'<br />' : '';

echo !empty($team['website']['title']) ? '<b>'.$txt[96].'</b>: <a href="'.$team['website']['url'].'" target="_blank"><u>'.$team['website']['title'].'</u></a><br />' : '';

echo $team['online']['is_online'] ? '<img src="'.$team['online']['image_href'].'" alt="" /> '.$team['online']['text'].'<br />' : $team['online']['text'].'<br />';



echo '
</td>';

$newrow++;
if($newrow>1){
$newrow=0;
echo '</tr><tr><td colspan="4"></td></tr><tr>';
}
        }
if($newrow=1) echo '<td colspan="2"></td>';
echo '</tr>';
}

}
echo '</table>';
Title: Re: Add a group to this code
Post by: JPDeni on April 13, 2007, 11:37:37 PM
I think I know what your problem was, but if it's working now, it must not be a problem. Still...

You have

$extra_links = array();
$extra_links['3'] = '5';
$extra_links['2'] = '11';


I think it's looking for $extra_links['1'], $extra_links['5'] and $extra_links['4']. If they're all equal to 0, you should still set them. Also, you don't need to have all of those single quotes.


$extra_links = array();
$extra_links[1] = 0;
$extra_links[2] = 11;
$extra_links[3] = 5;
$extra_links[4] = 0;
$extra_links[5] = 0;
Title: Re: Add a group to this code
Post by: Brian on April 14, 2007, 04:22:23 AM
Thank You very much that seemed to work.  I put the code I deleted back in and I had to add one more line $extra_links[6] = 0; and I have no errors again.  With all the code I deleted to get the appearance I wanted I am sure it is doing a lot of things it doesn't need to but it is working with 0 errors.   
Thank You again
Title: Re: Add a group to this code
Post by: JPDeni on April 14, 2007, 05:05:57 AM
Good. :) I'm glad I was able to help.
Title: Re: Add a group to this code
Post by: ChetUbetcha on April 20, 2007, 08:42:56 PM
I have been using this code for my Intranet site roster and it's great.  I also have the Custom Fields Mod and added Phone, Pager, Cell, etc.  How do I pull the items from the Custom Fields Mod database table to display those fields in this roster?
Title: Re: Add a group to this code
Post by: JPDeni on April 21, 2007, 01:24:16 AM
QuoteHow do I pull the items from the Custom Fields Mod database table to display those fields in this roster?
That will take a little work. In general, as you go through the loop to display the data for each person, you'll have to access the "settings" table that holds the custom fields to pull the info.

I'll look at it tomorrow. I'm a bit tired tonight.
Title: Re: Add a group to this code
Post by: geekincsupport on April 21, 2007, 02:20:00 AM
How would I make this display within its own tab?
Title: Re: Add a group to this code
Post by: Shadow on April 21, 2007, 03:02:55 AM
How does this code work?
Title: Re: Add a group to this code
Post by: JPDeni on April 21, 2007, 03:22:38 PM
ChetUbetcha, there's a lot of code floating around in this topic. It would probably be best if you posted the code you're using, so I can start from there.

Miles, I don't know what you mean. If you want tabbed content in a block, look for the topic about tabbed content for information about how to do it.

Shadow Queen, are you asking what it does? It lists the admins and moderators of a site. Usually the best way to find out what a given piece of code does is to try it out. If you don't want it after you see it, you can just delete it.
Title: Re: Add a group to this code
Post by: Shadow on April 21, 2007, 04:01:45 PM
Alright, Where at I can found the correct code?  And which box I have to use.  I like to try it out.
Title: Re: Add a group to this code
Post by: JPDeni on April 21, 2007, 05:38:40 PM
First, almost everything posted on this board with code is php, unless it says it should go in a scriptbox. This is best in a php article.

As for which code to try, read the posts. Experiment. If one doesn't work, try another one, or apply the fixes to the code that follow it. That is the best way to learn.
Title: Re: Add a group to this code
Post by: Shadow on April 21, 2007, 05:39:49 PM
Alright, You are correct about that one. I am going to try each code out to see which one work.
Title: Re: Add a group to this code
Post by: geekincsupport on April 22, 2007, 01:22:19 AM
Ok, My First question is how do I get the code presentable in this format.

Color= Status of group = Milesâ„¢
Last seen: Today at 5:17 PM
Posts: 157
Position: Administrator
Location: Eugene, Oregon
Website: www.geekinc.info
[Online icon]Offline
Bio/quote etc..

The Code I am using

global $txt, $scripturl, $user_info;
global $context, $modSettings, $ID_MEMBER;
global $board_info, $settings, $db_prefix;

/////////////////////////////////////////////////////////////////  Enter the desired groups in order of Appearance
$groups_list = array(12, 11, 9, 10, 25);
/////////////////////////////////////////////////////////////////

        echo '<table align="center" width="95%" cellpadding="0" cellspacing="0"><tr>
                <td style="border-bottom: 2px solid #d0d0d0; padding-bottom: 4px; "><h2>Meet the team!</h2>
<span class="smalltext">The people you will run into while visiting GeekInc.info</span><br /><br />
</td></tr></table>';



foreach($groups_list as $groupnumber)
{

$loaded_ids = array();
    $user_profile=array();
    $memberContext=array();
    $profile=array();
    $context['TPortal']['team']=array();

// get the name of the group
$request = db_query("
                        SELECT groupName FROM {$db_prefix}membergroups WHERE ID_GROUP=$groupnumber", __FILE__, __LINE__);
if(mysql_num_rows($request)>0){
$row = mysql_fetch_row($request);
$groupname=$row[0];
mysql_free_result($request);
}


$select_columns = "
IFNULL(lo.logTime, 0) AS isOnline, IFNULL(a.ID_ATTACH, 0) AS ID_ATTACH, a.filename, a.attachmentType,
mem.personalText, mem.avatar, mem.ID_MEMBER, mem.memberName,
mem.realName,mem.lastLogin, mem.websiteTitle, mem.websiteUrl, mem.location,   
                        mem.posts,
                        them.value AS teamtext";
$select_tables = "
LEFT JOIN {$db_prefix}log_online AS lo ON (lo.ID_MEMBER = mem.ID_MEMBER)
LEFT JOIN {$db_prefix}attachments AS a ON (a.ID_MEMBER = mem.ID_MEMBER)
                        LEFT JOIN {$db_prefix}themes AS them ON (mem.ID_MEMBER = them.ID_MEMBER AND them.variable = 'teamtext' AND them.ID_THEME=1)";

// Load the member's data.
$request = db_query("
SELECT$select_columns
FROM {$db_prefix}members AS mem$select_tables
WHERE mem.ID_GROUP = $groupnumber
                        ORDER BY mem.memberName ASC", __FILE__, __LINE__);
$new_loaded_ids = array();
while ($row = mysql_fetch_assoc($request))
{

$avatar_width = '';
$avatar_height = '';

$context['TPortal']['team'][] = array(
'username' => $row['memberName'],
'name' => $row['realName'],
'groupname' => $groupname,
'posts' => $row['posts'],
'location' => $row['location'],
'href' => $scripturl . '?action=profile;u=' . $row['ID_MEMBER'],
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '" title="' . $txt[92] . ' ' . $row['realName'] . '">' . $row['realName'] . '</a>',
'blurb' => $row['personalText'],
'avatar' => array(
'name' => $row['avatar'],
'image' => $row['avatar'] == '' ? ($row['ID_ATTACH'] > 0 ? '<img  src="' . (empty($row['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $row['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) . '" alt="" class="avatar2" border="0" />' : '') : (stristr($row['avatar'], 'http://') ? '<img src="' . $row['avatar'] . '"' . $avatar_width . $avatar_height . ' alt="" class="avatar2" border="0" />' : '<img src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($row['avatar']) . '" alt="" class="avatar2" border="0" />'),
'href' => $row['avatar'] == '' ? ($row['ID_ATTACH'] > 0 ? (empty($row['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $row['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) : '') : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar']),
'url' => $row['avatar'] == '' ? '' : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar'])
),
'last_login' => empty($row['lastLogin']) ? $txt['never'] : timeformat($row['lastLogin']),
'last_login_timestamp' => empty($row['lastLogin']) ? 0 : forum_time(0, $row['lastLogin']),
'website' => array(
'title' => $row['websiteTitle'],
'url' => $row['websiteUrl']),
'online' => array(
'is_online' => $row['isOnline'],
'text' => &$txt[$row['isOnline'] ? 'online2' : 'online3'],
'image_href' => $settings['images_url'] . '/' . ($row['isOnline'] ? 'useron' : 'useroff') . '.gif',
),
'teamtext' => $row['teamtext'],
);


}
mysql_free_result($request);





echo '<table align="center" width="95%" cellpadding="5" cellspacing="5"><tr>
<td colspan="4" style="border-bottom: 2px solid #d0d0d0; padding-bottom: 4px; "><h2>' . $groupname . '</h2>
</td></tr><tr><td colspan="4"><br /> </td></tr><tr>';


        $newrow=0;
foreach($context['TPortal']['team'] as $team)
        {
            echo '
<td valign="top">'.$team['avatar']['image'].'</td>
<td valign="top" width="50%" class="middletext" style="padding: 5px;">
<h2 style="margin-top: 0; margin-bottom: 6px;">'.$team['link'].'</h2>
<b>Last seen</b>: '.$team['last_login'].'<br />
<b>Posts</b>: '.$team['posts'].'<br />
' , !empty($team['location']) ? '<b>Location</b>: '.$team['location'].'<br />' : '' , '
' , !empty($team['website']['title']) ? '<b>Website</b>: <a href="'.$team['website']['url'].'" target="_blank">'.$team['website']['title'].'</a><br />' : '' , '
' ,  $team['online']['is_online'] ? '<img src="'.$team['online']['image_href'].'" alt="" /> '.$team['online']['text'].'<br />' : $team['online']['text'].'<br />' , '

' , !empty($team['blurb']) ? '<i>- '.$team['blurb'].'</i><br />' : '' , '

' ,  !empty($team['teamtext']) ? $team['teamtext'].'<br />' : '' , '

    </div></td>';
            $newrow++;
            if($newrow>1){
               $newrow=0;
               echo '</tr><tr><td colspan="4"><br /><br /> </td></tr><tr>';
            }
        }
echo '</tr></table>';


2) Question : I want to have it's own tab within the Navigation Meet The Team page how can I create an individual Block that I can link via the navigation

Title: Re: Add a group to this code
Post by: JPDeni on April 22, 2007, 02:10:42 AM
I don't know what

QuoteColor= Status of group = Milesâ„¢

means. I'll need you to explain.

As for the tabs, someone else will have to help you with that. I don't do javascript. :)
Title: Re: Add a group to this code
Post by: geekincsupport on April 22, 2007, 02:12:55 AM
Color of the memergroup I am in on my forum for example The color of my name is red
the developer's color is orange etc..
but there name would appear that color on the team page

as for the block how do I make an individual block that I can link to a tab no center or left or right block just a plain page that I Can link it to the team page
Title: Re: Add a group to this code
Post by: JPDeni on April 22, 2007, 05:07:15 AM
QuoteColor of the memergroup
Oh, okay. I think that's doable.

What about "status of group"?

If you want to make just a plain page, make a php article. If that's not what you need, we'll have to wait for someone else to figure it out.
Title: Re: Add a group to this code
Post by: geekincsupport on April 22, 2007, 05:42:07 AM
Status of the group was just refering, to the color of the member group
Miles <==Red because thats whats defined in the membergroup for admins
As for the individual page I just want the team page linked
Title: Re: Add a group to this code
Post by: geekincsupport on April 23, 2007, 09:45:12 AM
is there anyone else who can help me with this code?
Title: Re: Add a group to this code
Post by: geekincsupport on April 25, 2007, 02:18:50 AM
Please don't hijack this topic and make it your own, Jpdeni had surgery can anyone else help me with the above code?
Title: Re: Add a group to this code
Post by: joh87swe on May 26, 2007, 03:06:35 AM
I use this code which was given earlier in this threas and it works great but with one error:
First the code:
global $txt, $scripturl, $user_info, $context, $modSettings, $ID_MEMBER, $board_info, $settings, $db_prefix;

////////////////////////////////////////  Enter the desired groups - in order of appearance, if listing by group
$groups_list = array(10);
////////////////////////////////////////

$list_by_group = true; // 'true' for separate sections by group; 'false' for consolidated list
$include_nonprimary_groups = true; // 'true' to check for group membership in additional groups; 'false' for primary only
$include_post_groups = false; // 'true' to include post-count based group in membership search
$include_moderators = false; // 'true' to include board moderators on page
$repeats_allowed = false; // 'true' to allow multiple appearances by member on page (for $list_by_group = true only)

$sort_by = 'name'; // choices - 'id' ascending(default), 'posts' descending, 'name' ascending

$extra_type = 'none'; // choices - 'none'(default), 'board' links, 'page' (article) links
///////////////////
// Format - $extra_links['<member userid #>'] = '<forum board #>';
//       or $extra_links['<member userid #>'] = '<TP article #>';
$extra_links = array();
$extra_links['3'] = '5';
$extra_links['2'] = '11';

$extra_label_prefix = 'Page of '; // text to precede member's name in link label for extra link
$extra_label_suffix = ''; // text to append to member's name in link label for extra link

$page_title = 'Lista på alla användare som har donerat till ***.com';
$page_subtitle = 'Vi tackar alla som donerat och som hjälper ***.com att finansieras.';

$moderator_group = 3;
///////////////////////////////////////////////////////////////////////////////////////

$sort_ord = 'mem.ID_MEMBER ASC';
if ($sort_by == 'posts') $sort_ord = 'mem.posts DESC';
if ($sort_by == 'name') $sort_ord = 'mem.realName ASC';

if (($extra_type != 'board') && ($extra_type != 'page')) $extra_type = 'none';

if ($include_moderators)
{if (!in_array($moderator_group, $groups_list)) $groups_list[] = $moderator_group;}

$groups_to_use = array();
if ($list_by_group)
{$groups_to_use = $groups_list;}
else
{$groups_to_use[] = 0;}

$users_already_listed = array();
$users_already_listed[] = 0;

loadLanguage('Profile');

echo '<table align="center" width="96%" cellpadding="3" cellspacing="2"><tr>
<td colspan="4"><center><h2>', $page_title, '</h2></center>
<span class="smalltext"><center>', $page_subtitle, '</center></span><br /></td></tr>';

if (!$list_by_group)
echo '<tr><td colspan="4"><br /></td></tr><tr width="95%" style="margin-top: 4px;">
<td class="windowbg3" colspan="4" style="border-top: 2px solid #d0d0d0; padding-top: 4px; "><h2> </h2>
</td></tr>';

foreach($groups_to_use as $groupnumber)
{
$loaded_ids = array();
$user_profile=array();
$memberContext=array();
$profile=array();
$context['TPortal']['team']=array();

// get the name of the group
$request = db_query("
SELECT groupName FROM {$db_prefix}membergroups WHERE ID_GROUP=$groupnumber", __FILE__, __LINE__);
if(mysql_num_rows($request)>0){
$row = mysql_fetch_row($request);
$groupNameX=$row[0];
mysql_free_result($request);
}

if ($list_by_group) {
$select_where = 'mem.ID_GROUP = '.$groupnumber;
if ($include_nonprimary_groups) $select_where .= ' OR FIND_IN_SET('.$groupnumber.', mem.additionalGroups)';
if ($include_post_groups) $select_where .= ' OR mem.ID_POST_GROUP = '.$groupnumber;
if ($include_moderators && ($groupnumber == $moderator_group)) $select_where = 'mem.ID_MEMBER = m.ID_MEMBER';
}
else {
$select_where = 'mem.ID_GROUP IN (' . implode(', ', $groups_list) . ')';
if ($include_nonprimary_groups) $select_where .= ' OR FIND_IN_SET(' . implode(', mem.additionalGroups) OR FIND_IN_SET(', $groups_list) . ', mem.additionalGroups)';
if ($include_post_groups) $select_where .= ' OR mem.ID_POST_GROUP IN (' . implode(', ', $groups_list) . ')';
if ($include_moderators) $select_where .= 'OR mem.ID_MEMBER = m.ID_MEMBER';
}

$select_where = '(' . $select_where . ') AND mem.ID_MEMBER NOT IN (' . implode(', ', $users_already_listed) . ')';

// Load the member's data.
$request = db_query("
SELECT IFNULL(lo.logTime, 0) AS isOnline, IFNULL(a.ID_ATTACH, 0) AS ID_ATTACH, a.filename, a.attachmentType,
mem.personalText, mem.avatar, mem.additionalGroups, mem.ID_MEMBER as memnum, mem.memberName, mem.ID_GROUP,
mem.usertitle, mem.karmaBad, mem.karmaGood, mem.realName, mem.lastLogin, mem.websiteTitle,
mem.websiteUrl, mem.location, mem.posts, them.value AS teamtext, m.ID_MEMBER as modmem, g.groupName
FROM ({$db_prefix}members AS mem)
LEFT JOIN {$db_prefix}moderators AS m ON (m.ID_MEMBER = mem.ID_MEMBER)
LEFT JOIN {$db_prefix}membergroups AS g ON (g.ID_GROUP = mem.ID_GROUP)
LEFT JOIN {$db_prefix}log_online AS lo ON (lo.ID_MEMBER = mem.ID_MEMBER)
LEFT JOIN {$db_prefix}attachments AS a ON (a.ID_MEMBER = mem.ID_MEMBER)
LEFT JOIN {$db_prefix}themes AS them ON (mem.ID_MEMBER = them.ID_MEMBER AND them.variable = 'teamtext' AND them.ID_THEME=1)
WHERE $select_where
GROUP BY mem.ID_MEMBER
ORDER BY $sort_ord", __FILE__, __LINE__);
$new_loaded_ids = array();
$member_count = 0;

while ($row = mysql_fetch_assoc($request))
{
if (!$repeats_allowed) $users_already_listed[$row['memnum']] = $row['memnum'];

$member_count += 1;

$avatar_width = '';
$avatar_height = '';
if($context['browser']['is_ie6']) $avatar_width = 'width="' . $modSettings['avatar_max_width_external'] . '"';

$context['TPortal']['team'][] = array(
'username' => $row['memberName'],
'usertitle' => $row['usertitle'],
'name' => $row['realName'],
'groupname' => ($groupnumber == 0) ? $row['groupName'] : $groupNameX ,
'posts' => $row['posts'],
'karmabad' => $row['karmaBad'],
'karmagood' => $row['karmaGood'],
'location' => $row['location'],
'href' => $scripturl . '?action=profile;u=' . $row['memnum'],
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['memnum'] . '" title="' . $txt[92] . ' ' . $row['realName'] . '">' . $row['realName'] . '</a>',
'blurb' => $row['personalText'],
'avatar' => array(
'name' => $row['avatar'],
'image' => $row['avatar'] == '' ? ($row['ID_ATTACH'] > 0 ? '<img  src="' . (empty($row['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $row['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) . '" alt="" style="max-height:280px;max-width:180px;" border="0" />' : '') : (stristr($row['avatar'], 'http://') ? '<img src="' . $row['avatar'] . '"' . $avatar_width . $avatar_height . ' alt="" style="max-height:280px;max-width:180px;" border="0" />' : '<img src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($row['avatar']) . '" alt="" style="max-height:280px;max-width:180px;" border="0" />'),
'href' => $row['avatar'] == '' ? ($row['ID_ATTACH'] > 0 ? (empty($row['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $row['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) : '') : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar']),
'url' => $row['avatar'] == '' ? '' : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar'])
),
'last_login' => empty($row['lastLogin']) ? $txt['never'] : timeformat($row['lastLogin']),
'last_login_timestamp' => empty($row['lastLogin']) ? 0 : forum_time(0, $row['lastLogin']),
'website' => array(
'title' => $row['websiteTitle'],
'url' => $row['websiteUrl']
),
'online' => array(
'is_online' => $row['isOnline'],
'text' => &$txt[$row['isOnline'] ? 'online2' : 'online3'],
'image_href' => $settings['images_url'] . '/' . ($row['isOnline'] ? 'useron' : 'useroff') . '.gif',
),
'teamtext' => $row['teamtext'],
'member_page' => ($extra_type == 'none') ? '' : empty($extra_links[$row['memnum']]) ? '' : $extra_links[$row['memnum']],
);

}
mysql_free_result($request);

if ($member_count > 0)
{
if ($list_by_group)
echo '<tr><td colspan="4"><br /></td></tr><tr width="95%" style="margin-top: 4px;">
<td class="windowbg3" colspan="4" style="border-top: 2px solid #d0d0d0; padding-top: 4px; "><h2>' . $groupNameX . '</h2>
</td></tr>';

echo '<tr>';
        $newrow=0;

foreach($context['TPortal']['team'] as $team)
        {
echo '
<td valign="top" width="18%">'.$team['avatar']['image'].'</td>';

echo ' <td valign="top" class="middletext" style="padding: 2px;">';

echo '<h2 style="margin-top: 0; margin-bottom: 4px;"><b>'.$team['link'].'</b></h2>';

echo '<b>'. $team['usertitle'].'</b><br />';

if (!$list_by_group)
echo '<b>'.$txt[87].'</b>: '.$team['groupname'].'<br />';

if ($modSettings['karmaMode'] == '1')
echo '<b>', $modSettings['karmaLabel'], '</b> ', $team['karmagood'] - $team['karmabad'], '<br />';
elseif ($modSettings['karmaMode'] == '2')
echo '<b>', $modSettings['karmaLabel'], '</b> +', $team['karmagood'], ' | -', $team['karmabad'], '<br />';

echo '<b>'.$txt['lastLoggedIn'].'</b>: '.$team['last_login'].'<br />';

echo !empty($team['location']) ? '<b>'.$txt[227].'</b>: '.$team['location'].'<br />' : '';

echo !empty($team['website']['title']) ? '<b>'.$txt[96].'</b>: <a href="'.$team['website']['url'].'" target="_blank"><u>'.$team['website']['title'].'</u></a><br />' : '';

echo $team['online']['is_online'] ? '<img src="'.$team['online']['image_href'].'" alt="" /> '.$team['online']['text'].'<br />' : $team['online']['text'].'<br />';

echo '<b>'.$txt[86].'</b>: '.$team['posts'].'<br />';

echo !empty($team['blurb']) ? '<i>'.$team['blurb'].'</i><br />' : '';

echo !empty($team['teamtext']) ? $team['teamtext'].'<br />' : '';

if (($extra_type == 'board') && !empty($team['member_page']))
echo '<a href="' . $scripturl . '?board=' . $team['member_page'] . '"><u>'. $extra_label_prefix . $team['name'] . $extra_label_suffix . '</u></a><br />';
if (($extra_type == 'page') && !empty($team['member_page']))
echo '<a href="' . $scripturl . '?page=' . $team['member_page'] . '"><u>'. $extra_label_prefix . $team['name'] . $extra_label_suffix . '</u></a><br />';

echo '
</td>';

$newrow++;
if($newrow>1){
$newrow=0;
echo '</tr><tr><td colspan="4"></td></tr><tr>';
}
        }
if($newrow=1) echo '<td colspan="2"></td>';
echo '</tr>';
}

}
echo '</table>';


The error in the logs:
http://www.***.com/index.php?dummy=1&amp;page=44 
8: Undefined index: 119
File: /var/www/html/Themes/default/languages/Profile.swedish.php (eval?)
Line: 151

Could anyone help me with this?
Title: Re: Add a group to this code
Post by: IchBin on May 26, 2007, 04:26:14 AM
I don't think that error has any thing to do with the code.
Title: Re: Add a group to this code
Post by: jacortina on May 26, 2007, 04:30:39 AM
About the only thing I can think of is if there's something about your Preofile.swedish.php file itself which tries to reference something with the "119" index (because I can't find anything in this code which does). This code DOES load that language file, which would expose any problem there.

I would suggest looking around line 151 in that file.
Title: Re: Add a group to this code
Post by: geekincsupport on June 02, 2007, 08:48:15 AM
I am using the following code and I would like my page to look like the following format

Color= Status of group = Milesâ„¢
Last seen: Today at 5:17 PM
Posts: 157
Position: Administrator
Location: Eugene, Oregon
Website: www.geekinc.info
[Online icon]Offline
Bio/quote etc..

global $txt, $scripturl, $user_info;
global $context, $modSettings, $ID_MEMBER;
global $board_info, $settings, $db_prefix;

/////////////////////////////////////////////////////////////////  Enter the desired groups in order of Appearance
$groups_list = array(12, 11, 9, 10, 25);
/////////////////////////////////////////////////////////////////

        echo '<table align="center" width="95%" cellpadding="0" cellspacing="0"><tr>
                <td style="border-bottom: 2px solid #d0d0d0; padding-bottom: 4px; "><h2>Meet the team!</h2>
<span class="smalltext">The people you will run into while visiting GeekInc.info</span><br /><br />
</td></tr></table>';



foreach($groups_list as $groupnumber)
{

$loaded_ids = array();
    $user_profile=array();
    $memberContext=array();
    $profile=array();
    $context['TPortal']['team']=array();

// get the name of the group
$request = db_query("
                        SELECT groupName FROM {$db_prefix}membergroups WHERE ID_GROUP=$groupnumber", __FILE__, __LINE__);
if(mysql_num_rows($request)>0){
$row = mysql_fetch_row($request);
$groupname=$row[0];
mysql_free_result($request);
}


$select_columns = "
IFNULL(lo.logTime, 0) AS isOnline, IFNULL(a.ID_ATTACH, 0) AS ID_ATTACH, a.filename, a.attachmentType,
mem.personalText, mem.avatar, mem.ID_MEMBER, mem.memberName,
mem.realName,mem.lastLogin, mem.websiteTitle, mem.websiteUrl, mem.location,   
                        mem.posts,
                        them.value AS teamtext";
$select_tables = "
LEFT JOIN {$db_prefix}log_online AS lo ON (lo.ID_MEMBER = mem.ID_MEMBER)
LEFT JOIN {$db_prefix}attachments AS a ON (a.ID_MEMBER = mem.ID_MEMBER)
                        LEFT JOIN {$db_prefix}themes AS them ON (mem.ID_MEMBER = them.ID_MEMBER AND them.variable = 'teamtext' AND them.ID_THEME=1)";

// Load the member's data.
$request = db_query("
SELECT$select_columns
FROM {$db_prefix}members AS mem$select_tables
WHERE mem.ID_GROUP = $groupnumber
                        ORDER BY mem.memberName ASC", __FILE__, __LINE__);
$new_loaded_ids = array();
while ($row = mysql_fetch_assoc($request))
{

$avatar_width = '';
$avatar_height = '';

$context['TPortal']['team'][] = array(
'username' => $row['memberName'],
'name' => $row['realName'],
'groupname' => $groupname,
'posts' => $row['posts'],
'location' => $row['location'],
'href' => $scripturl . '?action=profile;u=' . $row['ID_MEMBER'],
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '" title="' . $txt[92] . ' ' . $row['realName'] . '">' . $row['realName'] . '</a>',
'blurb' => $row['personalText'],
'avatar' => array(
'name' => $row['avatar'],
'image' => $row['avatar'] == '' ? ($row['ID_ATTACH'] > 0 ? '<img  src="' . (empty($row['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $row['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) . '" alt="" class="avatar2" border="0" />' : '') : (stristr($row['avatar'], 'http://') ? '<img src="' . $row['avatar'] . '"' . $avatar_width . $avatar_height . ' alt="" class="avatar2" border="0" />' : '<img src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($row['avatar']) . '" alt="" class="avatar2" border="0" />'),
'href' => $row['avatar'] == '' ? ($row['ID_ATTACH'] > 0 ? (empty($row['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $row['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) : '') : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar']),
'url' => $row['avatar'] == '' ? '' : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar'])
),
'last_login' => empty($row['lastLogin']) ? $txt['never'] : timeformat($row['lastLogin']),
'last_login_timestamp' => empty($row['lastLogin']) ? 0 : forum_time(0, $row['lastLogin']),
'website' => array(
'title' => $row['websiteTitle'],
'url' => $row['websiteUrl']),
'online' => array(
'is_online' => $row['isOnline'],
'text' => &$txt[$row['isOnline'] ? 'online2' : 'online3'],
'image_href' => $settings['images_url'] . '/' . ($row['isOnline'] ? 'useron' : 'useroff') . '.gif',
),
'teamtext' => $row['teamtext'],
);


}
mysql_free_result($request);





echo '<table align="center" width="95%" cellpadding="5" cellspacing="5"><tr>
<td colspan="4" style="border-bottom: 2px solid #d0d0d0; padding-bottom: 4px; "><h2>' . $groupname . '</h2>
</td></tr><tr><td colspan="4"><br /> </td></tr><tr>';


        $newrow=0;
foreach($context['TPortal']['team'] as $team)
        {
            echo '
<td valign="top">'.$team['avatar']['image'].'</td>
<td valign="top" width="50%" class="middletext" style="padding: 5px;">
<h2 style="margin-top: 0; margin-bottom: 6px;">'.$team['link'].'</h2>
<b>Last seen</b>: '.$team['last_login'].'<br />
<b>Posts</b>: '.$team['posts'].'<br />
' , !empty($team['location']) ? '<b>Location</b>: '.$team['location'].'<br />' : '' , '
' , !empty($team['website']['title']) ? '<b>Website</b>: <a href="'.$team['website']['url'].'" target="_blank">'.$team['website']['title'].'</a><br />' : '' , '
' ,  $team['online']['is_online'] ? '<img src="'.$team['online']['image_href'].'" alt="" /> '.$team['online']['text'].'<br />' : $team['online']['text'].'<br />' , '

' , !empty($team['blurb']) ? '<i>- '.$team['blurb'].'</i><br />' : '' , '

' ,  !empty($team['teamtext']) ? $team['teamtext'].'<br />' : '' , '

    </div></td>';
            $newrow++;
            if($newrow>1){
               $newrow=0;
               echo '</tr><tr><td colspan="4"><br /><br /> </td></tr><tr>';
            }
        }
echo '</tr></table>';
Title: Re: Add a group to this code
Post by: geekincsupport on June 02, 2007, 11:53:34 PM
Any takers?
Title: Re: Add a group to this code
Post by: jacortina on June 03, 2007, 12:33:48 AM
Does "Color= Status of group =" mean you want the name to have the primary membergroup color?

Does "Position:" indicate membergroup name? This list does come out in membergroup order.

Title: Re: Add a group to this code
Post by: geekincsupport on June 03, 2007, 12:50:12 AM
Yes, And yes I want it to turn out like this
I want Admins And Moderators to be Displayed and how would I add other groups in the future?
See www.geekinc.info like that but only with the below format and with admins then moderators

Color= Status of group = Milesâ„¢
Last seen: Today at 5:17 PM
Posts: 157
Position: Administrator
Location: Eugene, Oregon
Website: www.geekinc.info
[Online icon]Offline
Bio/quote etc..
Title: Re: Add a group to this code
Post by: jacortina on June 03, 2007, 01:30:28 AM
Try this:

global $txt, $scripturl, $user_info;
global $context, $modSettings, $ID_MEMBER;
global $board_info, $settings, $db_prefix;

/////////////////////////////////////////////////////////////////  Enter the desired groups in order of Appearance
$groups_list = array(1, 13, 9, 10, 25);
/////////////////////////////////////////////////////////////////

        echo '<table align="center" width="95%" cellpadding="0" cellspacing="0"><tr>
                <td style="border-bottom: 2px solid #d0d0d0; padding-bottom: 4px; "><h2>Meet the team!</h2>
<span class="smalltext">The people you will run into while visiting GeekInc.info</span><br /><br />
</td></tr></table>';



foreach($groups_list as $groupnumber)
{

$loaded_ids = array();
    $user_profile=array();
    $memberContext=array();
    $profile=array();
    $context['TPortal']['team']=array();

// get the name of the group
$request = db_query("
                        SELECT groupName, onlineColor FROM {$db_prefix}membergroups WHERE ID_GROUP=".$groupnumber, __FILE__, __LINE__);
$row = mysql_fetch_assoc($request);
$groupname => $row['groupName'];
$grpcolor=$row['onlineColor'];
mysql_free_result($request);

$select_columns = "
IFNULL(lo.logTime, 0) AS isOnline, IFNULL(a.ID_ATTACH, 0) AS ID_ATTACH, a.filename, a.attachmentType,
mem.personalText, mem.avatar, mem.ID_MEMBER, mem.memberName,
mem.realName,mem.lastLogin, mem.websiteTitle, mem.websiteUrl, mem.location,   
                        mem.posts,
                        them.value AS teamtext";
$select_tables = "
LEFT JOIN {$db_prefix}log_online AS lo ON (lo.ID_MEMBER = mem.ID_MEMBER)
LEFT JOIN {$db_prefix}attachments AS a ON (a.ID_MEMBER = mem.ID_MEMBER)
                        LEFT JOIN {$db_prefix}themes AS them ON (mem.ID_MEMBER = them.ID_MEMBER AND them.variable = 'teamtext' AND them.ID_THEME=1)";

// Load the member's data.
$request = db_query("
SELECT$select_columns
FROM {$db_prefix}members AS mem$select_tables
WHERE mem.ID_GROUP = $groupnumber
                        ORDER BY mem.memberName ASC", __FILE__, __LINE__);
$new_loaded_ids = array();
while ($row = mysql_fetch_assoc($request))
{

$avatar_width = '';
$avatar_height = '';

$context['TPortal']['team'][] = array(
'username' => $row['memberName'],
'name' => $row['realName'],
'groupname' => $groupname,
'posts' => $row['posts'],
'location' => $row['location'],
'href' => $scripturl . '?action=profile;u=' . $row['ID_MEMBER'],
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '" title="' . $txt[92] . ' ' . $row['realName'] . '"><font color="'.$grpcolor.'">' . $row['realName'] . '</font></a>',
'blurb' => $row['personalText'],
'avatar' => array(
'name' => $row['avatar'],
'image' => $row['avatar'] == '' ? ($row['ID_ATTACH'] > 0 ? '<img  src="' . (empty($row['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $row['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) . '" alt="" class="avatar2" border="0" />' : '') : (stristr($row['avatar'], 'http://') ? '<img src="' . $row['avatar'] . '"' . $avatar_width . $avatar_height . ' alt="" class="avatar2" border="0" />' : '<img src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($row['avatar']) . '" alt="" class="avatar2" border="0" />'),
'href' => $row['avatar'] == '' ? ($row['ID_ATTACH'] > 0 ? (empty($row['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $row['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) : '') : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar']),
'url' => $row['avatar'] == '' ? '' : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar'])
),
'last_login' => empty($row['lastLogin']) ? $txt['never'] : timeformat($row['lastLogin']),
'last_login_timestamp' => empty($row['lastLogin']) ? 0 : forum_time(0, $row['lastLogin']),
'website' => array(
'title' => $row['websiteTitle'],
'url' => $row['websiteUrl']),
'online' => array(
'is_online' => $row['isOnline'],
'text' => &$txt[$row['isOnline'] ? 'online2' : 'online3'],
'image_href' => $settings['images_url'] . '/' . ($row['isOnline'] ? 'useron' : 'useroff') . '.gif',
),
'teamtext' => $row['teamtext'],
);


}
mysql_free_result($request);





echo '<table align="center" width="95%" cellpadding="5" cellspacing="5"><tr>
<td colspan="4" style="border-bottom: 2px solid #d0d0d0; padding-bottom: 4px; "><h2>' . $groupname . '</h2>
</td></tr><tr><td colspan="4"><br /> </td></tr><tr>';


        $newrow=0;
foreach($context['TPortal']['team'] as $team)
        {
            echo '
<td valign="top">'.$team['avatar']['image'].'</td>
<td valign="top" width="50%" class="middletext" style="padding: 5px;">
<h2 style="margin-top: 0; margin-bottom: 6px;">'.$team['link'].'</h2>
<b>Last seen</b>: '.$team['last_login'].'<br />
<b>Posts</b>: '.$team['posts'].'<br />
<b>Position</b>: '.$team['groupname'].'<br />
' , !empty($team['location']) ? '<b>Location</b>: '.$team['location'].'<br />' : '' , '
' , !empty($team['website']['title']) ? '<b>Website</b>: <a href="'.$team['website']['url'].'" target="_blank">'.$team['website']['title'].'</a><br />' : '' , '
' ,  $team['online']['is_online'] ? '<img src="'.$team['online']['image_href'].'" alt="" /> '.$team['online']['text'].'<br />' : $team['online']['text'].'<br />' , '

' , !empty($team['blurb']) ? '<i>- '.$team['blurb'].'</i><br />' : '' , '

' ,  !empty($team['teamtext']) ? $team['teamtext'].'<br />' : '' , '

    </div></td>';
            $newrow++;
            if($newrow>1){
               $newrow=0;
               echo '</tr><tr><td colspan="4"><br /><br /> </td></tr><tr>';
            }
        }
    }
echo '</tr></table>';
Title: Re: Add a group to this code
Post by: geekincsupport on June 03, 2007, 01:45:12 AM
uhh now nothings working
www.geekinc.info
Title: Re: Add a group to this code
Post by: jacortina on June 03, 2007, 01:50:08 AM
Oops

Find:       $groupname => $row['groupName'];

Change to:      $groupname = $row['groupName'];
Title: Re: Add a group to this code
Post by: geekincsupport on June 03, 2007, 01:52:32 AM
Nice, Can you get it to were theres Admins then Moderators
Title: Re: Add a group to this code
Post by: jacortina on June 03, 2007, 02:00:03 AM
Admins are membergroup 1 and Global Moderators membergroup 2. Moderators of a board or multiple boards isn't actually a membergroup (though you might see code checking for group 3). The forum software treats moderators as an attribute of the given boards (rather than boards moderated being an attribute of members).

There are other team/roster pages here that can do it, but I'm not sure if any have membergroup colored names or an additional line for position.
Title: Re: Add a group to this code
Post by: geekincsupport on June 03, 2007, 11:41:02 AM
Ack this is so freaking confusing I just want it to display Admins, Then Moderators , Then any Addional groups I want to add gut like it is now
www.geekinc.info I dont want the stupid mac support in there gosh
and how do i add my small blurb?
Title: Re: Add a group to this code
Post by: geekincsupport on June 22, 2007, 07:04:45 AM
global $txt, $scripturl, $user_info;
global $context, $modSettings, $ID_MEMBER;
global $board_info, $settings, $db_prefix;

/////////////////////////////////////////////////////////////////  Enter the desired groups in order of Appearance
$groups_list = array(1, 13, 9, 10, 25);
/////////////////////////////////////////////////////////////////

        echo '<table align="center" width="95%" cellpadding="0" cellspacing="0"><tr>
                <td style="border-bottom: 2px solid #d0d0d0; padding-bottom: 4px; "><h2>Meet the team!</h2>
<span class="smalltext">The people you will run into while visiting GeekInc.info</span><br /><br />
</td></tr></table>';



foreach($groups_list as $groupnumber)
{

$loaded_ids = array();
    $user_profile=array();
    $memberContext=array();
    $profile=array();
    $context['TPortal']['team']=array();

// get the name of the group
$request = db_query("
                        SELECT groupName, onlineColor FROM {$db_prefix}membergroups WHERE ID_GROUP=".$groupnumber, __FILE__, __LINE__);
$row = mysql_fetch_assoc($request);
$groupname = $row['groupName'];;
$grpcolor=$row['onlineColor'];
mysql_free_result($request);

$select_columns = "
IFNULL(lo.logTime, 0) AS isOnline, IFNULL(a.ID_ATTACH, 0) AS ID_ATTACH, a.filename, a.attachmentType,
mem.personalText, mem.avatar, mem.ID_MEMBER, mem.memberName,
mem.realName,mem.lastLogin, mem.websiteTitle, mem.websiteUrl, mem.location,   
                        mem.posts,
                        them.value AS teamtext";
$select_tables = "
LEFT JOIN {$db_prefix}log_online AS lo ON (lo.ID_MEMBER = mem.ID_MEMBER)
LEFT JOIN {$db_prefix}attachments AS a ON (a.ID_MEMBER = mem.ID_MEMBER)
                        LEFT JOIN {$db_prefix}themes AS them ON (mem.ID_MEMBER = them.ID_MEMBER AND them.variable = 'teamtext' AND them.ID_THEME=1)";

// Load the member's data.
$request = db_query("
SELECT$select_columns
FROM {$db_prefix}members AS mem$select_tables
WHERE mem.ID_GROUP = $groupnumber
                        ORDER BY mem.memberName ASC", __FILE__, __LINE__);
$new_loaded_ids = array();
while ($row = mysql_fetch_assoc($request))
{

$avatar_width = '';
$avatar_height = '';

$context['TPortal']['team'][] = array(
'username' => $row['memberName'],
'name' => $row['realName'],
'groupname' => $groupname,
'posts' => $row['posts'],
'location' => $row['location'],
'href' => $scripturl . '?action=profile;u=' . $row['ID_MEMBER'],
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '" title="' . $txt[92] . ' ' . $row['realName'] . '"><font color="'.$grpcolor.'">' . $row['realName'] . '</font></a>',
'blurb' => $row['personalText'],
'avatar' => array(
'name' => $row['avatar'],
'image' => $row['avatar'] == '' ? ($row['ID_ATTACH'] > 0 ? '<img  src="' . (empty($row['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $row['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) . '" alt="" class="avatar2" border="0" />' : '') : (stristr($row['avatar'], 'http://') ? '<img src="' . $row['avatar'] . '"' . $avatar_width . $avatar_height . ' alt="" class="avatar2" border="0" />' : '<img src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($row['avatar']) . '" alt="" class="avatar2" border="0" />'),
'href' => $row['avatar'] == '' ? ($row['ID_ATTACH'] > 0 ? (empty($row['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $row['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) : '') : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar']),
'url' => $row['avatar'] == '' ? '' : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar'])
),
'last_login' => empty($row['lastLogin']) ? $txt['never'] : timeformat($row['lastLogin']),
'last_login_timestamp' => empty($row['lastLogin']) ? 0 : forum_time(0, $row['lastLogin']),
'website' => array(
'title' => $row['websiteTitle'],
'url' => $row['websiteUrl']),
'online' => array(
'is_online' => $row['isOnline'],
'text' => &$txt[$row['isOnline'] ? 'online2' : 'online3'],
'image_href' => $settings['images_url'] . '/' . ($row['isOnline'] ? 'useron' : 'useroff') . '.gif',
),
'teamtext' => $row['teamtext'],
);


}
mysql_free_result($request);





echo '<table align="center" width="95%" cellpadding="5" cellspacing="5"><tr>
<td colspan="4" style="border-bottom: 2px solid #d0d0d0; padding-bottom: 4px; "><h2>' . $groupname . '</h2>
</td></tr><tr><td colspan="4"><br /> </td></tr><tr>';


        $newrow=0;
foreach($context['TPortal']['team'] as $team)
        {
            echo '
<td valign="top">'.$team['avatar']['image'].'</td>
<td valign="top" width="50%" class="middletext" style="padding: 5px;">
<h2 style="margin-top: 0; margin-bottom: 6px;">'.$team['link'].'</h2>
<b>Last seen</b>: '.$team['last_login'].'<br />
<b>Posts</b>: '.$team['posts'].'<br />
<b>Position</b>: '.$team['groupname'].'<br />
' , !empty($team['location']) ? '<b>Location</b>: '.$team['location'].'<br />' : '' , '
' , !empty($team['website']['title']) ? '<b>Website</b>: <a href="'.$team['website']['url'].'" target="_blank">'.$team['website']['title'].'</a><br />' : '' , '
' ,  $team['online']['is_online'] ? '<img src="'.$team['online']['image_href'].'" alt="" /> '.$team['online']['text'].'<br />' : $team['online']['text'].'<br />' , '

' , !empty($team['blurb']) ? '<i>- '.$team['blurb'].'</i><br />' : '' , '

' ,  !empty($team['teamtext']) ? $team['teamtext'].'<br />' : '' , '

    </div></td>';
            $newrow++;
            if($newrow>1){
               $newrow=0;
               echo '</tr><tr><td colspan="4"><br /><br /> </td></tr><tr>';
            }
        }
    }
echo '</tr></table>';


I am using this code, I would like Moderators to show up next then Global Moderators how hard is that grr can someone please help with this I know this has been asked a billion times I tried searching and can't find it
Title: Re: Add a group to this code
Post by: IchBin on June 22, 2007, 01:23:49 PM
I don't think Moderators has a group ID. They inherit the permissions of the board. Don't quite think its very possible IMO.
Title: Re: Add a group to this code
Post by: geekincsupport on June 22, 2007, 01:59:56 PM
Well then Admins , Then Global Moderators?
Title: Re: Add a group to this code
Post by: IchBin on June 22, 2007, 03:40:02 PM
global mods is group ID #2. Just add that to the $groups_lists array at the top in the same number format.
$groups_list = array(1, 2, 13, 9, 10, 25);
Title: Re: Add a group to this code
Post by: geekincsupport on June 22, 2007, 04:05:44 PM
UHH, this doesn't look good I changed $groups_list = array(1, 13, 9, 10, 25); to
$groups_list = array(1, 2, 13, 9, 10, 25); and got a big mess  :o :o
http://www.geekinc.info/index.php?action=Team
Title: Re: Add a group to this code
Post by: IchBin on June 22, 2007, 04:38:34 PM
You must have deleted or changed something else without knowing. Can you post the whole code that you have now?
Title: Re: Add a group to this code
Post by: geekincsupport on June 22, 2007, 05:08:44 PM
global $txt, $scripturl, $user_info;
global $context, $modSettings, $ID_MEMBER;
global $board_info, $settings, $db_prefix;

/////////////////////////////////////////////////////////////////  Enter the desired groups in order of Appearance
$groups_list = array(1, 2, 13, 9, 10, 25);
/////////////////////////////////////////////////////////////////

        echo '<table align="center" width="95%" cellpadding="0" cellspacing="0"><tr>
                <td style="border-bottom: 2px solid #d0d0d0; padding-bottom: 4px; "><h2>Meet the team!</h2>
<span class="smalltext">The people you will run into while visiting GeekInc.info</span><br /><br />
</td></tr></table>';



foreach($groups_list as $groupnumber)
{

$loaded_ids = array();
    $user_profile=array();
    $memberContext=array();
    $profile=array();
    $context['TPortal']['team']=array();

// get the name of the group
$request = db_query("
                        SELECT groupName, onlineColor FROM {$db_prefix}membergroups WHERE ID_GROUP=".$groupnumber, __FILE__, __LINE__);
$row = mysql_fetch_assoc($request);
$groupname = $row['groupName'];;
$grpcolor=$row['onlineColor'];
mysql_free_result($request);

$select_columns = "
IFNULL(lo.logTime, 0) AS isOnline, IFNULL(a.ID_ATTACH, 0) AS ID_ATTACH, a.filename, a.attachmentType,
mem.personalText, mem.avatar, mem.ID_MEMBER, mem.memberName,
mem.realName,mem.lastLogin, mem.websiteTitle, mem.websiteUrl, mem.location,   
                        mem.posts,
                        them.value AS teamtext";
$select_tables = "
LEFT JOIN {$db_prefix}log_online AS lo ON (lo.ID_MEMBER = mem.ID_MEMBER)
LEFT JOIN {$db_prefix}attachments AS a ON (a.ID_MEMBER = mem.ID_MEMBER)
                        LEFT JOIN {$db_prefix}themes AS them ON (mem.ID_MEMBER = them.ID_MEMBER AND them.variable = 'teamtext' AND them.ID_THEME=1)";

// Load the member's data.
$request = db_query("
SELECT$select_columns
FROM {$db_prefix}members AS mem$select_tables
WHERE mem.ID_GROUP = $groupnumber
                        ORDER BY mem.memberName ASC", __FILE__, __LINE__);
$new_loaded_ids = array();
while ($row = mysql_fetch_assoc($request))
{

$avatar_width = '';
$avatar_height = '';

$context['TPortal']['team'][] = array(
'username' => $row['memberName'],
'name' => $row['realName'],
'groupname' => $groupname,
'posts' => $row['posts'],
'location' => $row['location'],
'href' => $scripturl . '?action=profile;u=' . $row['ID_MEMBER'],
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '" title="' . $txt[92] . ' ' . $row['realName'] . '"><font color="'.$grpcolor.'">' . $row['realName'] . '</font></a>',
'blurb' => $row['personalText'],
'avatar' => array(
'name' => $row['avatar'],
'image' => $row['avatar'] == '' ? ($row['ID_ATTACH'] > 0 ? '<img  src="' . (empty($row['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $row['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) . '" alt="" class="avatar2" border="0" />' : '') : (stristr($row['avatar'], 'http://') ? '<img src="' . $row['avatar'] . '"' . $avatar_width . $avatar_height . ' alt="" class="avatar2" border="0" />' : '<img src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($row['avatar']) . '" alt="" class="avatar2" border="0" />'),
'href' => $row['avatar'] == '' ? ($row['ID_ATTACH'] > 0 ? (empty($row['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $row['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) : '') : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar']),
'url' => $row['avatar'] == '' ? '' : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar'])
),
'last_login' => empty($row['lastLogin']) ? $txt['never'] : timeformat($row['lastLogin']),
'last_login_timestamp' => empty($row['lastLogin']) ? 0 : forum_time(0, $row['lastLogin']),
'website' => array(
'title' => $row['websiteTitle'],
'url' => $row['websiteUrl']),
'online' => array(
'is_online' => $row['isOnline'],
'text' => &$txt[$row['isOnline'] ? 'online2' : 'online3'],
'image_href' => $settings['images_url'] . '/' . ($row['isOnline'] ? 'useron' : 'useroff') . '.gif',
),
'teamtext' => $row['teamtext'],
);


}
mysql_free_result($request);





echo '<table align="center" width="95%" cellpadding="5" cellspacing="5"><tr>
<td colspan="4" style="border-bottom: 2px solid #d0d0d0; padding-bottom: 4px; "><h2>' . $groupname . '</h2>
</td></tr><tr><td colspan="4"><br /> </td></tr><tr>';


        $newrow=0;
foreach($context['TPortal']['team'] as $team)
        {
            echo '
<td valign="top">'.$team['avatar']['image'].'</td>
<td valign="top" width="50%" class="middletext" style="padding: 5px;">
<h2 style="margin-top: 0; margin-bottom: 6px;">'.$team['link'].'</h2>
<b>Last seen</b>: '.$team['last_login'].'<br />
<b>Posts</b>: '.$team['posts'].'<br />
<b>Position</b>: '.$team['groupname'].'<br />
' , !empty($team['location']) ? '<b>Location</b>: '.$team['location'].'<br />' : '' , '
' , !empty($team['website']['title']) ? '<b>Website</b>: <a href="'.$team['website']['url'].'" target="_blank">'.$team['website']['title'].'</a><br />' : '' , '
' ,  $team['online']['is_online'] ? '<img src="'.$team['online']['image_href'].'" alt="" /> '.$team['online']['text'].'<br />' : $team['online']['text'].'<br />' , '

' , !empty($team['blurb']) ? '<i>- '.$team['blurb'].'</i><br />' : '' , '

' ,  !empty($team['teamtext']) ? $team['teamtext'].'<br />' : '' , '

    </div></td>';
            $newrow++;
            if($newrow>1){
               $newrow=0;
               echo '</tr><tr><td colspan="4"><br /><br /> </td></tr><tr>';
            }
        }
    }
echo '</tr></table>';

is what i am using
Title: Re: Add a group to this code
Post by: IchBin on June 22, 2007, 05:32:23 PM
Check to see if your article type has changed. Make sure its still a php article. If it is, I may have to take a look at this. PM a temp admin account if you'd like.
Title: Re: Add a group to this code
Post by: geekincsupport on June 22, 2007, 05:37:54 PM
Ok, It works I had it selected as html lol my mistake
http://www.geekinc.info/index.php?action=Team
But site archeect and mac support need to go  as for adding more groups?

lets say I want 6 mods instead of 5
Title: Re: Add a group to this code
Post by: geekincsupport on June 22, 2007, 06:47:34 PM
hmm
Title: Re: Add a group to this code
Post by: IchBin on June 22, 2007, 10:40:30 PM
6 mods instead of 5? I don't get what you're saying, sorry.
Title: Re: Add a group to this code
Post by: geekincsupport on June 23, 2007, 04:01:43 AM
Like were it's displaying how many moderators are showing, Theres only 5 Can I display more
Title: Re: Add a group to this code
Post by: IchBin on June 23, 2007, 05:30:03 AM
Are you saying you have the global moderators group added and its not showing all of them?
Title: Re: Add a group to this code
Post by: Osmonicar on June 25, 2007, 03:00:08 PM

$select_columns = "
IFNULL(lo.logTime, 0) AS isOnline, IFNULL(a.ID_ATTACH, 0) AS ID_ATTACH, a.filename, a.attachmentType,
mem.personalText, mem.avatar, mem.ID_MEMBER, mem.memberName,
mem.realName,mem.lastLogin, mem.websiteTitle, mem.websiteUrl, mem.location,   
                        mem.posts,
                        them.value AS teamtext";


Because there is no veld white the name teamtext i renamed it to "woonplaats" (Dutch for City) and after that i get in the list the name of the City.

So a new question was born.

Is it posible to get the other colums for the them table, like the "Straatnaam" (Dutch for Streetname), "Huisnummer (Dutch for House number), "Postcode" (Dutch for Postcode), "Mobiel telefoon nummer" (Dutch for Mobile Number), "Vastnet telefoon nummer" (Dutch for Home Phone Number)

What i like is to place all the info from those velds under the rest of the output text. O and is it posible to get the vels discriptions in my own lang style? like in one of the post in thes topic.

here is the rest of my code:


global $txt, $scripturl, $user_info;
global $context, $modSettings, $ID_MEMBER;
global $board_info, $settings, $db_prefix;

/////////////////////////////////////////////////////////////////  Enter the desired groups in order of Appearance
$groups_list = array(21,25,19,23,22,26,20,24);
/////////////////////////////////////////////////////////////////

        echo '<table align="center" width="95%" cellpadding="0" cellspacing="0"><tr>
                <td style="border-bottom: 2px solid #d0d0d0; padding-bottom: 4px; "><h2>Meet the team!</h2>
<span class="smalltext">The people you will run into while visiting GeekInc.info</span><br /><br />
</td></tr></table>';



foreach($groups_list as $groupnumber)
{

$loaded_ids = array();
    $user_profile=array();
    $memberContext=array();
    $profile=array();
    $context['TPortal']['team']=array();

// get the name of the group
$request = db_query("
                        SELECT groupName, onlineColor FROM {$db_prefix}membergroups WHERE ID_GROUP=".$groupnumber, __FILE__, __LINE__);
$row = mysql_fetch_assoc($request);
$groupname = $row['groupName'];
$grpcolor=$row['onlineColor'];
mysql_free_result($request);

$select_columns = "
IFNULL(lo.logTime, 0) AS isOnline, IFNULL(a.ID_ATTACH, 0) AS ID_ATTACH, a.filename, a.attachmentType,
mem.personalText, mem.avatar, mem.ID_MEMBER, mem.memberName,
mem.realName,mem.lastLogin, mem.websiteTitle, mem.websiteUrl, mem.location,   
                        mem.posts,
                        them.value AS teamtext";
$select_tables = "
LEFT JOIN {$db_prefix}log_online AS lo ON (lo.ID_MEMBER = mem.ID_MEMBER)
LEFT JOIN {$db_prefix}attachments AS a ON (a.ID_MEMBER = mem.ID_MEMBER)
                        LEFT JOIN {$db_prefix}themes AS them ON (mem.ID_MEMBER = them.ID_MEMBER AND them.variable = 'teamtext' AND them.ID_THEME=1)";

// Load the member's data.
$request = db_query("
SELECT$select_columns
FROM {$db_prefix}members AS mem$select_tables
WHERE mem.ID_GROUP = $groupnumber
                        ORDER BY mem.memberName ASC", __FILE__, __LINE__);
$new_loaded_ids = array();
while ($row = mysql_fetch_assoc($request))
{

$avatar_width = '';
$avatar_height = '';

$context['TPortal']['team'][] = array(
'username' => $row['memberName'],
'name' => $row['realName'],
'groupname' => $groupname,
'posts' => $row['posts'],
'location' => $row['location'],
'href' => $scripturl . '?action=profile;u=' . $row['ID_MEMBER'],
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '" title="' . $txt[92] . ' ' . $row['realName'] . '"><font color="'.$grpcolor.'">' . $row['realName'] . '</font></a>',
'blurb' => $row['personalText'],
'avatar' => array(
'name' => $row['avatar'],
'image' => $row['avatar'] == '' ? ($row['ID_ATTACH'] > 0 ? '<img  src="' . (empty($row['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $row['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) . '" alt="" class="avatar2" border="0" />' : '') : (stristr($row['avatar'], 'http://') ? '<img src="' . $row['avatar'] . '"' . $avatar_width . $avatar_height . ' alt="" class="avatar2" border="0" />' : '<img src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($row['avatar']) . '" alt="" class="avatar2" border="0" />'),
'href' => $row['avatar'] == '' ? ($row['ID_ATTACH'] > 0 ? (empty($row['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $row['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) : '') : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar']),
'url' => $row['avatar'] == '' ? '' : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar'])
),
'last_login' => empty($row['lastLogin']) ? $txt['never'] : timeformat($row['lastLogin']),
'last_login_timestamp' => empty($row['lastLogin']) ? 0 : forum_time(0, $row['lastLogin']),
'website' => array(
'title' => $row['websiteTitle'],
'url' => $row['websiteUrl']),
'online' => array(
'is_online' => $row['isOnline'],
'text' => &$txt[$row['isOnline'] ? 'online2' : 'online3'],
'image_href' => $settings['images_url'] . '/' . ($row['isOnline'] ? 'useron' : 'useroff') . '.gif',
),
'teamtext' => $row['teamtext'],
);


}
mysql_free_result($request);





echo '<table align="center" width="95%" cellpadding="5" cellspacing="5"><tr>
<td colspan="4" style="border-bottom: 2px solid #d0d0d0; padding-bottom: 4px; "><h2>' . $groupname . '</h2>
</td></tr><tr><td colspan="4"><br /> </td></tr><tr>';


        $newrow=0;
foreach($context['TPortal']['team'] as $team)
        {
            echo '
<td valign="top">'.$team['avatar']['image'].'</td>
<td valign="top" width="50%" class="middletext" style="padding: 5px;">
<h2 style="margin-top: 0; margin-bottom: 6px;">'.$team['link'].'</h2>
<b>Last seen</b>: '.$team['last_login'].'<br />
<b>Posts</b>: '.$team['posts'].'<br />
<b>Position</b>: '.$team['groupname'].'<br />
' , !empty($team['location']) ? '<b>Location</b>: '.$team['location'].'<br />' : '' , '
' , !empty($team['website']['title']) ? '<b>Website</b>: <a href="'.$team['website']['url'].'" target="_blank">'.$team['website']['title'].'</a><br />' : '' , '
' ,  $team['online']['is_online'] ? '<img src="'.$team['online']['image_href'].'" alt="" /> '.$team['online']['text'].'<br />' : $team['online']['text'].'<br />' , '

' , !empty($team['blurb']) ? '<i>- '.$team['blurb'].'</i><br />' : '' , '

' ,  !empty($team['teamtext']) ? $team['teamtext'].'<br />' : '' , '

    </div></td>';
            $newrow++;
            if($newrow>1){
               $newrow=0;
               echo '</tr><tr><td colspan="4"><br /><br /> </td></tr><tr>';
            }
        }
    }
echo '</tr></table>';



and in this code the feld discription is in my lang style:


global $txt, $scripturl, $user_info, $context, $modSettings, $ID_MEMBER, $board_info, $settings, $db_prefix;

////////////////////////////////////////  Enter the desired groups - in order of appearance, if listing by group
$groups_list = array(21,25,19,23,22,26,20,24);
////////////////////////////////////////

$list_by_group = true; // 'true' for separate sections by group; 'false' for consolidated list
$include_nonprimary_groups = true; // 'true' to check for group membership in additional groups; 'false' for primary only
$include_post_groups = false; // 'true' to include post-count based group in membership search
$include_moderators = false; // 'true' to include board moderators on page
$repeats_allowed = false; // 'true' to allow multiple appearances by member on page (for $list_by_group = true only)

$sort_by = 'name'; // choices - 'id' ascending(default), 'posts' descending, 'name' ascending

$extra_type = 'none'; // choices - 'none'(default), 'board' links, 'page' (article) links
///////////////////
// Format - $extra_links['<member userid #>'] = '<forum board #>';
//       or $extra_links['<member userid #>'] = '<TP article #>';
$extra_links = array();
$extra_links['3'] = '5';
$extra_links['2'] = '11';

$extra_label_prefix = 'Page of '; // text to precede member's name in link label for extra link
$extra_label_suffix = ''; // text to append to member's name in link label for extra link

$page_title = 'Meet the Team!';
$page_subtitle = 'The people around the place';

$moderator_group = 3;
///////////////////////////////////////////////////////////////////////////////////////

$sort_ord = 'mem.ID_MEMBER ASC';
if ($sort_by == 'posts') $sort_ord = 'mem.posts DESC';
if ($sort_by == 'name') $sort_ord = 'mem.realName ASC';

if (($extra_type != 'board') && ($extra_type != 'page')) $extra_type = 'none';

if ($include_moderators)
{if (!in_array($moderator_group, $groups_list)) $groups_list[] = $moderator_group;}

$groups_to_use = array();
if ($list_by_group)
{$groups_to_use = $groups_list;}
else
{$groups_to_use[] = 0;}

$users_already_listed = array();
$users_already_listed[] = 0;

loadLanguage('Profile');

echo '<table align="center" width="96%" cellpadding="3" cellspacing="2"><tr>
<td colspan="4"><h2>', $page_title, '</h2>
<span class="smalltext">', $page_subtitle, '</span><br /></td></tr>';

if (!$list_by_group)
echo '<tr><td colspan="4"><br /></td></tr><tr width="95%" style="margin-top: 4px;">
<td class="windowbg3" colspan="4" style="border-top: 2px solid #d0d0d0; padding-top: 4px; "><h2> </h2>
</td></tr>';

foreach($groups_to_use as $groupnumber)
{
$loaded_ids = array();
$user_profile=array();
$memberContext=array();
$profile=array();
$context['TPortal']['team']=array();

// get the name of the group
$request = db_query("
SELECT groupName FROM {$db_prefix}membergroups WHERE ID_GROUP=$groupnumber", __FILE__, __LINE__);
if(mysql_num_rows($request)>0){
$row = mysql_fetch_row($request);
$groupNameX=$row[0];
mysql_free_result($request);
}

if ($list_by_group) {
$select_where = 'mem.ID_GROUP = '.$groupnumber;
if ($include_nonprimary_groups) $select_where .= ' OR FIND_IN_SET('.$groupnumber.', mem.additionalGroups)';
if ($include_post_groups) $select_where .= ' OR mem.ID_POST_GROUP = '.$groupnumber;
if ($include_moderators && ($groupnumber == $moderator_group)) $select_where = 'mem.ID_MEMBER = m.ID_MEMBER';
}
else {
$select_where = 'mem.ID_GROUP IN (' . implode(', ', $groups_list) . ')';
if ($include_nonprimary_groups) $select_where .= ' OR FIND_IN_SET(' . implode(', mem.additionalGroups) OR FIND_IN_SET(', $groups_list) . ', mem.additionalGroups)';
if ($include_post_groups) $select_where .= ' OR mem.ID_POST_GROUP IN (' . implode(', ', $groups_list) . ')';
if ($include_moderators) $select_where .= 'OR mem.ID_MEMBER = m.ID_MEMBER';
}

$select_where = '(' . $select_where . ') AND mem.ID_MEMBER NOT IN (' . implode(', ', $users_already_listed) . ')';

// Load the member's data.
$request = db_query("
SELECT IFNULL(lo.logTime, 0) AS isOnline, IFNULL(a.ID_ATTACH, 0) AS ID_ATTACH, a.filename, a.attachmentType,
mem.personalText, mem.avatar, mem.additionalGroups, mem.ID_MEMBER as memnum, mem.memberName, mem.ID_GROUP,
mem.usertitle, mem.karmaBad, mem.karmaGood, mem.realName, mem.lastLogin, mem.websiteTitle,
mem.websiteUrl, mem.location, mem.posts, them.value AS teamtext, m.ID_MEMBER as modmem, g.groupName
FROM ({$db_prefix}members AS mem)
LEFT JOIN {$db_prefix}moderators AS m ON (m.ID_MEMBER = mem.ID_MEMBER)
LEFT JOIN {$db_prefix}membergroups AS g ON (g.ID_GROUP = mem.ID_GROUP)
LEFT JOIN {$db_prefix}log_online AS lo ON (lo.ID_MEMBER = mem.ID_MEMBER)
LEFT JOIN {$db_prefix}attachments AS a ON (a.ID_MEMBER = mem.ID_MEMBER)
LEFT JOIN {$db_prefix}themes AS them ON (mem.ID_MEMBER = them.ID_MEMBER AND them.variable = 'teamtext' AND them.ID_THEME=1)
WHERE $select_where
GROUP BY mem.ID_MEMBER
ORDER BY $sort_ord", __FILE__, __LINE__);
$new_loaded_ids = array();
$member_count = 0;

while ($row = mysql_fetch_assoc($request))
{
if (!$repeats_allowed) $users_already_listed[$row['memnum']] = $row['memnum'];

$member_count += 1;

$avatar_width = '';
$avatar_height = '';
if($context['browser']['is_ie6']) $avatar_width = 'width="' . $modSettings['avatar_max_width_external'] . '"';

$context['TPortal']['team'][] = array(
'username' => $row['memberName'],
'usertitle' => $row['usertitle'],
'name' => $row['realName'],
'groupname' => ($groupnum == 0) ? $row['groupName'] : $groupNameX ,
'posts' => $row['posts'],
'karmabad' => $row['karmaBad'],
'karmagood' => $row['karmaGood'],
'location' => $row['location'],
'href' => $scripturl . '?action=profile;u=' . $row['memnum'],
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['memnum'] . '" title="' . $txt[92] . ' ' . $row['realName'] . '">' . $row['realName'] . '</a>',
'blurb' => $row['personalText'],
'avatar' => array(
'name' => $row['avatar'],
'image' => $row['avatar'] == '' ? ($row['ID_ATTACH'] > 0 ? '<img  src="' . (empty($row['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $row['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) . '" alt="" style="max-height:280px;max-width:180px;" border="0" />' : '') : (stristr($row['avatar'], 'http://') ? '<img src="' . $row['avatar'] . '"' . $avatar_width . $avatar_height . ' alt="" style="max-height:280px;max-width:180px;" border="0" />' : '<img src="' . $modSettings['avatar_url'] . '/' . htmlspecialchars($row['avatar']) . '" alt="" style="max-height:280px;max-width:180px;" border="0" />'),
'href' => $row['avatar'] == '' ? ($row['ID_ATTACH'] > 0 ? (empty($row['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $row['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) : '') : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar']),
'url' => $row['avatar'] == '' ? '' : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . $row['avatar'])
),
'last_login' => empty($row['lastLogin']) ? $txt['never'] : timeformat($row['lastLogin']),
'last_login_timestamp' => empty($row['lastLogin']) ? 0 : forum_time(0, $row['lastLogin']),
'website' => array(
'title' => $row['websiteTitle'],
'url' => $row['websiteUrl']
),
'online' => array(
'is_online' => $row['isOnline'],
'text' => &$txt[$row['isOnline'] ? 'online2' : 'online3'],
'image_href' => $settings['images_url'] . '/' . ($row['isOnline'] ? 'useron' : 'useroff') . '.gif',
),
'teamtext' => $row['teamtext'],
'member_page' => ($extra_type == 'none') ? '' : empty($extra_links[$row['memnum']]) ? '' : $extra_links[$row['memnum']],
);

}
mysql_free_result($request);

if ($member_count > 0)
{
if ($list_by_group)
echo '<tr><td colspan="4"><br /></td></tr><tr width="95%" style="margin-top: 4px;">
<td class="windowbg3" colspan="4" style="border-top: 2px solid #d0d0d0; padding-top: 4px; "><h2>' . $groupNameX . '</h2>
</td></tr>';

echo '<tr>';
        $newrow=0;

foreach($context['TPortal']['team'] as $team)
        {
echo '
<td valign="top" width="18%">'.$team['avatar']['image'].'</td>';

echo ' <td valign="top" class="middletext" style="padding: 2px;">';

echo '<h2 style="margin-top: 0; margin-bottom: 4px;"><b>'.$team['link'].'</b></h2>';

echo '<b>'. $team['usertitle'].'</b><br />';

if (!$list_by_group)
echo '<b>'.$txt[87].'</b>: '.$team['groupname'].'<br />';

if ($modSettings['karmaMode'] == '1')
echo '<b>', $modSettings['karmaLabel'], '</b> ', $team['karmagood'] - $team['karmabad'], '<br />';
elseif ($modSettings['karmaMode'] == '2')
echo '<b>', $modSettings['karmaLabel'], '</b> +', $team['karmagood'], ' | -', $team['karmabad'], '<br />';

echo '<b>'.$txt['lastLoggedIn'].'</b>: '.$team['last_login'].'<br />';

echo !empty($team['location']) ? '<b>'.$txt[227].'</b>: '.$team['location'].'<br />' : '';

echo !empty($team['website']['title']) ? '<b>'.$txt[96].'</b>: <a href="'.$team['website']['url'].'" target="_blank"><u>'.$team['website']['title'].'</u></a><br />' : '';

echo $team['online']['is_online'] ? '<img src="'.$team['online']['image_href'].'" alt="" /> '.$team['online']['text'].'<br />' : $team['online']['text'].'<br />';

echo '<b>'.$txt[86].'</b>: '.$team['posts'].'<br />';

echo !empty($team['blurb']) ? '<i>- '.$team['blurb'].'</i><br />' : '';

echo !empty($team['teamtext']) ? $team['teamtext'].'<br />' : '';

if (($extra_type == 'board') && !empty($team['member_page']))
echo '<a href="' . $scripturl . '?board=' . $team['member_page'] . '"><u>'. $extra_label_prefix . $team['name'] . $extra_label_suffix . '</u></a><br />';
if (($extra_type == 'page') && !empty($team['member_page']))
echo '<a href="' . $scripturl . '?page=' . $team['member_page'] . '"><u>'. $extra_label_prefix . $team['name'] . $extra_label_suffix . '</u></a><br />';

echo '
</td>';

$newrow++;
if($newrow>1){
$newrow=0;
echo '</tr><tr><td colspan="4"></td></tr><tr>';
}
        }
if($newrow=1) echo '<td colspan="2"></td>';
echo '</tr>';
}

}
echo '</table>';


who makes my happy?
Title: Re: Add a group to this code
Post by: Brian on March 25, 2008, 07:46:17 PM
I have been using this code for a year now and it works great.  I have recently decided I would like to change the background color.  I can change everything else and I know it should be an easy change but I cannot find what I need to change.  Can the background color be changed?  I just want it to be the windowbg background, it is using the windowbg2 background.
Title: Re: Add a group to this code
Post by: IchBin on March 25, 2008, 08:34:42 PM
You try adding the class to the table?
echo '<table align="center" width="96%" cellpadding="3" cellspacing="2"><tr>
echo '<table class="windowbg" align="center" width="96%" cellpadding="3" cellspacing="2"><tr>
Title: Re: Add a group to this code
Post by: Brian on March 25, 2008, 09:14:59 PM
That's real close to what I want it just has a border around the outside edge now that uses the windowbg2 color.  Can I change that?
Title: Re: Add a group to this code
Post by: IchBin on March 25, 2008, 09:22:01 PM
Can I see what you're talking about? If I can look at it I can tell you what it is that needs to change.
Title: Re: Add a group to this code
Post by: Brian on March 25, 2008, 09:24:25 PM
I figured it out just had to use my head a little.  I had to change the article setting to do not use title/frame.

Thanks for all your help IchBin
Title: Re: Add a group to this code
Post by: tmyrdal on July 03, 2008, 11:11:59 PM
I cant get none of this code working on my smf portal install :(  .cry .cry
Title: Re: Add a group to this code
Post by: Mick on December 26, 2008, 06:44:55 AM
Cool snippet.....

Im using it here:   http://www.chevyavalancheclub.com/index.php?action=staff

but what i dont understand is,.... why member "Donnie1" is shown twice?

lol...any ideas?
Title: Re: Add a group to this code
Post by: leroymcqy on March 29, 2013, 12:45:01 AM
how would i go about adding this to smf 2.0.4
Title: Re: Add a group to this code
Post by: IchBin on March 29, 2013, 02:44:23 AM
You have to change all the things that SMF needs.

db_query() changes to use the new $smcFunc functions like $smcFunc['db_query'](). That means adding $smcFunc to the globals.
Database fields are no longer camelcase (websiteTitle would instead be website_title). This goes for all rows in the tables. The only other changes I can think of would be ID_GROUP is now id_group and ID_MEMBER is now id_member. That should be the basics of it.