SimplePortal

Customization => Blocks and Modifications => Mod Requests => Topic started by: Stigmartyr on July 05, 2010, 01:05:44 PM

Title: Team Roster / Member Group Page
Post by: Stigmartyr on July 05, 2010, 01:05:44 PM
Hello,
I have a few refugee sites converted over from Tiny Portal recently.  They were on SMF 1.1.1 and now I'm using SMF 2.  I have some php that I was able to use to make a roster page just to show a list of all members in a member group.  Is there a public feature for that, not in the admin section?

If not, can some kind sole pretty please help update my globals or php string to make the following call work?

Code: [Select]
global $txt, $scripturl, $user_info;
global $context, $modSettings, $ID_MEMBER;
global $board_info, $settings, $db_prefix;

$groupnumber = 37;
$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>Black-Chapter Operatives</h2>
<span class="smalltext">New-Bloods :: SCL 10A :: Entry-Level Members</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>';


Thanks in advance.
Title: Re: Team Roster / Member Group Page
Post by: Nathaniel on July 20, 2010, 03:24:04 AM
You could use the inbuilt SimplePortal staff block, although that would probably be significantly different from what you have here.

The main difference will be the database queries, although some of the global variables are a bit different as well. I can help with that if you need it. $smcFunc and other variables have some documentation over at SM.org I believe.
Title: Re: Team Roster / Member Group Page
Post by: Ares on January 07, 2011, 12:27:04 AM
Team Page 1.1.6
i use this for our clan roster search it at smf main site
Title: Re: Team Roster / Member Group Page
Post by: Stigmartyr on January 07, 2011, 12:59:09 AM
Team Page 1.1.6
i use this for our clan roster search it at smf main site

I am using it as well but I would like to be able to list membergroups independently.  So a page would show to our visitors a list of all members in a specified group.

Since I am using it for an autos site it helps to have several different queries for vehicle ownership types.  This is what I am using secondary membergroups for.

It was a very handy script (perhaps still can be), and would help immensely! :)
SimplePortal 2.3.8 © 2008-2024, SimplePortal