Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: May 2008
Posts: 18
I
Iann128 Offline OP
Newbie
OP Offline
Newbie
I
Joined: May 2008
Posts: 18
I started a thread over at ubb but it looks like it is more of a mod than is supported over there. I have tried to edit post_side.tpl with

Code
 <br />
{if (in_array("10",$groups))}
<img src="{$config.BASE_URL}/images/member.gif" alt="Member" />
{/if}

and added a query to showflat.inc.php like this that I took from user.inc.php I also added "groups" => $groups, to the Smarty part of the code...
Code

// First we grab all of their groups
$query = "
select GROUP_ID
from {$config['TABLE_PREFIX']}USER_GROUPS
where USER_ID = ?
";
$sth = $dbh->do_placeholder_query($query,array($Uid),__LINE__,__FILE__);

$groups = array();
while($result = $dbh->fetch_array($sth)) {
$groups[] = $result['GROUP_ID'];
} // end while

$_SESSION['mygroups'] = serialize($groups);

Any ideas as to why the gif does not show up frown

Thanks,
Ian

Sponsored Links
Joined: Jan 2000
Posts: 245
Likes: 4
R
Beta Tester
Offline
Beta Tester
R
Joined: Jan 2000
Posts: 245
Likes: 4
I assume by not showing up you mean the old red X?
The image should be in images/general/default and images/general/defaultdark. Same place as adm.gif is located

Joined: May 2008
Posts: 18
I
Iann128 Offline OP
Newbie
OP Offline
Newbie
I
Joined: May 2008
Posts: 18
No red x, just no picture... If I view source on the page the code to display it is not there...

Ian

Joined: Feb 2007
Posts: 329
B
Yarp™
Offline
Yarp™
B
Joined: Feb 2007
Posts: 329
I would do a slightly different approach that doesn't involve a template edit:

First of all, we don't want to know every group the user is in, we just want to know if they are in (your case) group 10.

Second, running this query for every user can be time consuming. This adds a query per post, you can find out every user in a topic that is in group X by using this query:

SQL Query

select distinct(t1.USER_ID)
from ubbt_USER_GROUPS as t1,
ubbt_POSTS as t2
where
t1.USER_ID = t2.USER_ID
and t1.GROUP_ID = 7
and t2.TOPIC_ID = 18499

Using this query, you could build an array with every user from topic 18499 that is in group 7.

In /scripts/showflat.inc.php you could check out that array to adjust the Membertitle string to add a graphic.

find:
PHP Code

if ($CustomTitle && $config['ONLY_CUSTOM']) {
$postrow[$i]['Title'] = $CustomTitle;
$CustomTitle = "";
} else {
$postrow[$i]['Title'] = $Title;
$postrow[$i]['CustomTitle'] = $CustomTitle;
}


There the title is put in a string.

If you put some code just below there to add a string to the customtitle string with a graphic, you don't need to adjust the templates, and it will work for both post_side and post_top templates.

I can be more complete about this next year if you need more help, I know it sounds ages, but it's actually tomorrow laugh

Joined: May 2008
Posts: 18
I
Iann128 Offline OP
Newbie
OP Offline
Newbie
I
Joined: May 2008
Posts: 18
Thanks for the help! I assume the query would go into showflat.inc.php somewhere? I have been messing around with the main query in showflat.inc.php, but now I get as many posts as they are in groups frown and only 1 shows the image..

Ian

PS Happy New Year!!!!

Sponsored Links
Joined: Feb 2007
Posts: 329
B
Yarp™
Offline
Yarp™
B
Joined: Feb 2007
Posts: 329
okay, I edited /scripts/showflat.inc.php a bit:

Find:
PHP Code

$topic_info
= $dbh->fetch_array($sth, MYSQL_ASSOC);


add below:
PHP Code

// get array of graphic users

