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

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,963
  • Latest: BiZaJe
Stats
  • Total Posts: 195,917
  • Total Topics: 21,308
  • Online today: 884
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 282
  • Total: 282

How is TP Team page created??

Started by mandos, October 02, 2006, 07:01:20 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

alan s

Nope , that code doesnt work , I placed


          $groupcolors = array();
$request = db_query("SELECT ID_GROUP, onlineColor FROM {$db_prefix}membergroups", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($request))
$groupcolors[$row['ID_GROUP']] = $row['onlineColor'];
mysql_free_result($request);
$new_loaded_ids = array();
while ($row = mysql_fetch_assoc($request))
{


Just below

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


On line 63 , I then replaced the code like you said and now none of the member groups show up?

http://beboskinzone.com/forum/index.php?page=9

jacortina



That looks like you're 'interrupting' the fetch from one query with the query to get colors. That colors query should go near the top of the code as it's more of an initialization, loading an array which will be referenced later.

Could you post the code you're using? With the variations of code around, it's easier to try to analyze the full code than to try to figure out which you were trying to modify.

Tommy

Quote from: J.A.Cortina on February 16, 2007, 05:29:44 PM
I don't understand. Both of the above have group lists and will output more than one group.


Also note that the last post was based on the code you posted earlier in the thread.

Hi,

uhm how can i show more than one group with the first code ?

"FROM {$db_prefix}membergroups WHERE groupName = 'GROUP_NAME"

I want to mix these two codes because the one is based on Blocs is much better. For example the code with the nice tables (which i want use) doesn't show any avatars.

2.) Yeah the last code i posted is the one i posted before but without the table i want to use.
My problem: I need the table of the first code in the second code.

brianjw

This is how:

$groups_list = array(8,9,10,11);

the numbers are the group ids which you can find in PHPmyadmin ;)

jacortina

