Support » Plugin: Auto Post Scheduler » making APS work with updated posts

  • Hello

    Your plugin is really great, perfect for keeping the blog alive and reusing all that evergreen content.

    However, and that issue has already been brought up here in the support forum, updated posts do not trigger the most common “auto-post-to-social-media” plugins, like Social Media Auto Publish (SMAP) ou Jetpack Publicize.

    There are some premium plugins that allow to repost old posts to social media, but that ends up being a bad soluton, because they don’t update the post date, and the visitor coming from a social network will land on what he perceives as “old news”.
    The APS approach is much better, and the only thing lacking is the ability to make the post “a new post”.

    In another support thread you suggested a user to make the posts draft and then APS would publish them as new.
    So, half the job is already done, APS is already able to take draft posts and publish them, triggering “social-auto-posters”.

    Following that idea, I tried manually changing a published post to draft and then publising it again and, although it does not triggger Jetpack Publicize (there is a hack for that), it triggers SMAP, republishing to the social networks.

    The missing half is, when APS selects the posts to update the date, change them from published to draft, saving them and then trigger the publishing process already existant (the other half).

    Not being a coder I don’t have any idea on how that could be done or how hard it is to implement such a function, but believe that such a feature would be largelly appreciated by APS users, since it opens new possibilites of usage.

    Or maybe, if not something native inside APS, maybe some function to add to the options file.

    Can you provide some help on this?

    Thanks in advance and best regards

    • This topic was modified 2 years, 2 months ago by  apessoa.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author johnh10

    (@johnh10)

    Hello,
    As you noticed plugins like SNAP and SMAP don’t trigger when recycling old posts as new because they don’t consider it a newly published post. Ideally I could tell APS to optionally trick WordPress to consider recycled posts as a newly published post, thus triggering SNAP, SMAP, etc. For now, you can use this code snippet.

    add_action( 'post_updated', 'aps_check_recycle', 10, 3 );
    
    function aps_check_recycle( $postID, $after, $before ) {
        if ( $before->post_status == 'publish' && $after->post_status == 'publish' && $before->post_date != $after->post_date ) {
    	// we changed the post date. let WP think this is a newly published post to trigger SNAP,SMAP,etc.
    	do_action( 'draft_to_publish', $postID );
      }
    }

    john, you are great !

    Thanks man. 🙂

    hi john
    tried the code for a while now and it is not triggering SNAP/SMAP/Jetpack.
    Posts are being recycled to new dates,but triggering of republish does not occur.
    Manually saving as draft and then publishing works.

    The “draft_to_publish” does not appear to suffice. Maybe an intermediate step is needed in the action above, forcing the wp DB to save the status as draft and only then publishing it.

    I went though google to find some code for that, but making nested actions is simply beyond my knowledge.
    Can you give me a help?

    thanks again and best regards

    Plugin Author johnh10

    (@johnh10)

    If “draft_to_publish” doesn’t trigger those plugins you’ll need to check those plugins to verify the functionality that does trigger them. On SNAP it looks like they use ‘publish_post’.

    I was able to get it functioning – you’ll find my solution here: https://wordpress.org/support/topic/using-auto-post-scheduler-with-snap-social-network-auto-poster/

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘making APS work with updated posts’ is closed to new replies.