WordPress.org

Ready to get started?Download WordPress

Forums

Participants Database
How to change data entry after a certian date (2 posts)

  1. mbsmi
    Member
    Posted 1 year ago #

    I am using the Participates Database to store the membership information for all my members in my club. I have everything set up and mostly working correctly, but just a few issues.

    1. On one of my fields, under admin, I have the expiration date set to today()+365, but it returns todays date. How can I get the date of next year (ie: currently shows 6/2/13, but want it to show 6/2/14).

    2. I have another field (a radio button with yes/no) that I call active. When a member is paid, I want it to be yes, but I would like for the system to change it to No after the expire date.

    http://wordpress.org/plugins/participants-database/

  2. xnau
    Member
    Plugin Author

    Posted 1 year ago #

    OK, to get an expiration date such as you suggest, it's necessary to set that date when the record is create or the membership renewed. So this has to go into the signup template so it can set the value when the person signs up. This date can later be changed if the membership is renewed.

    To add a renewal date, you need to create a custom template for your signup form. (this page will help with that) First, define your 'renewal_date' field as a date field and set it to be included in the signup form. Then, in your custom template, add this after the line with "$this->the_field()" in it:

    <?php
     if ($this->field->name == 'renewal_date') {
        $this->field->form_element = 'hidden'; // make it hidden
        $this->field->value = strtotime('+ 12 months'); // calculate the date
        $this->field->print_element(); // print the hidden field
        continue; // skip to the next field
     } ?>

    When someone renews, you'll need to update their record with the new renewal date. The renewal date will be shown to the customer when they check their record. You'll also be able to include that information in the email the get when they register.

    Your second request is a bit trickier because you either have to make this happen in the background (this requires an auxiliary plugin), or it gets checked when the record is displayed, either in the list or singly. That is a little easier to do, because you can add it to a custom template, but may not work in your situation because there could be considerable lag time between the actual expiration date and when the status can be updated.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic