Error using bp_displayed_user_id()
-
Hi, I’m sorry if the question is quite noobish; its because I am. I’m trying to use bp_displayed_user_id() for a code I’m writing. It’s fine when use inside a function, but when using outside of function, i got error “Fatal error: Call to undefined function bp_displayed_user_id()…”. Can anybody explain to me why so?
to paint a better picture, i’m trying to set different BP profile landing page for different user roles. Here’s the code that i put in bp-custom.php
global $bp; $displayed_user = bp_displayed_user_id(); $member_id = get_userdata( $displayed_user ); if ( $member_id->roles[0] == $role ){ $default_landing = define('BP_DEFAULT_COMPONENT', 'my-store' ); } else { $default_landing = define('BP_DEFAULT_COMPONENT', 'following' ); }
It’s a bit out of topic, but if I use the above code in a function, can anybody point me to what hook/action to use along the function to be able to fire up the above code?
Hope I’m making some sort of sense here.
- You must be logged in to reply to this topic.