$query = "
select distinct(t1.USER_ID)
from
{$config['TABLE_PREFIX']}USER_GROUPS as t1,
{$config['TABLE_PREFIX']}POSTS as t2
where t1.USER_ID = t2.USER_ID
and t1.GROUP_ID = 6
and t2.TOPIC_ID = ?
"
;
$sth = $dbh -> do_placeholder_query($query,array($topic_info['TOPIC_ID']),__LINE__,__FILE__);
$graphicusers = array();
while (list(
$graphicuserid) = $dbh -> fetch_array($sth)) {
$graphicusers[] = $graphicuserid;
}


Group 6 is hardcoded, and of course you need to adjust the text graphic to html to the actual graphic.

Hope this helps.

Find:
PHP Code

if ($CustomTitle && $config['ONLY_CUSTOM']) {
$postrow[$i]['Title'] = $CustomTitle;
$CustomTitle = "";
} else {
$postrow[$i]['Title'] = $Title;
$postrow[$i]['CustomTitle'] = $CustomTitle;
}


Add below:

PHP Code

if (in_array($usernum,$graphicusers)) {
$postrow[$i]['CustomTitle'] .= "<br />Graphic!";
}


Joined: May 2008
Posts: 18
I
Iann128 Offline OP
Newbie
OP Offline
Newbie
I
Joined: May 2008
Posts: 18
That is exactly what we needed! Thanks!!!!!

Ian

Joined: May 2008
Posts: 18
I
Iann128 Offline OP
Newbie
OP Offline
Newbie
I
Joined: May 2008
Posts: 18
Just a quick question Yarp, the moderators are asking if it can be moved down below the avatars or the location field is there a way to do that?

Thanks,
Ian

Joined: Feb 2007
Posts: 329
B
Yarp™
Offline
Yarp™
B
Joined: Feb 2007
Posts: 329
Yes there is.

Easiest would be the location field, to avoid template edits.

The code that actually changes the custom title now to custom title+graphic should be changed to change the location field.

PHP Code

$postrow
[$i]['Location'] .= "<br />Graphic!";


edit: Below the avatar is simple too, just change the Registered: string

PHP Code

$postrow
[$i]['Registered'] = "Graphic!<br />".$postrow[$i]['Registered'];


Last edited by blaaskaak; 01/02/2009 4:31 AM.
Joined: May 2008
Posts: 18
I
Iann128 Offline OP
Newbie
OP Offline
Newbie
I
Joined: May 2008
Posts: 18
Thanks again, I kinda figured that was what you were doing with the .= bit. I will give it a shot.

Ian

Sponsored Links
Joined: Feb 2007
Posts: 329
B
Yarp™
Offline
Yarp™
B
Joined: Feb 2007
Posts: 329
yeah.

PHP Code

$string
= "hello ";
$string .= "world";
echo
$string;


will result in
Code

hello world

Joined: May 2008
Posts: 18
I
Iann128 Offline OP
Newbie
OP Offline
Newbie
I
Joined: May 2008
Posts: 18
Cool one more quick one (I hope) where would I include this in showprofile.inc.php so the member image would show up. I had one of the mods ask because she posts birthdays and events for dues paying members..

Thanks again,
Ian

Joined: Feb 2007
Posts: 329
B
Yarp™
Offline
Yarp™
B
Joined: Feb 2007
Posts: 329
It all depends on which spot you want it displayed.

Joined: May 2008
Posts: 18
I
Iann128 Offline OP
Newbie
OP Offline
Newbie
I
Joined: May 2008
Posts: 18
Just about anywhere would be good, over by the avatar would be cool.

Thanks,
Ian

Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
Offline
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
Would a simpler approach be to just include a graphic in the custom title for a paid usergroup? I don't remember if that field allowed html, I think I remember Ian adding a marquee to that spot in earlier versions smile


- Allen wavey
- What Drives You?
Joined: Feb 2007
Posts: 329
B
Yarp™
Offline
Yarp™
B
Joined: Feb 2007
Posts: 329
Very simple approach, it's just that users are allowed to edit their custom title, and you kind of go wrong there.

Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
Offline
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
ah, thank you, it's been a while since I looked at it smile


- Allen wavey
- What Drives You?
Joined: Jun 2002
Posts: 5
O
Lurker
Offline
Lurker
O
Joined: Jun 2002
Posts: 5
Thanks for sharing,

