Skip to:
Content
Pages
Categories
Search
Top
Bottom

Display default status update if the latest update function returns empty

  • Avatar of ARHistoryHub
    ARHistoryHub
    Participant

    @arhistoryhub

    I’ve been trying to figure out how to display default text (only to the logged in member) if a member has no profile activity updates. My thinking is that some text – something like “Update your status below to display text here to the community…” – would encourage new members to update their status upon joining.
    Here’s my member header php
    `

    @?

    `

    I’ve tried fiddling around with if empty() and isset() stuff, but can’t figure out how to achieve the desired results. Anyone out there willing to lend they’re expertise here? If I figure it out in the mean time, I’ll post my solution.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Avatar of ARHistoryHub
    ARHistoryHub
    Participant

    @arhistoryhub

    `

    `

    Am I getting warmer? The second part of the if – the && empty portion – doesn’t work as the “Update your status” message appears even when there’s an update present.

    Avatar of ARHistoryHub
    ARHistoryHub
    Participant

    @arhistoryhub

    So I figured it out. If anyone else wants to display a default status, only to the logged-in user on their profile if they have no current activity update, put this code in your member-header.php in your child theme.
    `
    <?php if ( !bp_get_activity_latest_update($user_id = false) && bp_is_my_profile() )
    echo “Oops, you have no current status! Update your status below.”;
    else echo “” ?>
    `

    Avatar of sidjags
    sidjags
    Member

    @sidjags

    @ARHistoryHub thanks so much for that code!! was searching for it all over the place… but found it here. i changed it a little bit so that a default message is showcased on a users public profile to other visitors if there hasnt been any activity…

    sidjags

Viewing 3 replies - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.