Skip to:
Content
Pages
Categories
Search
Top
Bottom

Do not show unless logged in

Viewing 8 replies - 1 through 8 (of 8 total)
  • Avatar of bp-help
    bp-help
    Participant

    @bphelp

    Study the below link in the codex. That is what you need!

    http://codex.wordpress.org/Function_Reference/is_user_logged_in

    Avatar of Famous
    Famous
    Participant

    @famous

    Whats the best way to use that php snippet to encapsulate html code like the below? I tried and cannot get it to work correctly:
    `
    if ( is_user_logged_in {
    div1
    div2

    bp_loggedin_user_avatar( “full” );

    end div1
    end div2

    }

    Avatar of danbpfr
    danbpfr
    Participant

    @chouf1

    @famous,

    Try this if you’re on 1.7 – 150 is the avatar full size

    <?php if ( is_user_logged_in() ) : ?>

    <div> blah </div> <!– div1 ->

    <?php echo ‘<strong>’ . get_avatar( $item['user_id'], ’150′ ) . ‘ ‘ . bp_core_get_userlink( $item['user_id'] ) . ‘</strong>’; ?>

    <div> blah </div> <!– div2 ->

    <?php endif; ?>

    Avatar of Famous
    Famous
    Participant

    @famous

    thanks Chouf1
    this snippet did it:

    whatever your divs or code is place it here

    In case anyone is wondering – encapsulate your code with what Chouf1 provided and it works like a charm.

    Avatar of Famous
    Famous
    Participant

    @famous

    thanks Chouf1
    this snippet did it:
    `
    whatever your divs or code is place it here
    `

    In case anyone is wondering - encapsulate your code with what Chouf1 provided and it works like a charm.

    Avatar of Famous
    Famous
    Participant

    @famous

    thanks Chouf1
    this snippet did it:

    whatever your divs or code is place it here

    In case anyone is wondering – encapsulate your code with what Chouf1 provided and it works like a charm.

    By the way how did you get your code to show up Chouf1? I cannot get php to show up?

    Thanks

    Avatar of danbpfr
    danbpfr
    Participant

    @chouf1

    @famous, i simply copy/paste it directly in the textarea without using any tag or attribute

    Avatar of Hugo
    Hugo
    Moderator

    @hnla

    @Famous the codex is your friend for many things , stuff like template tags and conditional functions,  also looking through BP template files will often show you things like is_user_logged_in() in use ( bp-default theme sidebar.php shows examples of this use)

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

You must be logged in to reply to this topic.