No, first code says:
foreach ($groups as $id => $data)
{

//Now get all the user's
$query2 = db_query("SELECT ID_GROUP, ID_MEMBER, realName, avatar, usertitle, emailAddress, hideEmail, lastLogin, location, personalText, totalTimeLoggedIn, dateRegistered, ICQ, AIM, YIM, MSN, hideEmail, emailAddress
FROM {$db_prefix}members WHERE ID_GROUP = " . $data['id'] . " ", __FILE__, __LINE__);


It's set up to loop through an array.

You would need to change the "$groups = '';" up top to "$groups = array(1,2,72);"

That first query block is pretty useless in that code block.

And I definitely see code in that first 'nice' table to display avatars (though it may not be working correctly).

Give me a little bit and I'll see what I can do.

jacortina

The more I look at the first code, the stranger it gets. The avatar code IS included in there, but it's referencing $message array members which have no meaning in this code block (that gets filled in Display and PersonalMessages and refers to posts and PMs.

But I cleaned it up a touch and added the member_page stuff:
   global $db_prefix, $scripturl, $txt, $user_info, $settings, $modSettings, $options;

   $group_list = array(1, 2, 72);

$member_boards = array();
$member_boards['790'] = '39';
$member_boards['1'] = '41';
$member_boards['311'] = '38';
$member_boards['4334'] = '37';
$member_boards['1151'] = '36';
$member_boards['2158'] = '35';
$member_boards['3517'] = '34';
$member_boards['2665'] = '33';
$member_boards['2402'] = '32';
$member_boards['5435'] = '31';
$member_boards['1014'] = '30';
$member_boards['4619'] = '29';
$member_boards['2284'] = '28';
$member_boards['2642'] = '27';

//Does all the real work here for showing groups.
$query = db_query("SELECT ID_GROUP, groupName, minPosts, onlineColor
FROM {$db_prefix}membergroups WHERE ID_GROUP IN (" . implode(', ', $group_list) . ")", __FILE__, __LINE__);
        $groups = array();
while ($row = mysql_fetch_assoc($query))
{
$groups[$row['ID_GROUP']]  = array(
'id' => $row['ID_GROUP'],
'name' => $row['groupName'],
'color' => empty($row['onlineColor']) ? '' : $row['onlineColor'],
);
}
mysql_free_result($query);


foreach ($groups as $id => $data)
{

//Now get all the user's
$query2 = db_query("SELECT ID_GROUP, ID_MEMBER, realName, avatar, usertitle, emailAddress, hideEmail, lastLogin, location, personalText, totalTimeLoggedIn, dateRegistered, ICQ, AIM, YIM, MSN, hideEmail, emailAddress
FROM {$db_prefix}members WHERE ID_GROUP = " . $data['id'] . " ", __FILE__, __LINE__);

if(db_affected_rows() != 0)
{
echo '
<table border="0" cellspacing="1" cellpadding="4" align="center" width="100%" class="bordercolor">
<tr><td colspan="12" class="titlebg">
<font size="4" face="verdana"><b> ' . $data['name'] . '</b></font></td></tr><tr><td rowspan="70" width="75" class="windowbg" valign="top"><br><center><img src="http://maennerseiten.de/harry_potter/yabbse/Themes/classic/images/members.gif"></center></td>';
echo '<td class="catbg2" width="145">Nick</td>';
echo '<td class="catbg2" width="280">Alias</td>';
echo '<td class="catbg2" width="100">Name</td>';
echo '<td class="catbg2" width="145">Location</td>';
echo '<td class="catbg2" width="255">Last Active</td>';
echo '<td class="catbg2" width="155">Contact</td>';
echo '</tr><tr>';

while ($row2 = mysql_fetch_assoc($query2))
{

echo '<td class="windowbg" height="40"><a href="' . $scripturl . (!empty($member_boards[$row2['ID_MEMBER']]) ? '?page=' . $member_boards[$row2['ID_MEMBER']] : '?action=profile;u=' . $row2['ID_MEMBER']) . '">~hpF~ <b><font color="' . $data['color'] . '" size="3" face="verdana">' . $row2['realName'] . '</b></font></font></a><br /><font size="1"> ' . $row2['personalText'] . '</font></td>';
echo '<td class="windowbg">' . $row2['usertitle'] . '</td>';
echo '<td class="windowbg">';

echo '</td><td class="windowbg">' . $row2['location'] . '</td>';
                                        echo '<td class="windowbg">' . timeformat($row2['lastLogin']) . '</td>';
echo '<td class="windowbg">';

//Send email row
if($row2['hideEmail'] == 0)
echo '<a href="mailto:', $row2['emailAddress'], '"><img src="' . $settings['images_url'] . '/email_sm.gif" alt="email" /></a> ';


if($row2['ICQ'] != '')
echo '<a href="http://www.icq.com/whitepages/about_me.php?uin=' . $row2['ICQ'] . '" target="_blank"><img src="http://status.icq.com/online.gif?img=5&icq=' . $row2['ICQ'] . '" alt="' . $row2['ICQ'] . '" width="18" height="18" border="0" /></a> ';
if($row2['AIM'] != '')
echo '<a href="aim:goim?screenname=' . urlencode(strtr($row2['AIM'], array(' ' => '%20'))) . '&message=' . $txt['aim_default_message'] . '"><img src="' . $settings['images_url'] . '/aim.gif" alt="' . $row2['AIM'] . '" border="0" /></a> ';
if($row2['YIM'] != '')
echo '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . urlencode($row2['YIM']) . '"><img src="http://opi.yahoo.com/online?u=' . urlencode($row2['YIM']) . '&m=g&t=0" alt="' . $row2['YIM'] . '" border="0" /></a> ';
if($row2['MSN'] != '')
echo '<a href="http://members.msn.com/' . $row2['MSN'] . '" target="_blank"><img src="' . $settings['images_url'] . '/msntalk.gif" alt="' . $row2['MSN'] . '" border="0" /></a> ';
                                        if (!empty($message['member']['options']['Xfire']))
                                                echo '<a href="http://www.xfire.com/xf/modules.php?name=XFire&file=profile&uname=', $message['member']['options']['Xfire'], '" target="_blank"><img border="0" src="' . $settings['images_url'] . '/Xfire.gif"></a>';
//Send PM row
echo '<a href="' . $scripturl . '?action=pm;sa=send;u=' . $row2['ID_MEMBER'] . '"><img src="' . $settings['images_url'] . '/im_on.gif" alt="email" /></a></a>';

echo '</td>';

echo '</tr>';
}
echo '</table>';
}
}

echo'<br>';


Note that this includes an added string of text - '~hpF~' - that was already in the code, preceding the name.

Also already there was a left side graphic - yabbse/Themes/classic/images/members.gif .

Note that this code will link name to member page if a member page is defined. If no member page is defined, it will link to profile page.

alan s

Right , I chaned the place of the db quirey to the top of the code and now the names just dont appear but everything else does , The code im using is

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

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

$groupcolors = array();
$request = db_query("SELECT ID_GROUP, onlineColor FROM {$db_prefix}membergroups", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($request))
$groupcolors[$row['ID_GROUP']] = $row['onlineColor'];
mysql_free_result($request);

echo '<table align="center" width="95%" cellpadding="0" cellspacing="0"><tr>
                <td style="border-bottom: 2px solid #C7A276; padding-bottom: 4px; "><h2>BeboSkinZone.Com Team</h2>
<span class="smalltext">Meet the people who make the skins here.</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'] . '">' . (!empty($groupcolors[$row['ID_GROUP']]) ? '<font color="' . $groupcolors[$row['ID_GROUP']] . '">' . $row['RealName'] . '</font>' : $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 #C7A276; 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>';
}

jacortina

Arrrgggghhh!!!

Try changing:
               'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '" title="' . $txt[92] . ' ' . $row['RealName'] . '">' . (!empty($groupcolors[$row['ID_GROUP']]) ? '<font color="' . $groupcolors[$row['ID_GROUP']] . '">' . $row['RealName'] . '</font>' : $row['RealName'] ) . '</a>',

To:
               'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '" title="' . $txt[92] . ' ' . $row['realName'] . '">' . (!empty($groupcolors[$row['ID_GROUP']]) ? '<font color="' . $groupcolors[$row['ID_GROUP']] . '">' . $row['realName'] . '</font>' : $row['realName'] ) . '</a>',

Case sensitivity of array index (not 'RealName', but 'realName').

Tommy

Quote from: J.A.Cortina on February 16, 2007, 07:40:07 PM
The more I look at the first code, the stranger it gets. The avatar code IS included in there, but it's referencing $message array members which have no meaning in this code block (that gets filled in Display and PersonalMessages and refers to posts and PMs.

But I cleaned it up a touch and added the member_page stuff:

Note that this includes an added string of text - '~hpF~' - that was already in the code, preceding the name.

Also already there was a left side graphic - yabbse/Themes/classic/images/members.gif .

Note that this code will link name to member page if a member page is defined. If no member page is defined, it will link to profile page.

Yuuuuuuh ;D You are my hero...! Thank you so much!!!

alan s

Quote from: J.A.Cortina on February 17, 2007, 01:09:16 AM
Arrrgggghhh!!!

Try changing:
               'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '" title="' . $txt[92] . ' ' . $row['RealName'] . '">' . (!empty($groupcolors[$row['ID_GROUP']]) ? '<font color="' . $groupcolors[$row['ID_GROUP']] . '">' . $row['RealName'] . '</font>' : $row['RealName'] ) . '</a>',

To:
               'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '" title="' . $txt[92] . ' ' . $row['realName'] . '">' . (!empty($groupcolors[$row['ID_GROUP']]) ? '<font color="' . $groupcolors[$row['ID_GROUP']] . '">' . $row['realName'] . '</font>' : $row['realName'] ) . '</a>',

Case sensitivity of array index (not 'RealName', but 'realName').


That made the names show up again but the membergroup colours dont appear at all?

This website is proudly hosted on Crocweb Cloud Website Hosting.