php forum
php mysql forum
php mysql smarty
 
Page 1 of 2 1 2 >
Topic Options
#317711 - 12/29/08 11:44 AM Displaying a gif for a paying member
Iann128 Offline
Newbie

Registered: 05/31/08
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

Top
#317712 - 12/29/08 01:35 PM Re: Displaying a gif for a paying member [Re: Iann128]
Ruben Rocha Offline
Member

Registered: 01/19/00
Posts: 182
Loc: Lutz,FL,USA
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

Top
#317713 - 12/29/08 06:54 PM Re: Displaying a gif for a paying member [Re: Ruben Rocha]
Iann128 Offline
Newbie

Registered: 05/31/08
Posts: 18
No red x, just no picture... If I view source on the page the code to display it is not there...

Ian

Top
#317714 - 12/31/08 05:37 AM Re: Displaying a gif for a paying member [Re: Iann128]
blaaskaak Offline
Enthusiast

Registered: 02/25/07
Posts: 329
Loc: The Netherlands
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
_________________________

Top
#317715 - 12/31/08 09:35 AM Re: Displaying a gif for a paying member [Re: blaaskaak]
Iann128 Offline
Newbie

Registered: 05/31/08
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!!!!

Top
#317716 - 01/01/09 02:20 PM Re: Displaying a gif for a paying member [Re: Iann128]
blaaskaak Offline
Enthusiast

Registered: 02/25/07
Posts: 329
Loc: The Netherlands
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!";
		}
 
_________________________

Top
#317717 - 01/01/09 02:53 PM Re: Displaying a gif for a paying member [Re: blaaskaak]
Iann128 Offline
Newbie

Registered: 05/31/08
Posts: 18
That is exactly what we needed! Thanks!!!!!

Ian

Top
#317718 - 01/01/09 10:31 PM Re: Displaying a gif for a paying member [Re: Iann128]
Iann128 Offline
Newbie

Registered: 05/31/08
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

Top
#317719 - 01/02/09 04:29 AM Re: Displaying a gif for a paying member [Re: Iann128]
blaaskaak Offline
Enthusiast

Registered: 02/25/07
Posts: 329
Loc: The Netherlands
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'];
 


Edited by blaaskaak (01/02/09 04:31 AM)
_________________________

Top
#317720 - 01/02/09 11:08 AM Re: Displaying a gif for a paying member [Re: blaaskaak]
Iann128 Offline
Newbie

Registered: 05/31/08
Posts: 18
Thanks again, I kinda figured that was what you were doing with the .= bit. I will give it a shot.

Ian

Top
#317721 - 01/02/09 02:11 PM Re: Displaying a gif for a paying member [Re: Iann128]
blaaskaak Offline
Enthusiast

Registered: 02/25/07
Posts: 329
Loc: The Netherlands
yeah.

Php Code:

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


will result in
Code:
hello world
_________________________

Top
#317729 - 01/05/09 08:13 PM Re: Displaying a gif for a paying member [Re: blaaskaak]
Iann128 Offline
Newbie

Registered: 05/31/08
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

Top
#317730 - 01/06/09 12:20 AM Re: Displaying a gif for a paying member [Re: Iann128]
blaaskaak Offline
Enthusiast

Registered: 02/25/07
Posts: 329
Loc: The Netherlands
It all depends on which spot you want it displayed.
_________________________

Top
#317731 - 01/06/09 07:04 AM Re: Displaying a gif for a paying member [Re: blaaskaak]
Iann128 Offline
Newbie

Registered: 05/31/08
Posts: 18
Just about anywhere would be good, over by the avatar would be cool.

Thanks,
Ian

Top
#317736 - 01/15/09 09:05 AM Re: Displaying a gif for a paying member [Re: Iann128]
AllenAyres Offline

I type Like navaho

Registered: 03/10/00
Posts: 25580
Loc: Texas
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?

Top
#317739 - 01/15/09 10:39 AM Re: Displaying a gif for a paying member [Re: AllenAyres]
blaaskaak Offline
Enthusiast

