• Skip to primary navigation
  • Skip to main content

RocketGeek

Home of WP-Members, The Original WordPress Membership Plugin

  • WordPress Plugins
    • WP-Members
      • FAQs
      • Quick Start
      • Documentation
      • Extensions
    • Advanced Options
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • Download Protect
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • Invite Codes
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • MailChimp Integration
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • PayPal Subscriptions
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • Salesforce Web-to-Lead
    • Security
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • Text Editor
      • Purchase the Plugin
      • Get the Pro Bundle
    • User List
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • User Tracking
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • Memberships for WooCommerce
    • WordPass
  • Store
    • Cart
    • Checkout
  • Blog
    • Basics [Free]
    • Tips and Tricks
    • Filters
    • Actions
    • Code Snippets
    • Shortcodes
    • Design
    • Release Announcements
  • Contact
  • Sign In
  • Show Search
Hide Search
Home » Actions » Set user expiration to a fixed date

Set user expiration to a fixed date

Chad Butler · Nov 3, 2014 ·

The PayPal Subscription Extension operates by setting a user’s expiration date to today + the subscription period. For example, if the subscription period is 1 year, the expiration date will be one year from now.

But what if you want all users to expire/renew on the same day of the year? Or if you would like to just set a hard date far out in the future?  Yes, there is a way you can do such things.

There is an action hook that comes just after the user’s expiration date is automatically set – wpmem_exp_after_set_exp.  Using this action, you can create a custom function to change the expiration date that is automatically set by the extension to whatever you want.  Here are three simple examples. 

This article is only available to WP-Members Support Subscribers. If you have an existing subscription, please login below. If you do not have a current support subscription, you can purchase a support subscription here.

Already a Member? Log In Here
   
Forgot password? Click here to reset

To gain full access to WP-Members premium content, a current support subscription is required. You can purchase an annual support subscription for as little as $59, which provides you with access to priority support, a customer support forum, access to code snippets, and more.

Why wait? Choose your subscription option here.

[
Why join?]

Actions, Tips and Tricks actions, add_action, paypal, wpmem_exp_after_set_exp

Welcome to RocketGeek Interactive › Forums › Set user expiration to a fixed date

Tagged: actions, add_action, PayPal, wpmem_exp_after_set_exp

  • This topic has 3 replies, 3 voices, and was last updated 6 years, 5 months ago by Chad Butler.
Viewing 2 reply threads
  • Author
    Posts
    • November 3, 2014 at 1:31 pm #6320
      Chad Butler
      Keymaster

      The PayPal Subscription Extension operates by setting a user’s expiration date to today + the subscription period. For example, if the subscription pe
      [See the full post at: Set user expiration to a fixed date]

    • November 5, 2014 at 3:34 am #6352
      shnhealy
      Participant

      A really useful post. Will take note of this in case we need to set expiry dates.

    • November 14, 2014 at 1:51 pm #6421
      transmitstudio
      Participant

      Thanks, Chad. This is helpful.

      My client asked me to push all member expiry dates to 6/30/15. I wasn’t sure how to use your code to do that – I put the code in functions.php but didn’t know how to execute it – so I ended up using phpMyAdmin instead. This query worked:

      UPDATE wp_usermeta SET meta_value = REPLACE (meta_value,'12/31/2014','06/30/15');

      • November 14, 2014 at 2:35 pm #6422
        Chad Butler
        Keymaster

        The code as described here would only effect users as they subscribe or renew, so you did it right to globally change everyone – using a MySQL query.

        I think what you have may be OK, but you might want to run an update on your update to make the year 2015 instead of 15.

  • Author
    Posts
Viewing 2 reply threads
  • You must be logged in to reply to this topic.
Log In

Ready to get started?

Join Today!

© 2021 · butlerblog.com · RocketGeek is built using WordPress, WP-Members, and the Genesis Framework

  • butlerblog.com
  • WP-Members Support Subscription
  • Terms of Service
  • Refund Policy