bp_loggedin_user_id() is always 0
-
Hi I’m interested in writing a custom function to get the users xprofile data and parsing it. However i cannot get xprofile_get_field_data(‘1′,’1’) to work. When I run it I get an empty string.In fact I can’t even get bp_displayed_user_id(), bp_loggedin_user_id() or $bp->profile->table_name_data to work. They all give me a value of 0 because they are empty for some reason even if the id of the logged in user clearly isn’t 0. I know this from looking at the database and also by looking at get_current_user_id() which works fine.
So they way I’ve structured it, is I am using the Tesseract theme which I downloaded. Then made a child theme and i am writing my functions in functions.php.
When I tried putting my bp_displayed_user_id() and bp_loggedin_user_id() calls in bp-custom.php in /Applications/XAMPP/htdocs/wordpress/wp-content/plugins I don’t get any value at all. I don’t even get 0. So that means its not even running. Also when I put it in a custom plugin file in wp-content/plugins I get no value as well. I would really love any help!!!
My ultimate aim is to take in xprofile data that a user enters in as a dare and then compare it to teh current date and then output this in the user’s profile.
- The topic ‘bp_loggedin_user_id() is always 0’ is closed to new replies.