Skip to:
Content

BuddyPress.org

Changeset 6783


Ignore:
Timestamp:
02/11/2013 02:01:12 AM (12 years ago)
Author:
johnjamesjacoby
Message:

Theme Compatibility:

  • Intro duce bp_is_current_component_core() function, to determine if the current component is an active core component.
  • Use above function in plugins.php, to help determine whether or not to display the options navigation.
  • Update the root level single-member templates to use switch statements, per the settings components convention.
  • Fixes #4772.
Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-template.php

    r6697 r6783  
    11421142}
    11431143
     1144/**
     1145 * Is the current component an active core component.
     1146 *
     1147 * Use this function when you need to check if the current component is an
     1148 * active core component of BuddyPress. If the current component is inactive, it
     1149 * will return false. If the current component is not part of BuddyPress core,
     1150 * it will return false. If the current component is active, and is part of
     1151 * BuddyPress core, it will return true.
     1152 *
     1153 * @since BuddyPress (1.7)
     1154 * @return boolean
     1155 */
     1156function bp_is_current_component_core() {
     1157    $retval            = false;
     1158    $active_components = apply_filters( 'bp_active_components', bp_get_option( 'bp-active-components' ) );
     1159
     1160    foreach ( array_keys( $active_components ) as $active_component ) {
     1161        if ( bp_is_current_component( $active_component ) ) {
     1162            $retval = true;
     1163            break;
     1164        }
     1165    }
     1166
     1167    return $retval;
     1168}
     1169
    11441170/** Activity ******************************************************************/
    11451171
  • trunk/bp-templates/bp-legacy/buddypress/members/single/blogs.php

    r6284 r6783  
    3030</div><!-- .item-list-tabs -->
    3131
    32 <?php do_action( 'bp_before_member_blogs_content' ); ?>
     32<?php
     33switch ( bp_current_action() ) :
    3334
    34 <div class="blogs myblogs" role="main">
     35    // Home/My Blogs
     36    case 'my-groups' :
     37        do_action( 'bp_before_member_blogs_content' ); ?>
    3538
    36     <?php bp_get_template_part( 'blogs/blogs-loop' ) ?>
     39        <div class="blogs myblogs" role="main">
    3740
    38 </div><!-- .blogs.myblogs -->
     41            <?php bp_get_template_part( 'blogs/blogs-loop' ) ?>
    3942
    40 <?php do_action( 'bp_after_member_blogs_content' ); ?>
     43        </div><!-- .blogs.myblogs -->
     44
     45        <?php do_action( 'bp_after_member_blogs_content' );
     46        break;
     47
     48    // Any other
     49    default :
     50        bp_get_template_part( 'members/single/plugins' );
     51        break;
     52endswitch;
  • trunk/bp-templates/bp-legacy/buddypress/members/single/friends.php

    r6284 r6783  
    3535
    3636<?php
     37switch ( bp_current_action() ) :
    3738
    38 if ( bp_is_current_action( 'requests' ) ) :
    39      bp_get_template_part( 'members/single/friends/requests' );
     39    // Home/My Friends
     40    case 'my-friends' :
     41        do_action( 'bp_before_member_friends_content' ); ?>
    4042
    41 else :
    42     do_action( 'bp_before_member_friends_content' ); ?>
     43        <div class="members friends">
    4344
    44     <div class="members friends">
     45            <?php bp_get_template_part( 'members/members-loop' ) ?>
    4546
    46         <?php bp_get_template_part( 'members/members-loop' ) ?>
     47        </div><!-- .members.friends -->
    4748
    48     </div><!-- .members.friends -->
     49        <?php do_action( 'bp_after_member_friends_content' );
     50        break;
    4951
    50     <?php do_action( 'bp_after_member_friends_content' ); ?>
     52    case 'requests' :
     53        bp_get_template_part( 'members/single/friends/requests' );
     54        break;
    5155
    52 <?php endif; ?>
     56    // Any other
     57    default :
     58        bp_get_template_part( 'members/single/plugins' );
     59        break;
     60endswitch;
  • trunk/bp-templates/bp-legacy/buddypress/members/single/groups.php

    r6284 r6783  
    3737<?php
    3838
    39 if ( bp_is_current_action( 'invites' ) ) :
    40     bp_get_template_part( 'members/single/groups/invites' );
     39switch ( bp_current_action() ) :
    4140
    42 else :
    43     do_action( 'bp_before_member_groups_content' ); ?>
     41    // Home/My Groups
     42    case 'my-groups' :
     43        do_action( 'bp_before_member_groups_content' ); ?>
    4444
    45     <div class="groups mygroups">
     45        <div class="groups mygroups">
    4646
    47         <?php bp_get_template_part( 'groups/groups-loop' ); ?>
     47            <?php bp_get_template_part( 'groups/groups-loop' ); ?>
    4848
    49     </div>
     49        </div>
    5050
    51     <?php do_action( 'bp_after_member_groups_content' ); ?>
     51        <?php do_action( 'bp_after_member_groups_content' );
     52        break;
    5253
    53 <?php endif; ?>
     54    // Group Invitations
     55    case 'invites' :
     56        bp_get_template_part( 'members/single/groups/invites' );
     57        break;
     58
     59    // Any other
     60    default :
     61        bp_get_template_part( 'members/single/plugins' );
     62        break;
     63endswitch;
  • trunk/bp-templates/bp-legacy/buddypress/members/single/messages.php

    r6284 r6783  
    2626
    2727<?php
     28switch ( bp_current_action() ) :
    2829
    29     if ( bp_is_current_action( 'compose' ) ) :
    30         bp_get_template_part( 'members/single/messages/compose' );
    31 
    32     elseif ( bp_is_current_action( 'view' ) ) :
    33         bp_get_template_part( 'members/single/messages/single' );
    34 
    35     else :
     30    // Inbox/Sentbox
     31    case 'inbox'   :
     32    case 'sentbox' :
    3633        do_action( 'bp_before_member_messages_content' ); ?>
    3734
    38     <div class="messages" role="main">
     35        <div class="messages" role="main">
     36            <?php bp_get_template_part( 'members/single/messages/messages-loop' ); ?>
     37        </div><!-- .messages -->
    3938
    40         <?php
    41             if ( bp_is_current_action( 'notices' ) )
    42                 bp_get_template_part( 'members/single/messages/notices-loop' );
    43             else
    44                 bp_get_template_part( 'members/single/messages/messages-loop' );
    45         ?>
     39        <?php do_action( 'bp_after_member_messages_content' );
     40        break;
    4641
    47     </div><!-- .messages -->
     42    // Single Message View
     43    case 'view' :
     44        bp_get_template_part( 'members/single/messages/single' );
     45        break;
    4846
    49     <?php do_action( 'bp_after_member_messages_content' ); ?>
     47    // Compose
     48    case 'compose' :
     49        bp_get_template_part( 'members/single/messages/compose' );
     50        break;
    5051
    51 <?php endif; ?>
     52    // Sitewide Notices
     53    case 'notices' :
     54        do_action( 'bp_before_member_messages_content' ); ?>
     55
     56        <div class="messages" role="main">
     57            <?php bp_get_template_part( 'members/single/messages/notices-loop' );; ?>
     58        </div><!-- .messages -->
     59
     60        <?php do_action( 'bp_after_member_messages_content' );
     61        break;
     62
     63    // Any other
     64    default :
     65        bp_get_template_part( 'members/single/plugins' );
     66        break;
     67endswitch;
  • trunk/bp-templates/bp-legacy/buddypress/members/single/plugins.php

    r6346 r6783  
    1313        <?php do_action( 'bp_before_member_plugin_template' ); ?>
    1414
     15        <?php if ( ! bp_is_current_component_core() ) : ?>
     16
    1517        <div class="item-list-tabs no-ajax" id="subnav">
    1618            <ul>
     
    2123        </div><!-- .item-list-tabs -->
    2224
     25        <?php endif; ?>
     26
    2327        <h3><?php do_action( 'bp_template_title' ); ?></h3>
    2428
  • trunk/bp-templates/bp-legacy/buddypress/members/single/profile.php

    r6284 r6783  
    2626<div class="profile" role="main">
    2727
    28     <?php
    29         // Profile Edit
    30         if ( bp_is_current_action( 'edit' ) )
    31             bp_get_template_part( 'members/single/profile/edit' );
     28<?php switch ( bp_current_action() ) :
    3229
    33         // Change Avatar
    34         elseif ( bp_is_current_action( 'change-avatar' ) )
    35             bp_get_template_part( 'members/single/profile/change-avatar' );
     30    // Edit
     31    case 'edit'   :
     32        bp_get_template_part( 'members/single/profile/edit' );
     33        break;
     34
     35    // Change Avatar
     36    case 'change-avatar' :
     37        bp_get_template_part( 'members/single/profile/change-avatar' );
     38        break;
     39
     40    // Compose
     41    case 'public' :
    3642
    3743        // Display XProfile
    38         elseif ( bp_is_active( 'xprofile' ) )
     44        if ( bp_is_active( 'xprofile' ) )
    3945            bp_get_template_part( 'members/single/profile/profile-loop' );
    4046
    4147        // Display WordPress profile (fallback)
    4248        else
    43             bp_get_template_part( 'members/single/profile/profile-wp' )
    44     ?>
     49            bp_get_template_part( 'members/single/profile/profile-wp' );
    4550
     51        break;
     52
     53    // Any other
     54    default :
     55        bp_get_template_part( 'members/single/plugins' );
     56        break;
     57endswitch; ?>
    4658</div><!-- .profile -->
    4759
Note: See TracChangeset for help on using the changeset viewer.