WordPress.org

Ready to get started?Download WordPress

Forums

Gravity Forms Directory
How to limit the directory items by date submitted? (6 posts)

  1. AutomatedKid
    Member
    Posted 1 year ago #

    If anyone has a clue on how to limit what entries will show up based upon submission date, I would be very grateful if you'd be willing to share 'how.'

    I'd like to show approved entries from the last 7 days only.

    thanks

    http://wordpress.org/extend/plugins/gravity-forms-addons/

  2. Zack Katz
    Member
    Plugin Author

    Posted 1 year ago #

  3. AutomatedKid
    Member
    Posted 1 year ago #

    Close, but no cigar! I read that before and it's not exactly what I'm looking for.

    Zack, what I need to be able to do is have your directory show a rolling list of the last X days of approved/submitted entries.

    ie, I would like to show all entries from 2013-02-15 to 2013-02-21 for today. Tomorrow I'd like to "automatically" show all entries from 2013-02-16 to 2013-02-22. The following day will be 2013-02-17 to 2013-02-23. Etc, etc

    So I guess what I'm asking, is there a way to do this automatically, using a rolling date criteria?

    Thanks in advance, Zack.

  4. Zack Katz
    Member
    Plugin Author

    Posted 1 year ago #

    This could be done with PHP to output a date inside the shortcode.

    <?php
    $shortcode = '[directory form="%s" start_date="%s" end_date="%s"]';
    $form_id = '29'; // Replace this
    $start = date('Y-m-d', strtotime('-7 days'));
    $end = date('Y-m-d', time());
    echo do_shortcode(sprintf($shortcode, $form_id, $start, $end));
    ?>
  5. AutomatedKid
    Member
    Posted 1 year ago #

    I've spent about 2 hours with various combos and it's still showing all entries and I'm losing any mods to the directory including your extra touches with this latest update. So when you get a chance, if you can guide me slightly more, I'd really appreciate it.

    Here's your modified code I'm using in the Shortcode Exec PHP plugin...
    $shortcode = '[directory form="%s" start_date="%s" end_date="%s" approved="true" useredit="true" adminedit="true" lightboxsettings="images" jstable="true"]';
    $form_id = '1'; // Replace this
    $start = date('Y-m-d', strtotime('-7 days'));
    $end = date('Y-m-d', time());
    echo do_shortcode(sprintf($shortcode, $form_id, $start, $end));

    It's working to get your directory showing on my page, but, like I just mentioned, losing any directory modifications and all entries are still showing.

    So if you can help someone who wants to learn, needs a little more guidance, I promise to stay sober until then...maybe.

    Thank you.

    ps, I also promise to leave positive feedback once I get everything resolved.

  6. AutomatedKid
    Member
    Posted 1 year ago #

    Zack, could you explain a bit more on how to handle the php you provided me? I'd really, really appreciate it. I could do things with limited assistance. And it doesn't have to be using a 3rd party plugin for the php. Plus, if other people may have a similar question in the future, at least there will be an answer for them on the forum. Thank you.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic