Skip to:
Content
Pages
Categories
Search
Top
Bottom

show header item when user not login in buddypress

  • Avatar of maan18
    maan18
    Participant

    @maan18

    when i was not login in buddypress the header item buttons in user profiles is not show up and i was trying to show user header item buttons like add friend, follow and send private message in buddypress but it will need required to user login to add add friend, follow and send private message just like this Link . there is any way to do this in buddypress.

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

    @bphelp

    @maan18
    I am not certain I understand your requirement but you can try:

    https://github.com/bphelp/private_community_for_bp_lite

    Avatar of maan18
    maan18
    Participant

    @maan18

    @bphelp Thank for your reply. my question is simple. i need to show member header item which include (add friend, send private message etc). which are not showing when user are not login. i need to remove login to see header item button condition . any way to do this.

    Avatar of Henry
    Henry
    Participant

    @henrywright-1

    ‘Add friend’ and ‘send private message’ aren’t supposed to display when a user is logged out. For example, how would BuddyPress know who the friend request came from? How would BP know who the private message came from?

    Avatar of maan18
    maan18
    Participant

    @maan18

    @henrywright-1 i need show button only but when user click on any button it required to login or Register to add or send message. same as like this theme Link

    Avatar of Henry
    Henry
    Participant

    @henrywright-1

    @maan18

    I’m not sure what you’re asking exactly but take a look at this:

    <?php 
           if ( is_user_logged_in() ) { 
           // whatever you put here will be displayed if the user is logged in
           } else { 
           // whatever you put here will be displayed when logged out
           } 
    ?>
    Avatar of maan18
    maan18
    Participant

    @maan18

    not working.

    Avatar of Henry
    Henry
    Participant

    @henrywright-1

    @maan18

    it should work, I have used this approach many times.

    Avatar of maan18
    maan18
    Participant

    @maan18

    but it’s not working in member-header. is there any thing wrong in my code:

    <div id="item-buttons">
    <?php 
           if ( is_user_logged_in() ) { 
           do_action( 'bp_member_header_actions' );
           } else { 
           do_action( 'bp_member_header_actions' );
           } 
    ?>
    			
    
    		</div><!-- #item-buttons -->
    Avatar of Henry
    Henry
    Participant

    @henrywright-1

    @maan18

    Your code is outputting the exact same line of code to both logged in users and logged out users:

    do_action( 'bp_member_header_actions' );

    The idea of an ‘if’ statement is to output different code based on certain criteria being met.

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

You must be logged in to reply to this topic.