Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to make a simple conditional check

  • Avatar of Shmoo
    Shmoo
    Participant

    @macpresss

    I’ve manually re-created the bp_get_options_nav because it’s a too dynamic and clunky piece of code.

    Now I’ve made a simple HTML nav-list of each group component and added some PHP code between to print the ‘bp_group_permalink’ / [component-name] / but I only need to find a way to check IF a user can moderator this current group or is admin, if thats TRUE –> print the HTML list of the [admin component ] IF FALSE do nothing and hide this HTML list.

    I would like to have the same conditional statement for the [ send-ivites ] component that checks if a user can invite friends because he’s logged-in + member of this group.

    
    		<nav class="item-list-tabs no-ajax nav-centered">
    			<ul class="button-group radius">
    				<li><a class="button" href=""><i class="fi fi-root-groups"></i></a></li>
    				<li><a class="button" href="<?php bp_group_permalink(); ?>"><i class="fi fi-home"></i></a></li>
    				<li><a class="button" href="<?php bp_group_permalink(); ?>members/">Members</a></li>
    				<li class="group-btn-select item-list-tabs no-ajax">
    					<ul>
    					/*** select filter stuff here ***/ 
    					</ul>
    				</li>
    				<li><a class="button" href="<?php bp_group_permalink(); ?>send-invites/"><i class="fi fi-megaphone"></i></a></li>
    				<?php do_action( 'bp_group_options_nav' ); ?>
    				<li><a class="button" href="<?php bp_group_permalink(); ?>admin/edit-details/"><i class="fi fi-wrench"></i></a></li>
    				<li><a class="button" href="<?php bp_group_activity_feed_link(); ?>" title="<?php _e( 'RSS Feed', 'buddypress' ); ?>"><i class="fi fi-rss"></i></a></li>
    			</ul>
    		</nav>
    

    group nav

    How can I make those conditionals on list number 5 and 6.

    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Avatar of Shmoo
    Shmoo
    Participant

    @macpresss

    Update:

    One conditional I got done by looking at some other template files..
    Inside the Group Activity template ( groups/single/activity.php ) I found this PHP tag and from reading the lines of code I could tell this was what I’m looking for.

    IF user_is_logged_in AND = group_member do that :)

    
    <?php if ( is_user_logged_in() && bp_group_is_member() ) : ?>
    <li><a class="button" href="<?php bp_group_permalink(); ?>send-invites/"><i class="fi fi-megaphone"></i></a></li>
    <?php endif; ?>
    

    One more to go..

    Avatar of Shmoo
    Shmoo
    Participant

    @macpresss

    Update 2

    This topic is resolved!

    Found the second conditional statement aswel,

    
    <?php if ( is_user_logged_in() && bp_current_user_can( 'bp_moderate' ) ) : ?>
    <li><a class="button" href="<?php bp_group_permalink(); ?>admin/edit-details/"><i class="fi fi-wrench"></i></a></li>
    <?php endif; ?>
    

    Hope this can help somebody else in the future.

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

You must be logged in to reply to this topic.