Skip Navigation

[Resolved] How to update a specific field, such as expiration-date, for multiple members?

This support ticket is created 5 years, 11 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 4 replies, has 2 voices.

Last updated by Nigel 5 years, 11 months ago.

Assisted by: Nigel.

Author
Posts
#1156029

Tell us what you are trying to do?

I have a membership site I wrote from scratch using Types/Views/CRED almost ~5 yearsago. Our membership annual renewals are due for all members in December, as they expire on Dec 31 every year. My client has asked for an easy way to update many expiration dates (year only) at a time, since renewals come in bunches via PayPal. It is otherwise very time consulming to open each member's profile to update that field. There are currently 238 members. I have already done two versions of this, but the one from last December no longer works - and it was never a great solution.

Since I don't believe there is a way to do this using CRED (Toolset forms,) I would like to build a table with all members' name and expiration year, and hopefully use AJAX to execute the update. I am savvy in PHP and MySQL, but not sure which is the best way to approach this. I am simply asking if you guys have any ideas or can point me in the right direction.

Thanks for your always excellent help.

What is the link to your site?
hidden link

#1156195

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Jeff

If you have members that were created via a Form that uses post expiration then advancing the date when they expire is simply a matter of updating the _cred_post_expiration_time timestamp in the postmeta table.

You can change that in the backend—tedious to do manually for that many members—but you could also run a script to do it.

I don't know how your payments work, but if there is an action you can hook into when a payment is made (e.g. a WC order is completed) then you could automatically update the postmeta for that very post, rather than manually creating a list of posts you want to update the expiration for that you supply to your script.

#1156509

Hi Nigel -

You got it right on the nose. I am planning to write up a quote for my client to automate the renewal process, using PayPal API and Types API. Unfortunately, I didn't get that all done in time for this year's renewals, which are already coming in now. So, I am trying to throw together something not-so-automatic to get the client through December and January.

I will take a look at the _cred_post_expiration_time timestamp, but I think it's not really what I am looking for at this point. Still, it may be useful in other ways, or eventually.

Thanks for your thoughts! Much appreciated.
And have a good holiday.

Jeff Safire
---------------------

#1156819

Hey, Nigel -

I ended up making it work without much trouble (or thinking.)
I set up a View as usual for the CPT I need to access and update, but set the Limit to 1, and added a search box. Then I created a CRED form that is called by the View in the Loop, and it displays the post_title (member name,) the current expiry date, and an "Update" button for submit. As long as I have the Limit set to 1 so that only one record can be submitted at a time, it works.

Not a perfect solution, but it gets the job done and my client is happy. And it's fast.

I am marking this thread as Resolved.
Thanks again for your thoughts and insight. I still plan to figure out the right way to do this function.

Cheers,
Jeff Safire
---------------

#1157660

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Glad you have a solution for the time being. I don't think you marked this as resolved, so let me do that now.