Opened 11 years ago
Closed 11 years ago
#6247 closed defect (bug) (fixed)
Typo Error in BP_Friends_Friendship class update sql query
| Reported by: | sbrajesh | Owned by: | boonebgorges |
|---|---|---|---|
| Priority: | normal | Milestone: | 2.3 |
| Component: | Friends | Version: | 2.2 |
| Severity: | normal | 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 ) );
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Thanks, sbrajesh!