Support » Plugin: Auto Post Scheduler » Using Auto Post Scheduler with SNAP (Social Network Auto Poster)

  • I have seen a few questions on this forum about how to use this plugin with NextScripts: Social Networks Auto-Poster (SNAP) pushing to Facebook (https://wordpress.org/plugins/social-networks-auto-poster-facebook-twitter-g/).

    Out of the box Auto Post Scheduler does work with SNAP – but you MUST ONLY pull from Drafts (not Pending, Not Published, Not Recycle).

    However, with a small modification, you can use it with Drafts, Published, and Recycle (Not pending).

    To modify the file, go to the auto-post-scheduler.php file. Look for this code, starting around line 648

    			$update = array();
    			$update['ID'] = $id;
    			$update['post_status'] = 'publish';
    			$update['post_date_gmt'] = date('Y-m-d H:i:s',current_time("timestamp",1));
    			$update['post_date'] = get_date_from_gmt($update['post_date_gmt']);
    			if ($status == "publish")
    				$update = apply_filters('aps_recycle_post', $update);
    			else
    				$update = apply_filters('aps_update_post', $update);
    			if ($aps_debug) aps_write_log( sprintf( __("DEBUG: wp_update_post %s", 'auto-post-scheduler'), print_r($update,true) ) );
            		update_option('aps_updating', TRUE);
    			kses_remove_filters();
    			wp_update_post($update);
    			kses_init_filters();
            		update_option('aps_updating', FALSE);
    			$cnt++;
    			$day_num++;

    REPLACE it with:

    			$update = array();
    			$update['ID'] = $id;
    // Edit to allow functioning with SNAP plugin  [1 of 2]
    $update['post_status'] = 'draft';
    wp_update_post($update);
    // EDIT END			
    			$update['post_status'] = 'publish';
    			$update['post_date_gmt'] = date('Y-m-d H:i:s',current_time("timestamp",1));
    			$update['post_date'] = get_date_from_gmt($update['post_date_gmt']);
    			if ($status == "publish")
    				$update = apply_filters('aps_recycle_post', $update);
    			else
    				$update = apply_filters('aps_update_post', $update);
    			if ($aps_debug) aps_write_log( sprintf( __("DEBUG: wp_update_post %s", 'auto-post-scheduler'), print_r($update,true) ) );
            		update_option('aps_updating', TRUE);
    			kses_remove_filters();
    // Edit to allow functioning with SNAP plugin [2 of 2]
    do_action('draft_to_publish', $id);
    // EDIT END
    			wp_update_post($update);
    			kses_init_filters();
            		update_option('aps_updating', FALSE);
    			$cnt++;
    			$day_num++;

    What this does is to modify the behavior of the plugin, so that if it is pulling from published or Recycling a previously published post, it first sets the status to DRAFT, THEN Publishes it. That allows SNAP to see it as a “new” post and push it through to Facebook. This probably works with other social networks — but I have not tested that yet.

    • This topic was modified 1 year, 11 months ago by  Tisha Oehmen. Reason: code had an error
    • This topic was modified 1 year, 11 months ago by  Tisha Oehmen. Reason: edit code for error
    • This topic was modified 1 year, 11 months ago by  Tisha Oehmen.
Viewing 14 replies - 1 through 14 (of 14 total)
  • Tisha, I use Auto-Post Scheduler and SNAP together quite smoothly, with posts scheduled from PENDING, without having to modify auto-post scheduler.

    jamesmillerlifeology

    (@jamesmillerlifeology)

    Hi, Tisha. I used your code, but unfortunately, it is not publishing the recycled posts to SNAP.

    Hi JamesMillerLifeology – if it has already been published once with SNAP, you have to clear the meta to make it work. To do that, go to SNAP Settings, the Help/Support/About tab, and at the bottom, press the “[Remove all SNAP metainfo in the posts] – this will remove all SNAP data that was saved in posts.” link.

    I do this about once a month and I never have an issue. (My posts replublish every 45-60 days)

    jamesmillerlifeology

    (@jamesmillerlifeology)

    Hi Tisha. Thank you so much. I just now happened to see this response. I found that SNAP was blocking my woocommerce checkout so I deleted SNAP. However I am now using SMAP and Facebook Auto Publisher from XYZ Scripts. How would I tailor your code to fit these two plugins? Since they are from the same developer their post to publish should be the same. However, I am not sure if that is their specific code they use. I can’t seem to find it in their help database.
    http://help.xyzscripts.com/docs/social-media-auto-publish/) http://help.xyzscripts.com/docs/facebook-auto-publish/)

    I really appreciate your help.

    I’m so sorry — that’s well above my skill level. I had to hire a developer for the code I provided. But I was happy to do so, as it solved my problem, and might solve others.

    • This reply was modified 1 year, 6 months ago by  Tisha Oehmen.
    jamesmillerlifeology

    (@jamesmillerlifeology)

    I totally understand. Thank you for your quick response.

    Have a fantastic weekend.

    Tisha Oehmen thanks you for the workaround solution..

    hmm i’ve noticed some strage behaviour after change the code above

    more specifically when posts are re-posted any videos with iframe code for example
    <iframe width=”560″ height=”315″ src=”https://www.youtube.com/embed/xxxx” frameborder=”0″ allowfullscreen></iframe>

    now are being converted to youtube short code i.e
    [youtube https://www.youtube.com/watch?v=xxxxxx%5D

    with result not being able to play the videos :/

    do you have any ideas how to deal with this?
    Thanks

    That’s strange. I haven’t noticed that – but I also don’t run many videos on my site. Are you running a YouTube plugin that might me grabbing the code and trying to apply a shortcode?

    I would also try reverting the code to the original in the plugin and try manually working the sequence. If that works and the code doesn’t change, you might need to work with a coder to refine the hack to work in your environment.

    yes it’s very strange..
    i don’t have any youtube plugins, maybe wordpress does it by default?

    good idea to revert the code to the original. When i try this i have to:
    1) grab an already published post and set status to draft
    2) then wait for the auto-post-scheduler to take it from the drafts pools and see what happens?

    am i right?

    Thanks

    these are the results from my tests

    —-original code—–
    there is no insertion of [youtube …] shortcode, but not recycled posts are posted to fb via SNAP

    —–code modified for SNAP—–
    there is insertioni when iframe source code for youtube is found, the posted articles are ok in facebook via SNAP but videos cannot play (they have the [youtube url…]

    —–Attempt to reproduce the problem manually—-
    What i did is to take an already published article, changed it to pendind,then draft and the published it again, there is alteration of iframe source of youtube, thus the code remains intact and no problems found.

    It seems that this extra code affects something! :/
    Do you have an idea how i can find it? it drives me crazy 🙁

    I’m so sorry — I don’t know what’s wrong there. First thing I would to do is see if it’s an issue with all iframes (new posts) that publish through the autoposter. If so, then go the plugin developer for help. Otherwise, you’d be best off hiring a developer to work through why modifying the status would change the iframe.

    SOLVED
    the youtube shortcode was hidden somewhere inside Jetpack plugin..
    it could be or stated more clearly..

    thanks for your support

    SOLVED for youtube,
    but the situation (when autoposted with the changed code) remains the same for all embedded code that may has iframe (like videos from youtube, facebook or even instagram photos)

    I tried with a clean wordpress install and just autopost with altered code and a draft post with <iframe youtube video> and has the same behaviour. (strips all iframe code!)

    Can you please try it and let me know?
    Thanks

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Using Auto Post Scheduler with SNAP (Social Network Auto Poster)’ is closed to new replies.