Support » Plugin: post2email » Send Email when Auto Old Recycle Posts

  • Is there a way for post2email to trigger and send out an email when an old post is recycled as “new”? post2email is successfully sends an email when a new post is publish, but not when an old post is recycled as “new”. I would greatly appreciate any help. Thank you.

    https://wordpress.org/plugins/post2email/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Halfelf Rogue & Plugin Review Team Rep

    How are you recycling? You mean updating a post with a new date?

    Thank you for responding. There is a plugin that is an Auto Post Scheduler that recycles oldest post and makes them the newest. There are a total 121 posts and set the schedule to auto post every 7 days. The hope is to have post2email trigger to send an email of the recycled post.

    Plugin Author Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Halfelf Rogue & Plugin Review Team Rep

    https://wordpress.org/plugins/auto-post-scheduler/

    Can you confirm its that plugin? If so, I’ll have a look at what it does in depth. A quick glance makes it seem like it’s actually not using the WordPress functions to change post status, which would by why it’s not working properly.

    Frankly, I personally consider that a bit spammy. Reposting old posts without new content sounds like it’s trying to scam the search engines.

    Yes, that is the plugin being used. Thank you for your candor. I agree about it being a but spammy, even if it’s once a week. However, this is not my blog but the personal blog of the owner and CEO encouraging staff to practice proper grammer.

    Any insight of how to make this work would be greatly appreciated. Thank you.

    Plugin Author Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Halfelf Rogue & Plugin Review Team Rep

    That was fun.

    My plugin is using transition_post_status which checked if you were moving from anything to published. This was simple in a lot of ways since it let me be sure you only sent one email.

    transition_post_status

    Now the trick here is that it only works if the post status is… well … updated.

    auto-post-scheduler is adding things directly as published, which is neither wrong nor right, but that’s why it’s not being triggered. There’s no transition and my plugin is literally looking for this:

    1. If new status isn’t equal to publish, don’t publish (i.e. drafts, private posts, etc)
    2. If OLD status IS equal to publish, don’t publish (i.e. updated posts)

    Theoretically they could use wp_transition_post_status and in many ways, that would improve their compatibility – https://codex.wordpress.org/Post_Status_Transitions has a lot more information on that.

    The other way around is if I moved to save_post instead, but then I have a high risk of an email being sent out if you update a post :/ I can’t blanket check ‘if this is an update’ because draft -> publish is an update. I CAN set a post_meta in there, but again, that wouldn’t really work for all existing posts.

    That means another option would be to run an update for all existing posts to add a meta field in to say the post had already had the emails sent. Which could work but it would be expensive if you have a lot of posts.

    So right now I’ve added in a new aspect to the plugin. It adds a post meta value of 1 to “post2emailsent” once the email is sent. At that point, it will never send the email again. Ever.

    Should I add it to save_post as well? I’m not sure. The checks needed there in order to ensure that it’s only sent on an update to publish, and not an update of a publish post, are pretty incredible, and may not work. Had I put in the post meta from the start, it would be a lot easier :/ Even so, I was unable to 100% force the plugin to only email on new posts using other methods. I’ll keep digging into how Jetpack does it, but it’s a lot of weight to add.

    Version 1.3 will have some fixes but not really for this. It’s not going to be easy to do this in the best way.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Send Email when Auto Old Recycle Posts’ is closed to new replies.