Registered: 02/25/07
Posts: 329
Loc: The Netherlands
Very simple approach, it's just that users are allowed to edit their custom title, and you kind of go wrong there.
_________________________

Top
#317742 - 01/16/09 10:17 AM Re: Displaying a gif for a paying member [Re: blaaskaak]
AllenAyres Offline

I type Like navaho

Registered: 03/10/00
Posts: 25580
Loc: Texas
ah, thank you, it's been a while since I looked at it smile
_________________________
- Allen wavey
- What Drives You?

Top
#317746 - 01/16/09 03:32 PM Re: Displaying a gif for a paying member [Re: AllenAyres]
Ohton Offline
Lurker

Registered: 06/30/02
Posts: 5
Thanks for sharing,

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

Top
#317748 - 01/20/09 12:29 AM Re: Displaying a gif for a paying member [Re: blaaskaak]
DLWebmaestro Offline
Addict

Registered: 08/08/00
Posts: 1802
Loc: North Carolina
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?

Top
#317814 - 02/15/09 10:33 PM Re: Displaying a gif for a paying member [Re: DLWebmaestro]
Iann128 Offline
Newbie

Registered: 05/31/08
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

Top
#317815 - 02/17/09 11:20 AM Re: Displaying a gif for a paying member [Re: Iann128]
blaaskaak Offline
Enthusiast

Registered: 02/25/07
Posts: 329
Loc: The Netherlands
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).


Edited by blaaskaak (02/17/09 11:23 AM)
_________________________

Top
#317820 - 02/17/09 06:57 PM Re: Displaying a gif for a paying member [Re: blaaskaak]
Iann128 Offline
Newbie

Registered: 05/31/08
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?

Top
#317823 - 02/19/09 04:25 PM Re: Displaying a gif for a paying member [Re: Iann128]
sirdude Offline
Enthusiast

Registered: 11/08/03
Posts: 490
Loc: SoCal
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
_________________________

Top
#317825 - 02/19/09 05:23 PM Re: Displaying a gif for a paying member [Re: sirdude]
DLWebmaestro Offline
Addict

Registered: 08/08/00
Posts: 1802
Loc: North Carolina
sirdude has lonely keys

Top
#318590 - 06/01/10 10:26 AM Re: Displaying a gif for a paying member [Re: DLWebmaestro]
Iann128 Offline
Newbie

Registered: 05/31/08
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.

Top
#318591 - 06/03/10 10:58 AM Re: Displaying a gif for a paying member [Re: Iann128]
AllenAyres Offline

I type Like navaho

Registered: 03/10/00
Posts: 25580
Loc: Texas
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?

Top
#318638 - 10/12/10 10:23 AM Re: Displaying a gif for a paying member [Re: Iann128]
Iann128 Offline
Newbie

Registered: 05/31/08
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???

Top
Page 1 of 2 1 2 >



Moderator:  sirdude 
Latest Posts
[7.2.1] - Naked shoutbox
by bellaonline
05/05/12 05:00 PM
[7.x] Stop Forum Spam Integration v0.4
by bellaonline
05/05/12 03:53 PM
Shout Box

(Views)Popular Topics
Known public proxy servers 1689885
Integrated Index Page (IIP) 5.3.1 555705
Finished-[6.5.2] Games Arcade Deluxe v1.9 501236
Integrated Index Page (IIP) 5.1.1 415112
TLD Bv2.1 Released - Threads Links Directory 396822
[6.0x] Who's Online 4.0.0 [Finished] 389412
Finished-[6.5.1] Integrated Index Page (IIP) 6.5 330423
Q & A 298663
Slash UBB 266936
[6.3.x] [beta] Hit Hack 2.0 227970
Forum Stats
13621 Members
59 Forums
37191 Topics
295716 Posts

Max Online: 686 @ 06/28/07 07:04 AM

 

 

 
fusionbb message board php hacks