Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/11/2012 01:41:51 PM (12 years ago)
Author:
boonebgorges
Message:

Rearranges logic in bp_blogs_record_comment() to avoid PHP notices when a post is left by a non-logged-in user. Fixes #4068. Props Mamaduka

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-blogs/bp-blogs-functions.php

    r5796 r5899  
    246246        return false;
    247247
    248     // Get the user_id from the comment author email.
    249     $user    = get_user_by( 'email', $recorded_comment->comment_author_email );
     248    // Get the user by the comment author email.
     249    $user = get_user_by( 'email', $recorded_comment->comment_author_email );
     250
     251    // If user isn't registered, don't record activity
     252    if ( empty( $user ) )
     253        return false;
     254
     255    // Get the user_id
    250256    $user_id = (int) $user->ID;
    251 
    252     // If there's no registered user id, don't record activity
    253     if ( empty( $user_id ) )
    254         return false;
    255257
    256258    // Get blog and post data
Note: See TracChangeset for help on using the changeset viewer.