Support Forums

Old 07-07-2006, 12:33 PM   #1
Junior Member
 
Join Date: Jul 2006
Location: Houston, TX
Posts: 1
Rep Power: 0
TVAS is on a distinguished road
Default Way to limit # of free ads by users?

I'm running a heavily modified version of V3.0.11 Developer.

We have 4 listing packages, one of them is Free.

Is there a way to limit how many ads a user can place in the Free listing package?
__________________
Rhonda / TVAS Webmaster
www.chooseyourpuppy.com
www.txvirtualassistant.com
TVAS is offline  
Old 07-07-2006, 02:08 PM   #2
Moderator
 
juven14's Avatar
 
Join Date: Mar 2006
Location: Texas
Posts: 2,192
Rep Power: 60
juven14 is a jewel in the rough
Default

Yes - you'd have to count the number of products from the product table made by user id and product #. Then redirect them to a message.

I don't have 3.0.11 nor can I take into account any other mods you might have made so you should adapt this code to your own.

Within Step 3 - usercheckout.php just below:
PHP Code:
$productid=(int)@$_REQUEST['productid']; 
Add in:
PHP Code:
//begin max free ads
$freeID 'id of free listing package';
if(
$productid==$freeID)
{
$totalAllowedFree 'number of free ads allowed';

$sSQL sprintf("SELECT oOwnerID FROM ".PREFIX."orders WHERE oOwnerID=%s AND oProductID=%s)",
GetSQLValueString($userid"int"),
GetSQLValueString($freeID"int"));
$result=$db->query($sSQL);
$numrows $result->size();

if(
$numrows $totalAllowedFree)
{
    
//They have too many free ads redirect.
    
$location="usercheckout.php";
    
$class_tpl->assign('title',"Failure");
    
$class_tpl->assign('forward',FALSE);
    
$class_tpl->assign('location',$location);
    
$class_tpl->assign('msg'," You have exceeded the max free listings. <a href='".$location."'>Place an Ad</a>");
    
$class_tpl->assign('body','forward.tpl.php');
    
$class_tpl->display('layout.tpl.php');
    exit;
}
//end max free ads redirect
}//end max free ads 
Now I haven't tested this so be sure to back up your files and test the results. Let me know how this works out.
__________________
John Snyder
PHP Developer

Last edited by juven14; 07-07-2006 at 02:17 PM.
juven14 is offline  
 

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
'Users Awating Email Confirmation� group. SkGold v3.1 Suggestions and Feedback 2 07-18-2006 04:30 PM
Delete inactive users automatically pat01 v3.1 Suggestions and Feedback 0 07-03-2006 10:12 AM
free template hostu v3.1 Questions & Support 1 06-18-2006 11:36 AM
Users able to upload photos in excess of package limit civ v3.0 Questions & Support 2 06-02-2006 11:14 AM
Free Trial? Refund/Return policy? Cindy Pre Sales Questions 3 04-24-2006 09:12 PM


All times are GMT -4. The time now is 02:20 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0