Previous Thread
Next Thread
Print Thread
Rate Thread
Displaying a gif for a paying member
#317711 12/29/2008 11:44 AM
Joined: May 2008
Posts: 18
Iann128 Offline OP
Newbie
OP Offline
Newbie
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
Re: Displaying a gif for a paying member
Iann128 #317712 12/29/2008 1:35 PM
Joined: Jan 2000
Posts: 236
Likes: 2
Beta Tester
Offline
Beta Tester
Joined: Jan 2000
Posts: 236
Likes: 2
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

Re: Displaying a gif for a paying member
Ruben Rocha #317713 12/29/2008 6:54 PM
Joined: May 2008
Posts: 18
Iann128 Offline OP
Newbie
OP Offline
Newbie
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

Re: Displaying a gif for a paying member
Iann128 #317714 12/31/2008 5:37 AM
Joined: Feb 2007
Posts: 329
Yarp™
Offline
Yarp™
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

Re: Displaying a gif for a paying member
blaaskaak #317715 12/31/2008 9:35 AM
Joined: May 2008
Posts: 18
Iann128 Offline OP
Newbie
OP Offline
Newbie
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
Re: Displaying a gif for a paying member
Iann128 #317716 01/01/2009 2:20 PM
Joined: Feb 2007
Posts: 329
Yarp™
Offline
Yarp™
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!";
}


Re: Displaying a gif for a paying member
blaaskaak #317717 01/01/2009 2:53 PM
Joined: May 2008
Posts: 18
Iann128 Offline OP
Newbie
OP Offline
Newbie
Joined: May 2008
Posts: 18
That is exactly what we needed! Thanks!!!!!

Ian

Re: Displaying a gif for a paying member
Iann128 #317718 01/01/2009 10:31 PM
Joined: May 2008
Posts: 18
Iann128 Offline OP
Newbie
OP Offline
Newbie
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

Re: Displaying a gif for a paying member
Iann128 #317719 01/02/2009 4:29 AM
Joined: Feb 2007
Posts: 329
Yarp™
Offline
Yarp™
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.
Re: Displaying a gif for a paying member
blaaskaak #317720 01/02/2009 11:08 AM
Joined: May 2008
Posts: 18
Iann128 Offline OP
Newbie
OP Offline
Newbie
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
Re: Displaying a gif for a paying member
Iann128 #317721 01/02/2009 2:11 PM
Joined: Feb 2007
Posts: 329
Yarp™
Offline
Yarp™
Joined: Feb 2007
Posts: 329
yeah.

PHP Code

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


will result in
Code

hello world

Re: Displaying a gif for a paying member
blaaskaak #317729 01/05/2009 8:13 PM
Joined: May 2008
Posts: 18
Iann128 Offline OP
Newbie
OP Offline
Newbie
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

Re: Displaying a gif for a paying member
Iann128 #317730 01/06/2009 12:20 AM
Joined: Feb 2007
Posts: 329
Yarp™
Offline
Yarp™
Joined: Feb 2007
Posts: 329
It all depends on which spot you want it displayed.

Re: Displaying a gif for a paying member
blaaskaak #317731 01/06/2009 7:04 AM
Joined: May 2008
Posts: 18
Iann128 Offline OP
Newbie
OP Offline
Newbie
Joined: May 2008
Posts: 18
Just about anywhere would be good, over by the avatar would be cool.

Thanks,
Ian

Re: Displaying a gif for a paying member
Iann128 #317736 01/15/2009 9:05 AM
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?
Re: Displaying a gif for a paying member
AllenAyres #317739 01/15/2009 10:39 AM
Joined: Feb 2007
Posts: 329
Yarp™
Offline
Yarp™
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.

Re: Displaying a gif for a paying member
blaaskaak #317742 01/16/2009 10:17 AM
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?
Re: Displaying a gif for a paying member
AllenAyres #317746 01/16/2009 3:32 PM
Joined: Jun 2002
Posts: 5
Lurker
Offline
Lurker
Joined: Jun 2002
Posts: 5
Thanks for sharing,

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

Re: Displaying a gif for a paying member
blaaskaak #317748 01/20/2009 12:29 AM
Joined: Aug 2000
Posts: 1,609
Addict
Offline
Addict
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?

Re: Displaying a gif for a paying member
AKD96 #317814 02/15/2009 10:33 PM
Joined: May 2008
Posts: 18
Iann128 Offline OP
Newbie
OP Offline
Newbie
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

Re: Displaying a gif for a paying member
Iann128 #317815 02/17/2009 11:20 AM
Joined: Feb 2007
Posts: 329
Yarp™
Offline
Yarp™
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.
Re: Displaying a gif for a paying member
blaaskaak #317820 02/17/2009 6:57 PM
Joined: May 2008
Posts: 18
Iann128 Offline OP
Newbie
OP Offline
Newbie
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?

Re: Displaying a gif for a paying member
Iann128 #317823 02/19/2009 4:25 PM
Joined: Nov 2003
Posts: 482
Enthusiast
Offline
Enthusiast
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

Re: Displaying a gif for a paying member
sirdude #317825 02/19/2009 5:23 PM
Joined: Aug 2000
Posts: 1,609
Addict
Offline
Addict
Joined: Aug 2000
Posts: 1,609
sirdude has lonely keys

Re: Displaying a gif for a paying member
AKD96 #318590 06/01/2010 9:26 AM
Joined: May 2008
Posts: 18
Iann128 Offline OP
Newbie
OP Offline
Newbie
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.

Re: Displaying a gif for a paying member
Iann128 #318591 06/03/2010 9:58 AM
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?
Re: Displaying a gif for a paying member
Iann128 #318638 10/12/2010 9:23 AM
Joined: May 2008
Posts: 18
Iann128 Offline OP
Newbie
OP Offline
Newbie
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
jgeoff
jgeoff
NJ
Posts: 96
Joined: April 2001
Forum Statistics
Forums63
Topics37,529
Posts293,721
Members13,834
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online 130
Topics Created 0
Posts Made 0
Users Online 0
Birthdays 28
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,795
Greg Hard 4,625
Top Posters(30 Days)
isaac 3
Top Likes Received
isaac 33
Gizmo 8
Brett 7
Morgan 2
Top Likes Received (30 Days)
isaac 3
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2020 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 7.7.4
(Snapshot build 20200228.dev)
Responsive Width:

PHP: 5.4.45 Page Time: 0.076s Queries: 69 (0.034s) Memory: 3.4888 MB (Peak: 3.8267 MB) Data Comp: Zlib Server Time: 2020-02-29 07:36:53 UTC
Valid HTML 5 and Valid CSS