Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Sep 2003
Posts: 488
Code Monkey
Code Monkey
Joined: Sep 2003
Posts: 488
The following assumes that your donators are in usergroup 6, and that the ads are also supposed to be seen no matter what by everyone else not in the donator group.

Ok...

You'll have to create a new field in the users table. Run this query...

ALTER TABLE w3t_users ADD U_Ads tinyint(1) NOT NULL default '0'


...and then add a config option in their display preferences section.

editdisplay.php...

Code
$adsyes = ""; <br />$adsno = ""; <br /> <br />if ($ads == 1) { <br />   $adsyes = "selected=\"selected\""; <br />else { <br />   $adsno = "selected=\"selected\""; <br />} 



...which will only appear if they belong to that group and default that selection to 0 (No). You can add the PHP in the template for that.

editdisplay.tmpl...


Code
UBBTPRINT; <br />if ((preg_match("/-6-/",$postergroup)) { <br />echo "Do you wish to see ads?<br /> <br /><select name = \"Adselect\" class=\"formboxes\"> <br /><option value = \"1\"  $adsyes>Yes</option> <br /><option value = \"0\" $adsno>No</option> <br /></select> <br /><br /><br />"; <br />} <br />echo <<<UBBTPRINT 



In changedisplay.php add in the necessary stuff...

Code
// ------------- <br />// Get the input <br />	$Adselect = get_input("Adselect","post"); <br />             if ((empty($Adselect)) || (!Adselect)) { <br />               $Adselect = 0; <br />             } <br /> <br />// ----------------------- <br />// Format the query words <br />   $Adselect_q   = addslashes($Adselect); <br /> <br />// -------------------------- <br />// Update the User's profile <br />   $query = " <br />    UPDATE {$config['tbprefix']}Users <br />    SET U_Ads       = '$Adselect_q', <br />



You'd also have to make sure to authenticate U_Ads in ubbt.inc.php and assign it a variable ($ads).

Then in the header.php ad code, you'd modify it to say something like...

Code
if ( ((preg_match("/-6-/",$postergroup)) && ($ads == 1)) || (!preg_match("/-6-/",$postergroup)) ) { <br />     if (@include(getenv('DOCUMENT_ROOT').'/php/phpadsnew/phpadsnew.inc.php')) { <br />         if (!isset($phpAds_context)) $phpAds_context = array(); <br />         $phpAds_raw = view_raw ('zone:3', 0, '_blank', '', '0', $phpAds_context); <br />         echo $phpAds_raw['html']; <br />    } <br />}   

Sponsored Links
Entire Thread
Subject Posted By Posted
display banner depending on groups flint 01/07/2005 1:45 AM
Re: display banner depending on groups ksanuk 01/07/2005 3:57 AM
Re: display banner depending on groups flint 01/07/2005 4:51 AM
Re: display banner depending on groups JoshPet 01/07/2005 5:19 AM
Re: display banner depending on groups ksanuk 01/07/2005 7:03 AM
Re: display banner depending on groups Twisty 01/07/2005 10:45 AM
Re: display banner depending on groups ksanuk 01/07/2005 12:26 PM
Re: display banner depending on groups Twisty 01/07/2005 2:02 PM
Re: display banner depending on groups flint 01/08/2005 5:32 PM
Re: display banner depending on groups Twisty 01/08/2005 5:54 PM

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
Posts: 70
Joined: January 2007
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20240430)