So in theory, if I write a function to filter into your oci_user_ function, say with an sql query to get the xprofile data I want to use in the forum, it will hit that function, run the query, add it to the bbGroups array, and that array gets saved to the user_meta for later access, correct? That way it isn’t always running my query everytime, but only if it doesn’t exist in bbGroups already… Am I on the right track?
Yep. You got it exactly John.
Looks like I should be able to use “bp_get_field_data” to get the job done, lets see if I can get this to play nice.
Quick suggestion, although I bet many people won’t run into this issue…
function oci_get_userdata($u){
$u = (int) $u;
$user = bb_get_user($u);
if ($user->bbGroups) {
return stripslashes_deep((array)$user->bbGroups);
} else {
return stripslashes_deep((array)$user);
}
}
Then, I changed…
function oci_user_name($u){
$bp_user = oci_get_userdata($u);
if ($bp_user['fullname']) {
return $bp_user['fullname'];
} else {
return $bp_user['display_name'];
}
}
Basically, I integrated my forums before installing BuddyPress, so there are users that haven’t updated their BuddyPress profiles that won’t have fullname’s yet… This way I have all of their normal info to manipulate later and still get their original wordpress display_name to fallback on…
There is probably a much prettier way of doing this, but this is the solution my tired brain could come up with for now.