Opened 16 years ago
Closed 16 years ago
#297 closed defect (bug) (fixed)
Unpublished and Password protected posts are displayed
Reported by: | gwrey | Owned by: | |
---|---|---|---|
Milestone: | Priority: | major | |
Severity: | Version: | ||
Component: | Keywords: | ||
Cc: |
Description
Fixed as outlined below and in the attached bp-blogs.php
Around line 268
Change this:
$post->post_type != 'post' | $post->post_status != 'publish' | $post->post_password != ") |
return false;
To this:
$post->post_type != 'post') |
return false;
This change is need to keep us in the process so we can update an existing entry if it's status has changed.
Around line 384
Change this:
/* Don't record this if it's not a post, not published, or password protected */
if ( $post->post_type != 'post' $post->post_status != 'publish' $post->post_password != ) return false;
/
- Check how many recorded posts there are for the user. If we are
- at the max, then delete the oldest recorded post first. */
if ( BP_Blogs_Post::get_total_recorded_for_user() >= TOTAL_RECORDED_POSTS )
BP_Blogs_Post::delete_oldest();
if ( !BP_Blogs_Post::is_recorded( $post_id, $blog_id ) ) {
if ( $post->post_status == 'publish' ) {
$recorded_post = new BP_Blogs_Post;
To this:
/* Don't record this if it's not a post */
if ( $post->post_type != 'post' )
return false;
if ( !BP_Blogs_Post::is_recorded( $post_id, $blog_id ) ) {
if ( $post->post_status == 'publish' ) {
/* gwrey
Moved the test for max total records inside this
block so we will only delete a record IF we are going to add a new one
*/
/
- Check how many recorded posts there are for the user. If we are
- at the max, then delete the oldest recorded post first. */
if ( BP_Blogs_Post::get_total_recorded_for_user() >= TOTAL_RECORDED_POSTS )
BP_Blogs_Post::delete_oldest();
$recorded_post = new BP_Blogs_Post;
$recorded_post->user_id = $user_id;
Also needed so we keep going and update any existing entries
Around line 419
Change this:
if ( $post->post_status != 'publish' )
BP_Blogs_Post::delete( $post_id, $blog_id );
To this:
$post->post_password != ) |
BP_Blogs_Post::delete( $post_id, $blog_id );
This will delete a post from the BP posts log if it is no longer published or if a password has been added.
Around line 423
Change this:
add_action( 'publish_post', 'bp_blogs_record_post' );
To this:
add_action( 'save_post', 'bp_blogs_record_post' );
This will update the post data any time it is saved, not just when published.