DanielH Posted July 31, 2019 at 06:29 PM Share Posted July 31, 2019 at 06:29 PM Hi, I have a category and user group for dealers as profiles then a category for sale by dealer to post their cars. I would like to limit number of submissions to the for sale by dealer category unless they have a coupon code from paidlistings limiting their number of submissions or some other way to sell more submission access after they used up their quota using jreviews addons. Each dealer would purchase a plan for their userprofile and a unique coupon would be manually generated according to that plan with the number of or "block " of listing submissions access to the for sale by dealer category, ie:Plan a - coupon for 25 submissions, plan b - coupon for 50 submissions etc... The question is how do I prohibit access to submissions unless a valid coupon has been generated or a way to go about this that might be cleaner then what I am doing? I know what what I am trying to achieve but now just confused on which way to go after tearing into it for the last two days. Been working with the filter that only allows one submission per user as a start. Got that working limiting to five submissions using the code in the docs. /templates/jreviews_overrides/filters/filter_functions.php <?php defined('MVC_FRAMEWORK') or die; function one_listing_limit_registered_user($permission, $params) { // Uncomment line below to dump filter arguments to the screen // dd($permission, $params); $listingPermissions = (S2Object::make('perm'))->__('listing'); $auth = S2Object::make('auth'); if ( $auth->id > 0 ) { $Model = new S2Model(); $query = sprintf('SELECT count(*) FROM %s WHERE %s = %d AND state = 1', EverywhereComContentModel::_LISTING_TABLE, EverywhereComContentModel::_LISTING_USER_ID, $auth->id); $count = $Model->query($query,'loadResult'); if ( $count > 5 ) { $listingPermissions->setMessage('Sorry, you already created a listing and there\'s a limit of one listing per user'); return false; } } return $permission; } Clickfwd\Hook\Filter::add('can_create_listing', 'one_listing_limit_registered_user', 10); How can I tie this together WITH or WITHOUT using a coupon? Plus if having to manually having to go back and delete all orders for every client when renewing their submission block quotas that might be more then its worth. While writing this looked at setting the paidlistings plans for userprofile on dealers to expire that way the plan would expire and they could purchase another userprofile listing but wanted to allow dealers profile listing to be permanent being its also my directory. Plus one of the quota in the plan would go toward their profile and not actual vehicle listings. Thanks Daniel Link to comment
Alejandro Posted July 31, 2019 at 06:39 PM Share Posted July 31, 2019 at 06:39 PM This section is only visible with a valid subscription. If you have a valid subscription, please login. Link to comment
DanielH Posted July 31, 2019 at 07:27 PM Author Share Posted July 31, 2019 at 07:27 PM This section is only visible with a valid subscription. If you have a valid subscription, please login. Link to comment
Alejandro Posted July 31, 2019 at 10:19 PM Share Posted July 31, 2019 at 10:19 PM This section is only visible with a valid subscription. If you have a valid subscription, please login. Link to comment
DanielH Posted July 31, 2019 at 11:12 PM Author Share Posted July 31, 2019 at 11:12 PM This section is only visible with a valid subscription. If you have a valid subscription, please login. Link to comment
Alejandro Posted August 1, 2019 at 12:10 PM Share Posted August 1, 2019 at 12:10 PM This section is only visible with a valid subscription. If you have a valid subscription, please login. Link to comment
DanielH Posted August 1, 2019 at 01:09 PM Author Share Posted August 1, 2019 at 01:09 PM This section is only visible with a valid subscription. If you have a valid subscription, please login. Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.