Function Reference: gdfi_post_to_facebook

Summary

This function has not been documented yet.

Source Code

function gdfi_post_to_facebook($new_status, $old_status, $post)
{
    if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'geodir_import_export') {
        return;
    }//dont post imports from csv to facebook

    if ($old_status != 'publish' && $new_status == 'publish') {
        if (get_post_meta($post->ID, 'gdfi_posted_facebook', true)) {
            return;
        }// if posted to facebook don't post again.
        if (geodir_social_cpt_post_to_facebook($post->post_type) && !get_option('geodir_social_disable_auto_post')) {
            global $wpdb;
            $to_post = get_option('gdfi_post_to_facebook');
            $to_post[$post->ID] = array('ID' => $post->ID, 'title' => $post->post_title);
            update_option('gdfi_post_to_facebook', $to_post);

            update_post_meta($post->ID, 'gdfi_posted_facebook', '1'); // mark it as posted to facebook
        }
    }
}