function Publish_post($post) { if ($this->debug) { add_post_meta($post->ID, c_al2fb_meta_log, date('c') . ' Publish'); } $user_ID = self::Get_user_ID($post); // Checks if (self::user_can($user_ID, get_option(c_al2fb_option_min_cap)) && (self::Is_authorized($user_ID) || self::Is_login_authorized($user_ID, true))) { // Apply defaults if no form if (!isset($_POST['al2fb_form'])) { if (!get_post_meta($post->ID, c_al2fb_meta_exclude, true)) { update_post_meta($post->ID, c_al2fb_meta_exclude, get_user_meta($user_ID, c_al2fb_meta_exclude_default, true)); } if (!get_post_meta($post->ID, c_al2fb_meta_exclude_video, true)) { update_post_meta($post->ID, c_al2fb_meta_exclude_video, get_user_meta($user_ID, c_al2fb_meta_exclude_default_video, true)); } } // Check if not added/excluded if (!get_post_meta($post->ID, c_al2fb_meta_link_id, true) && !get_post_meta($post->ID, c_al2fb_meta_exclude, true)) { $add_new_page = get_user_meta($user_ID, c_al2fb_meta_add_new_page, true); // Check if public post if (empty($post->post_password) && ($post->post_type != 'page' || $add_new_page) && !self::Is_excluded($post)) { if ($post->post_type == 'reply') { WPAL2Int::Add_fb_link_reply($post); } else { WPAL2Int::Add_fb_link($post); } } } } }