function buddyblog_filter_posting_message($message, $post_id, $post_type_obj, $form) { if ($form->get_post_type() != buddyblog_get_posttype()) { return $message; } if (!buddyblog_is_post_published($post_id)) { //if the job is not active, let us know that to the user $message = __('Your post was saved.', 'buddyblog'); } return $message; }
/** * retusn a link that allows to publish/unpublish the post * @param type $post_id * @param type $label_ac * @param type $label_de * @return type */ function buddyblog_get_post_publish_unpublish_link($post_id = false, $label_ac = 'Publish', $label_de = 'Unpublish') { if (!$post_id) { return; } if (!buddyblog_user_can_publish(get_current_user_id(), $post_id)) { return; } $post = get_post($post_id); $url = ''; if (!(is_super_admin() || $post->post_author == get_current_user_id())) { return; } //check if post is published $url = buddyblog_get_post_publish_unpublish_url($post_id); if (buddyblog_is_post_published($post_id)) { $link = "<a href='{$url}'>{$label_de}</a>"; } else { $link = "<a href='{$url}'>{$label_ac}</a>"; } return $link; }