Skip to:
Content

BuddyPress.org

Changeset 7926


Ignore:
Timestamp:
02/18/2014 07:37:41 PM (10 years ago)
Author:
imath
Message:

Adds bp_is_{component}_directory new helper functions

To check if the current page is the activity, members, groups or blogs directory page, you can now use these new helper functions.

Props r-a-y, DJPaul

Fixes #5408

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-activity/bp-activity-screens.php

    r7736 r7926  
    2929 */
    3030function bp_activity_screen_index() {
    31     if ( !bp_displayed_user_id() && bp_is_activity_component() && !bp_current_action() ) {
     31    if ( bp_is_activity_directory() ) {
    3232        bp_update_is_directory( true, 'activity' );
    3333
  • trunk/bp-blogs/bp-blogs-screens.php

    r7736 r7926  
    4444 */
    4545function bp_blogs_screen_index() {
    46     if ( is_multisite() && bp_is_blogs_component() && !bp_current_action() ) {
     46    if ( bp_is_blogs_directory() ) {
    4747        bp_update_is_directory( true, 'blogs' );
    4848
  • trunk/bp-core/bp-core-template.php

    r7663 r7926  
    14921492
    14931493/**
     1494 * Is the current page the activity directory ?
     1495 *
     1496 * @since BuddyPress (2.0.0)
     1497 *
     1498 * @return True if the current page is the activity directory.
     1499 */
     1500function bp_is_activity_directory() {
     1501    if ( ! bp_displayed_user_id() && bp_is_activity_component() && ! bp_current_action() )
     1502        return true;
     1503
     1504    return false;
     1505}
     1506
     1507/**
    14941508 * Is the current page a single activity item permalink?
    14951509 *
     
    15041518
    15051519/** User **********************************************************************/
     1520
     1521/**
     1522 * Is the current page the members directory ?
     1523 *
     1524 * @since BuddyPress (2.0.0)
     1525 *
     1526 * @return True if the current page is the members directory.
     1527 */
     1528function bp_is_members_directory() {
     1529    if ( ! bp_is_user() && bp_is_members_component() )
     1530        return true;
     1531
     1532    return false;
     1533}
    15061534
    15071535/**
     
    18471875
    18481876/**
     1877 * Is the current page the groups directory ?
     1878 *
     1879 * @since BuddyPress (2.0.0)
     1880 *
     1881 * @return True if the current page is the groups directory.
     1882 */
     1883function bp_is_groups_directory() {
     1884    if ( bp_is_groups_component() && ! bp_current_action() && ! bp_current_item() )
     1885        return true;
     1886
     1887    return false;
     1888}
     1889
     1890/**
    18491891 * Does the current page belong to a single group?
    18501892 *
     
    20472089function bp_is_create_blog() {
    20482090    if ( bp_is_blogs_component() && bp_is_current_action( 'create' ) )
     2091        return true;
     2092
     2093    return false;
     2094}
     2095
     2096/**
     2097 * Is the current page the blogs directory ?
     2098 *
     2099 * @since BuddyPress (2.0.0)
     2100 *
     2101 * @return True if the current page is the blogs directory.
     2102 */
     2103function bp_is_blogs_directory() {
     2104    if ( is_multisite() && bp_is_blogs_component() && ! bp_current_action() )
    20492105        return true;
    20502106
  • trunk/bp-groups/bp-groups-screens.php

    r7736 r7926  
    1616
    1717function groups_directory_groups_setup() {
    18     if ( bp_is_groups_component() && !bp_current_action() && !bp_current_item() ) {
     18    if ( bp_is_groups_directory() ) {
    1919        bp_update_is_directory( true, 'groups' );
    2020
  • trunk/bp-members/bp-members-screens.php

    r7825 r7926  
    3636 */
    3737function bp_members_screen_index() {
    38     if ( !bp_is_user() && bp_is_members_component() ) {
     38    if ( bp_is_members_directory() ) {
    3939        bp_update_is_directory( true, 'members' );
    4040
Note: See TracChangeset for help on using the changeset viewer.