Skip to:
Content
Pages
Categories
Search
Top
Bottom

bp_is_page() and $bp[‘currrent_userid’] purpose


  • Burt Adsit
    Participant

    @burtadsit

    I’m trying to find out why ‘news’ from the member theme gets 404 on a blog. I decide to disable it temporarily and find code in the member theme header.php that goes something like this:

    ...if (bp_is_page('news')) {class="selected"} ...

    OK, I get that part. If news is the current page in the member theme, highlight the button. Inside bp_is_page() is a detection of if ($bp['current_userid']) then don’t highlight it.

    What is $bp['current_userid']? It seems to be a companion of $bp['loggedin_userid'] but it’s only valid in the member theme. We’ve got like 100 refs in code to ‘current_userid’ and 200 or so for ‘loggedin_userid’.

    Some bp functions use ‘current_userid’ and some ‘loggedin_userid’. I’m confused as to when, where and why I can, should and shouldn’t use these things.

    Anybody have any clarification? It’d be appreciated.

Viewing 2 replies - 1 through 2 (of 2 total)
  • current_userid is set when you are viewing a users profile – so it is the user id of the member currently being viewed. If you are not viewing a user profile, it is 0.

    loggedin_userid is the user id of the user logged in.

    bp_is_home() does a if ( current_userid == loggedin_userid ) return true; else return false;

    So bp_is_home() will return true if you are viewing your own profile.


    Burt Adsit
    Participant

    @burtadsit

    Thanks Andy. I guess I’m confused because I want to use some function calls that seem to rely on $bp. I know what I want to do and just prowl around looking for something that fits my needs. I’m realizing that some fns just aren’t general purpose type things. They were built for use in the member theme.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘bp_is_page() and $bp[‘currrent_userid’] purpose’ is closed to new replies.
Skip to toolbar