Thanks shanebp,
I’m probably doing something fundamentally incorrect here but ive replace the %CURRENT_USER_ID% section of MySQL query with bp_displayed_user_id() and it gives me errors.
I am running the query inside the wpdatatables plugin so its not a true MySQL query form.
My code is below, if you have a time could you take a look. Query runs fine when I replace bp_displayed_user_id() with an integer.
Thanks
SELECT wpyn_ks_trick_post.ID,
wpyn_ks_trick_post.TrickID,
wpyn_ks_trick_post.LevelID,
wpyn_ks_trick_post.Verified,
wpyn_ks_trick_post.VerifiedBy,
wpyn_kstricklist.TrickID,
wpyn_kstricklist.Category,
wpyn_kstricklist.TrickName,
wpyn_kstricklist.TrickDescription,
wpyn_kstricklist.Points,
wpyn_kstricklist.Grade
FROM wpyn_ks_trick_post
LEFT JOIN wpyn_kstricklist
ON wpyn_ks_trick_post.TrickID = wpyn_kstricklist.TrickID
where wpyn_ks_trick_post.ID = bp_displayed_user_id()
> Query runs fine when I replace bp_displayed_user_id() with an integer.
You need to adjust your sql so that it uses a variable.
Try something like :
$user_id = bp_displayed_user_id();
... where wpyn_ks_trick_post.ID = $user_id
This is a basic php / mysql issue. There are lots of tutorials on the subject.
Thanks for the help Shane, I’ll play around with it.