[buddypress-trac] [BuddyPress] #3886: Non-static method BP_Core_Notification::get_all_for_user() should not be called statically

buddypress-trac at lists.automattic.com buddypress-trac at lists.automattic.com
Sat Dec 24 07:48:20 UTC 2011


#3886: Non-static method BP_Core_Notification::get_all_for_user() should not be
called statically
---------------------------+------------------------------
 Reporter:  kayue          |       Owner:
     Type:  defect (bug)   |      Status:  new
 Priority:  normal         |   Milestone:  Awaiting Review
Component:  Notifications  |     Version:
 Severity:  minor          |  Resolution:
 Keywords:  needs-patch    |
---------------------------+------------------------------

Comment (by kayue):

 To fix this, in bp-core-classes.php, should add a static keyword before
 declare the function.

     /**
      * Fetches all the notifications in the database for a specific user.
      *
      * @global object $bp Global BuddyPress settings object
      * @global wpdb $wpdb WordPress database object
      * @param integer $user_id User ID
      * @return array Associative array
      * @static
      */
     static function get_all_for_user( $user_id ) {
         global $bp, $wpdb;

         return $wpdb->get_results( $wpdb->prepare( "SELECT * FROM
 {$bp->core->table_name_notifications} WHERE user_id = %d AND is_new = 1",
 $user_id ) );
     }

-- 
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/3886#comment:1>
BuddyPress <http://buddypress.org/>
BuddyPress


More information about the buddypress-trac mailing list