• Hi, I’ve just added your plugin to a site I’m building.

    I’m looking to create a list display for club members to show which event they are taking place in. I’ve set up the fields, bt is there a way to display the list based on event date order (not date added or updated). There could be more than 1 person signs up to each event, so having the date order would make sense.

    Also, each person may sign up to more than one event – so i’ve changed the duplicate notification to be “record ID” is this correct? As they would enter their name, email, telephone, each time, but it’s not a duplicate if they add a different event name. The page will only display for members once it’s all set up.

    Could you offer some help?
    Great plugin by the way!

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author xnau webdesign

    (@xnau)

    If you use “record ID” for your duplicate check, it really isn’t doing anything because each new sign up will have a new ID. It sounds like you don’t need to worry about duplicates anyway, so it’s not a problem.

    I would suggest some way to ensure that the event name is standardized so that you will be able to get a complete list of all the people that signed up for a specific event…such as using a dropdown or radio buttons so people are selecting the event from a list.

    You can certainly sort by a date field, make sure that the event date field is marked as “sortable” where it is defined on the Manage Database Fields page.

    Thread Starter px2

    (@px2)

    Thank you so much for your help, I’ve made the list display in date order now. One last question.. is there a way to only show future dated events? So past event dates would not show at all?

    Plugin Author xnau webdesign

    (@xnau)

    You can set up a “filter” in the list shortcode that will show records depending on the value of a field (such as a range of dates) but in this case it’s a little more complicated because the filter has to be based on the current date. So it will require a little PHP and a way to get the code into your page.

    Filtering a List Based on the Current Date

    Thread Starter px2

    (@px2)

    Hi, Im sorry to bring this up again, I wasn’t able to complete my task yet!

    I’ve read through the link, but am a bit confused, I’d like to filter to show results that are from today onwards on the date of the event (one of the custom fields I added) rather than the date entered on the database.

    I’ve tried one of the php snippets – but do I just add this to the page – or on a template? This is the page: https://www.wensumvalleycycling.co.uk/sportive/sportive-list/

    If you could help out I’d be very grateful.

    Thanks

    Plugin Author xnau webdesign

    (@xnau)

    Is the event date field set as a “date” type field in Participants Database? It will need to be if it is not, since we need to do calculations on the date.

    Take a look at this code, it shows how to display a list that shows all records with an event date that is today or later:

    <?php
    $today = date( 'M j,Y'  ); // today's date
    echo do_shortcode( '[pdb_list filter="event_date>=' . $today . '" ]' );
    ?>

    I hope that is helpful

    Thread Starter px2

    (@px2)

    Hi, I’m so sorry to drag up an old post, I just remembered I never finished this task!

    I used the code above, and nothing at all shows. The date of event is listed as date_of_sportive in my database, so I changed it to

    <?php
    $today = date( ‘M j,Y’ ); // today’s date
    echo do_shortcode( ‘[pdb_list filter=”date_of_sportive>=’ . $today . ‘” ]’ );
    ?>

    Which I placed on the page where the results are to show. No records show at all. The field is listed as a date with dd/mm/yyyy format – which it shows as
    “12th October 2017” (example!) if I just use the [pdb_list] code.

    Do you have any other suggestions for me on this? To recall, I only want to show future dated events (not date record is entered) – not past dated events.

    Many Thanks

    Plugin Author xnau webdesign

    (@xnau)

    I am assuming that you have set up a plugin or some other way to insert php into your page content. Normally, this doesn’t work, you have to install a plugin, or do something so that your php will be executed on your page.

    Next, I’m assuming the date_of_sportive field is defined as a date field on the Manage Database Fields page.

    You will need to check your database values directly, using phpMyAdmin (this is usually found in your hosting control panel) Take a look at the records in the wp_participants_database table and make sure the date_of_sportive column has the correct data for your records: each one should be a 10-digit number, which is the unix timestamp for the date.

    If those conditions are met, it should work, given that the date values are in the future.

    If your dates are stored as plain text dates, a different approach is needed to get this working.

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

The topic ‘Sort List by date order’ is closed to new replies.