0

I'm looking for the best way to remove a custom post type post object association from a term for "a designated amount of time" and then when that time expires the association continues.

It also has to be scalable in case more than a few thousand associations where in 'probation'.

Does anyone have any commentary or ideas on how to go about this idea?

Edit:

In the comments I have been asked for more context.

Context:

I was thinking that my WordPress powered email client might better serve it's subscribers by offering them to temporarily mute email notifications from a list they belong to rather than do a hard unsubscribe.

Email recipients may not want to unsubscribe completely, but rather postpone notifications for a month or even a year while they address something else that is taking up most of their time.

Since my email notification lists are powered by users being stored in a custom post type and their list associations being defined by term associations I figured the best way to do this is to invent a term 'unassociation' caching system.

To further define the constraints of this theoretical situation I want to pretend that we have to use hooks provided by WordPress core to manage the associations. Maybe the 'heartbeat' hook.

If noone else can think of another way to do this with core hooks then another option is to use a custom, non WP core, plugin driven cron service hook to power the service.

4
  • Please show your efforts and your research. Also explain the why for your question. Currently it's impossible to understand and maybe there's a better solution for the problem you are actually facing.
    – kaiser
    Apr 8, 2016 at 3:15
  • I agree with @kaiser. This sounds like an interesting dilemma, but without context it is lost as far as design is concerned. Apr 8, 2016 at 5:50
  • I was just looking for theoretical discussion on the best way one might go about disassociating a term from a post object for a given period of time. And then after that time expires, the term re-associates. Maybe stack exchange is not the right place this question, considering this was a late night idea and I've not spent one second trying to develop it before hand. I wanted to poll for advice first.
    – atwellpub
    Apr 9, 2016 at 17:28
  • I took a stab at an answer. You can see how subjective it is even with the edited data you provided. I certainly understand your apprehensiveness withholding code, but I can also say that this type of discussion is best left to internal review of your company. If you don't have people that can expand on this within the complexities of your proprietary software then you should hire someone. Apr 12, 2016 at 2:12

1 Answer 1

1

I think since the users are a CPT, it would be well suited to do this in post_meta on the user. You could store the temporarily unsubscribed term there and check against when sending notifications.

For example, your post_meta could be an array such as this:

subscribed_list_term => "maybe_cool_for_summer_list_term", subscription_duration => "halted_during_all_seasons_but_summer"

Obviously that is abstracted, but there is logic that can be built upon this idea.

1
  • At the end of the day this is probably the best contextual solution. Cheers! The idea of cached unassociations is still sexy, but the resources required to run it, without support in core possibly, is too much and a meta check on the email send side will do just well. I'm going to select this as the best answer. I still hope maybe something else will come of it in the future.
    – atwellpub
    Apr 12, 2016 at 23:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.