Ads appearing before Start Date | Support Questions | Support Forum

A A A

Please consider registering
guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed Topic RSS sp_TopicIcon
Ads appearing before Start Date
August 2, 2017
10:36 pm
Michael Wendell
Member
Members
Forum Posts: 5
Member Since:
August 2, 2017
sp_UserOfflineSmall Offline

Hello,

I think I ran into this on BDP as well… but when you display ads in AWPCP, do you respect the value for the Start Date? Will an ad display on the front end before the Start Date entered in the admin section?

Thanks,
m.

August 3, 2017
12:37 am
AWPCP Support
Moderator
Members

Moderators
Forum Posts: 4583
Member Since:
September 4, 2013
sp_UserOfflineSmall Offline

Hi Michael Wendell,

Which version of WP and AWPCP are you using?

Are you posting the ad through the admin dashboard or importing them to AWPCP?

Please check for any conflict that might be causing this. Here is an article that should guide you with this https://awpcp.com/forum/faq/how-to-test-for-plugintheme-conflicts/

August 3, 2017
8:52 am
Michael Wendell
Member
Members
Forum Posts: 5
Member Since:
August 2, 2017
sp_UserOfflineSmall Offline

Yes, yes… I cannot disable all of the plugins or switch the theme, even on our development server. Nothing would work at all and it would be a pointless test.

We’re using the latest AWPCP (3.7.7 ?) and WP 4.5.3. And no, we can’t upgrade WP at this time. That’s on the schedule, but with the amount of functionality the site has we’re looking at three days of testing on dev even before we consider rolling it into production.

The question is simple though… if I create an ad (from the admin section) and I give it a Start Date of August 6, 2017, will I see the ad in the listings on the public site on August 4, 2017? Or should I, as I would expect, not see the ad in the listings until August 6th?

If this is broken somehow, I can fix it, but I want to know if this functionality is even part of AWPCP before I start looking.  I can’t imagine that there’s a plugin conflicting with the post query on AWPCP, but hey, you never know, right?

Also, if it the feature is broken on our site, then it would probably be helpful to know where in the code I should look.

m.

August 3, 2017
9:08 am
Michael Wendell
Member
Members
Forum Posts: 5
Member Since:
August 2, 2017
sp_UserOfflineSmall Offline

To reiterate… I’m not looking to have you debug the issue if it is a problem with our site, I’m just looking to find out if this (filtering by start date) is a feature of your plugin by default. If I installed AWPCP on a clean WP install, would it work this way?

m.

August 4, 2017
11:47 am
Michael Wendell
Member
Members
Forum Posts: 5
Member Since:
August 2, 2017
sp_UserOfflineSmall Offline

I was able to find the answer for this in the archives…

http://awpcp.com/forum/support…..assifieds/
http://awpcp.com/forum/support…..tart-date/

Looks like it is not a supported feature.

My client has approved time for me to add it to the plugin. Any suggestions on where I should start? I’ve poked around the code and there’s a LOT going on here. If it helps, our client adds all classifieds themselves from the admin page, and does not use any of the payment functionality. They just need to be able to have the classified stay hidden until the start date.

Any help would be appreciated.

m.

August 4, 2017
11:01 pm
AWPCP Support
Moderator
Members

Moderators
Forum Posts: 4583
Member Since:
September 4, 2013
sp_UserOfflineSmall Offline

Hi Michael Wendell,

Yes, the ad would appear instantly and not on the start date. This is something we have planned for a future release, but is not supported yet with AWPCP.

Here is our customization documentation that should guide you with this https://awpcp.com/documentation/customization-guide/

August 6, 2017
9:26 pm
Michael Wendell
Member
Members
Forum Posts: 5
Member Since:
August 2, 2017
sp_UserOfflineSmall Offline

Here’s what I ended up doing; it’s not perfect, and I hate modifying the internal code in a plugin, but it seems to work fine. Please let me know if you can think of a better way.

m.

In /includes/class-listings-collection.php for v3.7.7, starting on line 117:

// MODIFIED FUNCTION
public function find_enabled_listings_with_query( $query ) {
    $results = $this->finder->find( $this->make_enabled_listings_query( $query ) );
    $output = $this->filter_results_by_startdate( $results );
    return $output;
 }

// NEW FUNCTION
public function filter_results_by_startdate( $results ) {
    $output = array();
    if (is_array($results) && !empty($results)) {
        foreach ($results as $r) {
            if ($r->ad_startdate) {
                if (strtotime($r->ad_startdate) < time()) {
                    $output[] = $r;
                }
            } else {
                $output[] = $r;
            }
        }
    }
    return $output;
 }
August 8, 2017
11:52 pm
AWPCP Support
Moderator
Members

Moderators
Forum Posts: 4583
Member Since:
September 4, 2013
sp_UserOfflineSmall Offline

Hi Michael,

Thank you for the code. We’ve noted it for inclusion and is pending review with our developer.

Forum Timezone: America/Denver

Most Users Ever Online: 163

Currently Online: Gerhard
21 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Johnny B: 140

godie: 120

laburke: 94

NAIN KHAN: 93

salvig67: 84

kerdezo: 84

rude: 72

purplepaula: 72

gery: 71

WAYTOBAYWTB52: 71

Member Stats:

Guest Posters: 28

Members: 36910

Moderators: 2

Admins: 2

Forum Stats:

Groups: 1

Forums: 4

Topics: 6580

Posts: 29579

Newest Members:

Gerhard, Eleni, john, liam noah, dfhdfhsfdhfdh, Olexiy, fdsa, testca, ReiniJo, Tina Conroy

Moderators: awpcp: 7530, AWPCP Support: 4583

Administrators: wpengine: 0, awpcp: 298

Skip to toolbar