SimplePortal
Customization => Custom Coding => Topic started by: codnerd on April 17, 2009, 05:14:48 AM
-
I made a post on Dziner Studio regarding the Team Page they have.
I have the team page source from the person who made it, but when I put it on and try to go to it, I get a "could not load Database query" error.
They said to come to you to find out how to intergrate it into SP or to make it just standalone.
<?php global $txt, $scripturl, $user_info;
global $context, $modSettings, $ID_MEMBER;
global $board_info, $settings, $db_prefix;
///////////////////////////////////////////////////////////////// Enter the desired groups
$groups_list = array(1,2);
/////////////////////////////////////////////////////////////////
$groups_query1 = 'mem.ID_GROUP IN (' . implode(', ', $groups_list) . ')';
$groups_query2 = '';
// $groups_query2 = ' OR FIND_IN_SET(' . implode(', mem.additionalGroups) OR FIND_IN_SET(', $groups_list) . ', mem.additionalGroups)';
echo '<table align="center" width="95%" cellpadding="0" cellspacing="0"><tr>
<td style="border-bottom: 2px solid #282828; padding-bottom: 2px; "><h2>Meet DS Team!</h2>
<span class="middletext">These are the people you will run into while visiting dzinerstudio.com.</span><br /><br />
</td></tr></table>';
$loaded_ids = array();
$user_profile=array();
$memberContext=array();
$profile=array();
$context['team']=array();
// 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.ID_MEMBER, mem.memberName, mem.realName , mem.lastLogin, mem.websiteTitle,
mem.websiteUrl, mem.location, mem.posts, them.value AS teamtext, g.groupName
FROM ({$db_prefix}members AS mem, {$db_prefix}membergroups AS g)
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 mem.ID_GROUP = g.ID_GROUP
AND ($groups_query1 $groups_query2)
ORDER BY mem.posts DESC", __FILE__, __LINE__);
$new_loaded_ids = array();
while ($row = mysql_fetch_assoc($request))
{
$avatar_width = '';
$avatar_height = '';
$context['team'][] = array(
'username' => $row['memberName'],
'name' => $row['realName'],
'groupname' => $row['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" style="margin-top: 10px;"><tr>';
$newrow=0;
foreach($context['team'] as $team)
{
echo '
<td valign="top" align="right" width="5%">'.$team['avatar']['image'].'</td>
<td valign="top" width="45%" class="windowbg3 team" style="padding: 5px;">
<h2 style="margin-top: 0; margin-bottom: 6px;">'.$team['link'].'</h2>
<b>Position</b>: '.$team['groupname'].'<br />
<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>';
?>
Please help me make this into a standalone page... :)
Here (http://www.dzinerstudio.com/index.php?topic=1850.msg23369#msg23369) is my Dziner Studio post.
-
You have to use Custom Action mod for that. SP doesn't support such pages yet. However, it will soon.
-
Hey guys, any word on this?
-
Yes, CoDNerd ended up using my team page modification.
You can see it here: http://customcod.com/community/index.php?action=teampage
And download it from my site (http://ccbtimewiz.com).
-
i think i messed up with manage team page. i got this error ....
Wrong value type sent to the database. Array of integers expected. (groups)
how do i fix it? i try to reinstalling it and it didnt work. I filled it out wrong i think lol :P
please help some ;D
-
Known issue, you're probably using an older version of it.
You will need to forcefully clean up the fields in the database.
-
this is the error page cod 109 line 109
89:
// Combining both together to make it easier on the call.
90:
$include_groups = array_merge_recursive($left_sort, $right_sort, $bottom_sort);
91:
92:
// No groups defined? Diasterific. If the user is an admin, redirect them to the page to set it up.
93:
if (empty($include_groups) && $context['user']['is_admin'])
94:
redirectexit('action=teampage;sa=manage');
95:
96:
// Else, send them back to the forums, foo.
97:
else if (empty($include_groups))
98:
redirectexit();
99:
100:
// Grab the groups that were defined.
101:
$query_groups = $smcFunc['db_query']('', '
102:
SELECT mg.id_group, mg.group_name, mg.online_color, mg.stars
103:
FROM {db_prefix}membergroups AS mg
104:
WHERE mg.id_group IN ({array_int:groups})
105:
ORDER BY mg.id_group ASC',
106:
array(
107:
'groups' => $include_groups,
108:
)
==>109:
);
110:
111:
// Parameters for the avatars.
112:
if ($modSettings['avatar_action_too_large'] == 'option_html_resize' || $modSettings['avatar_action_too_large'] == 'option_js_resize')
113:
{
114:
$avatar_width = !empty($modSettings['avatar_max_width_external']) ? ' width="' . $modSettings['avatar_max_width_external'] . '"' : '';
115:
$avatar_height = !empty($modSettings['avatar_max_height_external']) ? ' height="' . $modSettings['avatar_max_height_external'] . '"' : '';
116:
}
117:
else
118:
{
119:
$avatar_width = '';
120:
$avatar_height = '';
121:
}
122:
123:
while ($row = $smcFunc['db_fetch_assoc']($query_groups))
124:
{
125:
// If the group is less than 0, they're defining either guests or all users. That's just stupid.
126:
if ($row['id_group'] < 0)
127:
fatal_lang_error('error_group_bad');
128:
129:
// A bit of a check to see if this group exists or not..
how can i clean up my database?
-
Its working now thanks for all the help :)
-
No problem.
Glad you got it. 8)