Title: Limit ads?
Last modified: April 18, 2019

---

# Limit ads?

 *  Resolved [bdd](https://wordpress.org/support/users/bws-online/)
 * (@bws-online)
 * [7 years ago](https://wordpress.org/support/topic/limit-ads-2/)
 * Is there any way to limit the number of ads a particular user can post at one
   time?
 * Even better, any way to limit the number of ads a particular user can post in
   each category at one time?
 * Thanks!

Viewing 15 replies - 1 through 15 (of 15 total)

 *  Plugin Author [Greg Winiarski](https://wordpress.org/support/users/gwin/)
 * (@gwin)
 * [7 years ago](https://wordpress.org/support/topic/limit-ads-2/#post-11445961)
 * Hi,
    by default, there is no such feature in WPAdverts but you can add it using
   Limit User Active Listings snippet [https://github.com/simpliko/wpadverts-snippets/blob/master/limit-user-active-listings/limit-user-active-listings.php](https://github.com/simpliko/wpadverts-snippets/blob/master/limit-user-active-listings/limit-user-active-listings.php)
 * By default the limit is set to 5, you can change it to a different number on 
   line 40.
 * Please note that that this will work only on logged in users, for the anonymous
   users it is impossible to check how many Ads they have already posted.
 * How to install the snippet you can read here [https://github.com/simpliko/wpadverts-snippets/](https://github.com/simpliko/wpadverts-snippets/)
   at the bottom of the page.
 *  Thread Starter [bdd](https://wordpress.org/support/users/bws-online/)
 * (@bws-online)
 * [7 years ago](https://wordpress.org/support/topic/limit-ads-2/#post-11448346)
 * Thank you Greg.
 * No problem on this only working for logged in users, as only logged in users 
   are allowed to see the ads anyway.
 * I’ll have to do a little more testing here, but something’s a bit off/I have 
   a question about something else.
 * First the question — is there any way to let them know they’ve reached their 
   limit BEFORE they fill out the whole ad and go to publish it?
 * And for the part that’s a bit off — I also have it so that ads need to be approved
   before they’re published (per the moderate parameter being set to 1 as described
   here: [https://wpadverts.com/documentation/allow-users-to-post-ads-adverts_add/](https://wpadverts.com/documentation/allow-users-to-post-ads-adverts_add/)).
   Right now it seems to be approving every other ad/putting every other one into
   moderation. I’ll have to turn off the Limit User Active Listings snippet to see
   if that was part of the problem. (I’ll let you know on that — if it’s not related
   to this snippet I’ll start a new topic.)
 * Thanks again.
 *  Thread Starter [bdd](https://wordpress.org/support/users/bws-online/)
 * (@bws-online)
 * [7 years ago](https://wordpress.org/support/topic/limit-ads-2/#post-11448351)
 * I’m back. Noticed that the Limit User Active Listings message is actually triggering
   on other ad pages (not just the Add page). I’m going to start fresh and see what
   I see. So for the moment, please ignore my question above about letting them 
   know they’ve reached their limit BEFORE they fill out the whole ad and go to 
   publish it. Thanks.
 *  Thread Starter [bdd](https://wordpress.org/support/users/bws-online/)
 * (@bws-online)
 * [7 years ago](https://wordpress.org/support/topic/limit-ads-2/#post-11448454)
 * More problems now so I can’t test this out yet.
 * When I attempt to edit the Add page, it’s saying “This page isn’t working” (that
   the URL is “currently unable to handle this request”) and giving me an HTTP ERROR
   500. Is this a known issue?
 *  Thread Starter [bdd](https://wordpress.org/support/users/bws-online/)
 * (@bws-online)
 * [7 years ago](https://wordpress.org/support/topic/limit-ads-2/#post-11448480)
 * Okay. Looks like Limit User Active Listings was what was busting the Add page.
   Thoughts?
 *  Plugin Author [Greg Winiarski](https://wordpress.org/support/users/gwin/)
 * (@gwin)
 * [7 years ago](https://wordpress.org/support/topic/limit-ads-2/#post-11456768)
 * The Internal Server Error is just a general error message, to find out an actual
   error message you would need to open file wp-config.php add there a line `define("
   WP_DEBUG", true );` and refresh the page it should show an error message which
   you can copy and paste here i should be then able to help.
 *  Thread Starter [bdd](https://wordpress.org/support/users/bws-online/)
 * (@bws-online)
 * [7 years ago](https://wordpress.org/support/topic/limit-ads-2/#post-11467725)
 * It’s showing a browser 500 error, not a WordPress error, so WP_DEBUG doesn’t 
   provide any information.
 * See: [https://ibb.co/vk6HkhF](https://ibb.co/vk6HkhF)
 *  Plugin Author [Greg Winiarski](https://wordpress.org/support/users/gwin/)
 * (@gwin)
 * [7 years ago](https://wordpress.org/support/topic/limit-ads-2/#post-11469276)
 * Have you tried using the WP_DEBUG? With most servers using WP_DEBUG would show
   the actual error instead of 500 error, as most likely this is still a PHP error
   only covered with a 500 header so there are no debug information freely available
   to anyone.
 * One other way to get the actual error message, is to open the error_log file 
   and look for the error message there, it should be at the end of the file. If
   you are not sure where to get the error_log from you would need to ask the hosting
   tech support about it as the location of the file varies from server to server.
 *  Thread Starter [bdd](https://wordpress.org/support/users/bws-online/)
 * (@bws-online)
 * [7 years ago](https://wordpress.org/support/topic/limit-ads-2/#post-11470382)
 * Yes, I tried using WP_DEBUG — as I said, WP_DEBUG didn’t provide any information.
 * I checked both the hosting Error Log (via cPanel) and the php_errorlog file directly—
   nothing is triggering from this error.
 * I also confirmed that if I attempt to edit the page that contains the shortcode
   while the Limit Active Listings snippet/plugin is active I get the 500 error —
   turn it off, I can edit the page.
 * Any other suggestions/advice? Thanks.
 *  Plugin Author [Greg Winiarski](https://wordpress.org/support/users/gwin/)
 * (@gwin)
 * [7 years ago](https://wordpress.org/support/topic/limit-ads-2/#post-11476980)
 * Hmm without the additional debug information it is hard to suggest anything.
 * I understand the problem occurs in wp-admin panel only when editing the page 
   from wp-admin panel, there are two thing you can try:
 * 1. after line `$max = 5;` add line `include_once ADVERTS_PATH . '/includes/shortcodes.
   php';`.
 * 2. replace the line `
    add_action( “init”, “limit_user_active_listings_init”,
   20 );`
 * with
 *     ```
       if( ! is_admin() ) {
           add_action( "init", "limit_user_active_listings_init", 20 );
       }
       ```
   
 *  Thread Starter [bdd](https://wordpress.org/support/users/bws-online/)
 * (@bws-online)
 * [7 years ago](https://wordpress.org/support/topic/limit-ads-2/#post-11486387)
 * Thank you very much Greg.
 * I tried both options individually, and they each eliminated the problem.
 * I tried both at the same time, and it worked, too.
 * Do you recommend one or the other options — or both?
 *  Plugin Author [Greg Winiarski](https://wordpress.org/support/users/gwin/)
 * (@gwin)
 * [7 years ago](https://wordpress.org/support/topic/limit-ads-2/#post-11487566)
 * Ok great i am glad you have it resolved.
 * When updating the code snippet i think i will go with the solution #1, but in
   the end i think it will not make much (if any difference) so you can select the
   solution you like or both of them.
 *  Thread Starter [bdd](https://wordpress.org/support/users/bws-online/)
 * (@bws-online)
 * [7 years ago](https://wordpress.org/support/topic/limit-ads-2/#post-11530201)
 * When using Limit User Active Listings with moderation, is there a way to limit
   it BEFORE the ads are moderated? In testing, just had a user submit 4 ads for
   moderation.
 *  Plugin Author [Greg Winiarski](https://wordpress.org/support/users/gwin/)
 * (@gwin)
 * [7 years ago](https://wordpress.org/support/topic/limit-ads-2/#post-11532722)
 * You should be able to do that by changing in limit-user-active-listings.php file
   the line
 *     ```
       'post_status' => 'publish',
       ```
   
 * to
 *     ```
       'post_status' => array( 'publish', 'pending' ),
       ```
   
 *  Thread Starter [bdd](https://wordpress.org/support/users/bws-online/)
 * (@bws-online)
 * [7 years ago](https://wordpress.org/support/topic/limit-ads-2/#post-11536519)
 * Looks good — thanks!

Viewing 15 replies - 1 through 15 (of 15 total)

The topic ‘Limit ads?’ is closed to new replies.

 * ![](https://ps.w.org/wpadverts/assets/icon-256x256.png?rev=2423472)
 * [WPAdverts - Classifieds Plugin](https://wordpress.org/plugins/wpadverts/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wpadverts/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wpadverts/)
 * [Active Topics](https://wordpress.org/support/plugin/wpadverts/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wpadverts/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wpadverts/reviews/)

## Tags

 * [category](https://wordpress.org/support/topic-tag/category/)
 * [limit](https://wordpress.org/support/topic-tag/limit/)

 * 15 replies
 * 2 participants
 * Last reply from: [bdd](https://wordpress.org/support/users/bws-online/)
 * Last activity: [7 years ago](https://wordpress.org/support/topic/limit-ads-2/#post-11536519)
 * Status: resolved