Checking user group for group icons in showflat - 01/15/2007 6:08 AM
Hi kids, I had several mods that don't port over from 6.5 to 7 and I'm working on getting them going. One that I wanted was the custom group icons under a user's name in showflat (I never use showthreaded). Here's where I am so far:
In showflat.inc.php, changed this (around line 631):
to this:
and after this (around line 679):
I added this:
and then BEFORE this (around line 923):
I added this:
And then in showflat.tpl after this (around line 101):
I added this:
But it doesn't work because the groups arent in a string separated by "-", like in the 6.5 database. They are a sequence, inside ubbt_USER_GROUPS. When I ran this, it didn't seem to do anything, so I uncommented the line in showflat.inc.php:
and what happened is, it printed the user's post once for each group they belonged to... so that if they belonged to 3, 5 and 7 it printed:
UserGuy Hey this is my post!
3
UserGuy Hey this is my post!
5
UserGuy Hey this is my post!
7
So I'm kinda at a stopping point. Any suggestions from you smarties out there? =)
Thx, Callie
In showflat.inc.php, changed this (around line 631):
PHP Code
// Cycle through the posts
$query = "
SELECT t1.POST_ID,t2.USER_DISPLAY_NAME,t1.POST_POSTED_TIME,t1.POST_POSTER_IP,t1.POST_SUBJECT,t1.POST_BODY,t1.POST_IS_APPROVED,t3.USER_AVATAR,t3.USER_TITLE,t3.USER_NAME_COLOR,t1.POST_ICON,t1.POST_HAS_POLL,t1.POST_HAS_FILE,t1.POST_PARENT_ID,t2.USER_MEMBERSHIP_LEVEL,t3.USER_SIGNATURE,t1.POST_LAST_EDITED_TIME,t1.POST_LAST_EDITED_BY,t3.USER_LOCATION,t3.USER_TOTAL_POSTS,t2.USER_REGISTERED_ON,t3.USER_RATING,t3.USER_AVATAR_WIDTH,t3.USER_AVATAR_HEIGHT,t2.USER_ID,t1.POST_PARENT_USER_ID,t3.USER_BIRTHDAY,t3.USER_PUBLIC_BIRTHDAY,t1.POST_ADD_SIGNATURE,t3.USER_ACCEPT_PM,t3.USER_HOMEPAGE
FROM {$config['TABLE_PREFIX']}POSTS AS t1,
{$config['TABLE_PREFIX']}USERS AS t2,
{$config['TABLE_PREFIX']}USER_PROFILE as t3
WHERE t1.TOPIC_ID = ?
AND t1.USER_ID = t2.USER_ID
AND t1.USER_ID = t3.USER_ID
$Viewable
ORDER BY POST_ID
$Limit
";
to this:
PHP Code
// Cycle through the posts
$query = "
SELECT t1.POST_ID,t2.USER_DISPLAY_NAME,t1.POST_POSTED_TIME,t1.POST_POSTER_IP,t1.POST_SUBJECT,t1.POST_BODY,t1.POST_IS_APPROVED,t3.USER_AVATAR,t3.USER_TITLE,t3.USER_NAME_COLOR,t1.POST_ICON,t1.POST_HAS_POLL,t1.POST_HAS_FILE,t1.POST_PARENT_ID,t2.USER_MEMBERSHIP_LEVEL,t3.USER_SIGNATURE,t1.POST_LAST_EDITED_TIME,t1.POST_LAST_EDITED_BY,t3.USER_LOCATION,t3.USER_TOTAL_POSTS,t2.USER_REGISTERED_ON,t3.USER_RATING,t3.USER_AVATAR_WIDTH,t3.USER_AVATAR_HEIGHT,t2.USER_ID,t1.POST_PARENT_USER_ID,t3.USER_BIRTHDAY,t3.USER_PUBLIC_BIRTHDAY,t1.POST_ADD_SIGNATURE,t3.USER_ACCEPT_PM,t3.USER_HOMEPAGE,t4.GROUP_ID
FROM {$config['TABLE_PREFIX']}POSTS AS t1,
{$config['TABLE_PREFIX']}USERS AS t2,
{$config['TABLE_PREFIX']}USER_PROFILE as t3,
{$config['TABLE_PREFIX']}USER_GROUPS as t4
WHERE t1.TOPIC_ID = ?
AND t1.USER_ID = t2.USER_ID
AND t1.USER_ID = t3.USER_ID
AND t1.USER_ID = t4.USER_ID
$Viewable
ORDER BY POST_ID
$Limit
";
and after this (around line 679):
PHP Code
$postrow[$i]['UserStatus'] = "";
PHP Code
// Callie Hack
$postrow[$i]['GroupId'] = "";
// end Callie Hack
PHP Code
// ---------------------
// Is it their birthday?
PHP Code
// callie hack group pic
// Figure out what to display based on their groups
if (preg_match("/-5-/",$GroupId)) { // adjust this group number if needed
$postrow[$i]['GroupName'] = "Premium";
$postrow[$i]['GroupPic'] = "<a href="http://www.hairtell.com/ubbthreads/premium.php"><img src="http://www.hairtell.com/forum/images/subscriber01.jpg" border="0"></a>";
}
if (preg_match("/-6-/",$GroupId)) { // adjust this group number if needed
$postrow[$i]['GroupName'] = "Pro";
$postrow[$i]['GroupPic'] = "<a href="http://www.hairtell.com/ubbthreads/premium.php"><img src="http://www.hairtell.com/forum/images/subscriber02.jpg" border="0"></a>";
}
// test it $postrow[$i]['GroupPic'] =$GroupId;
// end callie hack group pic
PHP Code
{$postrow[post].Title}
<br />
PHP Code
<!-- callie hack -->
{$postrow[post].GroupPic}
<br />
<!-- end callie hack -->
PHP Code
// test it $postrow[$i]['GroupPic'] =$GroupId;
UserGuy Hey this is my post!
3
UserGuy Hey this is my post!
5
UserGuy Hey this is my post!
7
So I'm kinda at a stopping point. Any suggestions from you smarties out there? =)
Thx, Callie