Skip to:
Content
Pages
Categories
Search
Top
Bottom

Do not show unless logged in

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

  • bp-help
    Participant

    @bphelp

    Study the below link in the codex. That is what you need!
    https://codex.wordpress.org/Function_Reference/is_user_logged_in


    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

    }


    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; ?>


    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.


    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.


    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


    danbpfr
    Participant

    @chouf1

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

    @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)
  • The topic ‘Do not show unless logged in’ is closed to new replies.
Skip to toolbar