Opened 10 years ago
Closed 10 years ago
#6247 closed defect (bug) (fixed)
Typo Error in BP_Friends_Friendship class update sql query
Reported by: | sbrajesh | Owned by: | boonebgorges |
---|---|---|---|
Milestone: | 2.3 | Priority: | normal |
Severity: | normal | Version: | 2.2 |
Component: | Friends | Keywords: | |
Cc: | sbrajesh |
Description
Hi,
In the BP_Friends_Friendship class save() method there is a typo in the update sql.
On line 159 in bp-friends/bp-friends-classes.php, The sql query has an extra bracket(')')
$result = $wpdb->query( $wpdb->prepare( "UPDATE {$bp->friends->table_name} SET initiator_user_id = %d, friend_user_id = %d, is_confirmed = %d, is_limited = %d, date_created = %s ) WHERE id = %d", $this->initiator_user_id, $this->friend_user_id, $this->is_confirmed, $this->is_limited, $this->date_created, $this->id ) );
Note the ')' that causes a failure of the update query. It seems the BuddyPress core never updates the row directly using the instance but I am using this class to utilize 'is_limited' relationship in a special case and the update is failing.
A simple fix is removing the extra ')' like this
$result = $wpdb->query( $wpdb->prepare( "UPDATE {$bp->friends->table_name} SET initiator_user_id = %d, friend_user_id = %d, is_confirmed = %d, is_limited = %d, date_created = %s WHERE id = %d", $this->initiator_user_id, $this->friend_user_id, $this->is_confirmed, $this->is_limited, $this->date_created, $this->id ) );
Change History (2)
Note: See
TracTickets for help on using
tickets.
Thanks, sbrajesh!