If I have different levels of paying groups, how can I show an Icon for each?

Joined: Aug 2000
Posts: 1,609
A
Addict
Offline
Addict
A
Joined: Aug 2000
Posts: 1,609
Originally Posted by blaaskaak
Very simple approach, it's just that users are allowed to edit their custom title, and you kind of go wrong there.
Couldn't you just edit the template for editbasic to simply not display the custom title field?

Joined: May 2008
Posts: 18
I
Iann128 Offline OP
Newbie
OP Offline
Newbie
I
Joined: May 2008
Posts: 18
Ok one more question... We have added subscriptions so there are more groups that should have the members gif, can I just add them to the same query? Can I use a "or" and in 10 or 11 or 12?

Thanks,
Ian

Joined: Feb 2007
Posts: 329
B
Yarp™
Offline
Yarp™
B
Joined: Feb 2007
Posts: 329
changelog for 7.5:

FEATURE It is now possible to add an image for each group. Users belonging to that group will be able to display that image next to their name. If a user belongs to multiple groups, the user can select a single or multiple images to be displayed.

It's just hit the beta cycle, so won't be long before it will be released.

As far as the query goes:

SQL Query

and t1.GROUP_ID = 6

should be replaced with

SQL Query

and (t1.GROUP_ID = 6 or t1.GROUP_ID = 7)

So you replace the original requirement with a bunch of them with or inbetween. But you group them together, because together they are one of the conditions).

Last edited by blaaskaak; 02/17/2009 11:23 AM.
Joined: May 2008
Posts: 18
I
Iann128 Offline OP
Newbie
OP Offline
Newbie
I
Joined: May 2008
Posts: 18
Thanks again, you are the Man! Yeah I saw the change log, can't wait to test it out. How does one get in the Beta group?

Joined: Nov 2003
Posts: 482
S
Enthusiast
Offline
Enthusiast
S
Joined: Nov 2003
Posts: 482
easier way to do a test for multiple groups would be

SQL Query
 AND t1.GROUP_ID IN (6,7)

you can keep adding commas and numbers at will smile

i like to minimize keystrokes laugh

Joined: Aug 2000
Posts: 1,609
A
Addict
Offline
Addict
A
Joined: Aug 2000
Posts: 1,609
sirdude has lonely keys

Joined: May 2008
Posts: 18
I
Iann128 Offline OP
Newbie
OP Offline
Newbie
I
Joined: May 2008
Posts: 18
Hey guys I upgraded my testing site to 7.5 a little while ago and broke the mods I made, and the stock code displays the member image inline with the posts, not where I had it or want it. Will the mods still work if I go back and edit the files? I have not upgraded the main site for that reason.

Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
Offline
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
It should, the code wasn't too difficult to follow from one version to the other for the most part, especially the templates.


- Allen wavey
- What Drives You?
Joined: May 2008
Posts: 18
I
Iann128 Offline OP
Newbie
OP Offline
Newbie
I
Joined: May 2008
Posts: 18
OK so now we have a different image for a "Recognized" member. I was going through the code, and trying to think how to do it without stacking them, I.E. one or the other. I assume I need to create a second array, then create logic to see which array they are in???


Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
AllenAyres
AllenAyres
Texas
Posts: 21,079
Joined: March 2000
Forum Statistics
Forums63
Topics37,552
Posts293,830
Members13,842
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online 219
Topics Created 0
Posts Made 0
Users Online 1
Birthdays 8
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,809
Greg Hard 4,625
Top Posters(30 Days)
stell 3
Morgan 1
isaac 1
Gizmo 1
Top Likes Received
isaac 66
Gizmo 12
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2021 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Snapshot build 20201211)
Responsive Width:

PHP: 5.4.45 Page Time: 0.119s Queries: 69 (0.053s) Memory: 3.5092 MB (Peak: 3.8382 MB) Data Comp: Zlib Server Time: 2021-03-08 19:32:50 UTC
Valid HTML 5 and Valid CSS