Skip to:
Content
Pages
Categories
Search
Top
Bottom

No data found in displayed_user object

  • Avatar of substancej
    substancej
    Participant

    @substancej

    WP: 3.5
    BP: 1.6.3
    Site: rideoregonride.com

    Just upgraded WP to 3.5 and simultaneously updated BP to 1.6.3. Members pages no longer work and instead redirect the user to the homepage. I’ve discovered that in the custom PHP code for this page, the first thing that happens is that the global $bp object is declared and then a check is made for the $db->displayed_user->id value which isn’t there. Here’s the code being run:

    `
    if ( ! $this->bp->displayed_user->id )
    {
    $this->Redirect(‘/’);
    }
    `

    This is what the displayed_user object from the global $bp object looks like:

    `
    [displayed_user] => stdClass Object
    (
    [domain] =>
    [userdata] =>
    [fullname] =>
    )
    `

    As you can see there’s no ‘id’ property at all and what keys are there are all empty. The data for the loggedin_user seems to be fine, but I need the displayed_user data for the profile pages. I’m not used to working with BP so I’m not sure what could be causing this problem.

Viewing 1 replies (of 1 total)
  • Avatar of Slava UA
    Slava UA
    Participant

    @slaffik

    Displayed user data is accessble only on profiles pages (like `example.com/members/slaffik`). On others it will be empty. Actualy it’s bad that it has empty keys data in it on other pages… But that’s the question to the BP core developers.

     

    Try the function `bp_displayed_user_id()`.

Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.