[buddypress-trac] [BuddyPress Trac] #6247: Typo Error in BP_Friends_Friendship class update sql query

buddypress-trac noreply at wordpress.org
Sun Feb 22 21:32:39 UTC 2015


#6247: Typo Error in BP_Friends_Friendship class update sql query
---------------------------------+-----------------------------
 Reporter:  sbrajesh             |      Owner:
     Type:  defect (bug)         |     Status:  new
 Priority:  normal               |  Milestone:  Awaiting Review
Component:  Component - Friends  |    Version:  2.2
 Severity:  normal               |   Keywords:
---------------------------------+-----------------------------
 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 ) );

 }}}

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/6247>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list