Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Some questions about BuddyPress friendships


Boone Gorges
Keymaster

@boonebgorges

If the last query reads 0s where there should be valid ids, you are probably not constructing the query correctly. Are you using $wpdb->prepare, with sprintf syntax?
`$query = $wpdb->prepare( ‘SELECT id, is_confirmed FROM {$bp->friends->table_name} WHERE (initiator_user_id = %d AND friend_user_id = %d) OR (initiator_user_id = %d AND friend_user_id = %d)’, $initiator_user_id, $friend_user_id, $initiator_user_id, $friend_user_id );`

(I’m not sure if this is your exact query, but you get the idea.)

If it still isn’t working, then as an experiment, try passing the prepare() arguments as strings – replace %d with %s in the replacement patterns.

I suggest you dump your variables/query string just before AND just after the query is constructed in this manner, to see whether prepare() is causing the problem.

Skip to toolbar