Fatal error: Using $this when not in object context

Elite
  • 412 points
    WPMU DEV Expert
    I'm helpful
    Christopher Price

    Member  —  1st July 2010 18:29         

    Since upgrading to WP3.0 and BuddyPress 1.2.5 I found that marking users as SPAM or Deleting them would result in the following error:

    Fatal error: Using $this when not in object context in /home/mysite/public_html/wp-content/plugins/buddypress/bp-groups/bp-groups-classes.php on line 1053

    I found the solution here:
    http://buddypress.org/community/groups/how-to-and-troubleshooting/forum/topic/fatal-error-when-trying-to-delete-user/#post-61229 from Michael Sumner

    Open the file mentioned, and replace this:

    $group_ids = $this->get_group_ids( $user_id );

    with this:

    $group_ids = BP_Groups_Member::get_group_ids( $user_id );

    And right below that, replace this:

    foreach ( $group_ids->groups as $group_id ) {

    with this:

    foreach ( $group_ids['groups'] as $group_id ) {

    Already fixed for 1.2.6 http://trac.buddypress.org/ticket/2479