Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
01/22/2011 04:10:42 PM (16 years ago)
Author:
johnjamesjacoby
Message:

Clean up phpDoc in Groups slug functions. Add Friends and Forums slug functions.

File:
1 edited

Legend:

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

    r3778 r3841  
    11<?php
    22
     3/**
     4 * Output the friends component slug
     5 *
     6 * @package BuddyPress
     7 * @subpackage Friends Template
     8 * @since BuddyPress {unknown}
     9 *
     10 * @uses bp_get_friends_slug()
     11 */
     12function bp_friends_slug() {
     13        echo bp_get_friends_slug();
     14}
     15        /**
     16         * Return the friends component slug
     17         *
     18         * @package BuddyPress
     19         * @subpackage Friends Template
     20         * @since BuddyPress {unknown}
     21         */
     22        function bp_get_friends_slug() {
     23                global $bp;
     24                return apply_filters( 'bp_get_friends_slug', $bp->friends->slug );
     25        }
     26
     27/**
     28 * Output the friends component root slug
     29 *
     30 * @package BuddyPress
     31 * @subpackage Friends Template
     32 * @since BuddyPress {unknown}
     33 *
     34 * @uses bp_get_friends_root_slug()
     35 */
     36function bp_friends_root_slug() {
     37        echo bp_get_friends_root_slug();
     38}
     39        /**
     40         * Return the friends component root slug
     41         *
     42         * @package BuddyPress
     43         * @subpackage Friends Template
     44         * @since BuddyPress {unknown}
     45         */
     46        function bp_get_friends_root_slug() {
     47                global $bp;
     48                return apply_filters( 'bp_get_friends_root_slug', $bp->friends->root_slug );
     49        }
     50
    351function bp_friends_header_tabs() {
    4         global $bp;
    5 ?>
     52        global $bp; ?>
     53
    654        <li<?php if ( !isset($bp->action_variables[0]) || 'recently-active' == $bp->action_variables[0] ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . $bp->friends->slug ?>/my-friends/recently-active"><?php _e( 'Recently Active', 'buddypress' ) ?></a></li>
    755        <li<?php if ( 'newest' == $bp->action_variables[0] ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . $bp->friends->slug ?>/my-friends/newest"><?php _e( 'Newest', 'buddypress' ) ?></a></li>
    856        <li<?php if ( 'alphabetically' == $bp->action_variables[0] ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . $bp->friends->slug ?>/my-friends/alphabetically""><?php _e( 'Alphabetically', 'buddypress' ) ?></a></li>
     57
    958<?php
    1059        do_action( 'friends_header_tabs' );
     
    2574                case 'alphabetically':
    2675                        _e( 'Alphabetically', 'buddypress' );
    27                 break;
     76                        break;
    2877        }
    2978}
     
    3584                $friend_ids = BP_Friends_Friendship::get_random_friends( $bp->displayed_user->id );
    3685                wp_cache_set( 'friends_friend_ids_' . $bp->displayed_user->id, $friend_ids, 'bp' );
    37         }
    38 ?>
     86        } ?>
     87
    3988        <div class="info-group">
    4089                <h4><?php bp_word_or_name( __( "My Friends", 'buddypress' ), __( "%s's Friends", 'buddypress' ) ) ?>  (<?php echo BP_Friends_Friendship::total_friend_count( $bp->displayed_user->id ) ?>) <span><a href="<?php echo $bp->displayed_user->domain . $bp->friends->slug ?>"><?php _e('See All', 'buddypress') ?> &rarr;</a></span></h4>
    4190
    4291                <?php if ( $friend_ids ) { ?>
     92
    4393                        <ul class="horiz-gallery">
     94
    4495                        <?php for ( $i = 0; $i < count( $friend_ids ); $i++ ) { ?>
     96
    4597                                <li>
    4698                                        <a href="<?php echo bp_core_get_user_domain( $friend_ids[$i] ) ?>"><?php echo bp_core_fetch_avatar( array( 'item_id' => $friend_ids[$i], 'type' => 'thumb' ) ) ?></a>
    4799                                        <h5><?php echo bp_core_get_userlink($friend_ids[$i]) ?></h5>
    48100                                </li>
     101
    49102                        <?php } ?>
     103
    50104                        </ul>
     105
    51106                <?php } else { ?>
     107
    52108                        <div id="message" class="info">
    53109                                <p><?php bp_word_or_name( __( "You haven't added any friend connections yet.", 'buddypress' ), __( "%s hasn't created any friend connections yet.", 'buddypress' ) ) ?></p>
    54110                        </div>
     111
    55112                <?php } ?>
    56113                <div class="clear"></div>
     
    65122                $user_ids = BP_Core_User::get_users( 'random', $total_members );
    66123                wp_cache_set( 'friends_random_users', $user_ids, 'bp' );
    67         }
    68 ?>
     124        } ?>
     125
    69126        <?php if ( $user_ids['users'] ) { ?>
     127
    70128                <ul class="item-list" id="random-members-list">
     129
    71130                <?php for ( $i = 0; $i < count( $user_ids['users'] ); $i++ ) { ?>
     131
    72132                        <li>
    73133                                <a href="<?php echo bp_core_get_user_domain( $user_ids['users'][$i]->user_id ) ?>"><?php echo bp_core_fetch_avatar( array( 'item_id' => $user_ids['users'][$i]->user_id, 'type' => 'thumb' ) ) ?></a>
    74134                                <h5><?php echo bp_core_get_userlink( $user_ids['users'][$i]->user_id ) ?></h5>
     135
    75136                                <?php if ( function_exists( 'xprofile_get_random_profile_data' ) ) { ?>
     137
    76138                                        <?php $random_data = xprofile_get_random_profile_data( $user_ids['users'][$i]->user_id, true ); ?>
     139
    77140                                        <div class="profile-data">
    78141                                                <p class="field-name"><?php echo $random_data[0]->name ?></p>
     142
    79143                                                <?php echo $random_data[0]->value ?>
     144
    80145                                        </div>
     146
    81147                                <?php } ?>
    82148
    83149                                <div class="action">
     150
    84151                                        <?php if ( function_exists( 'bp_add_friend_button' ) ) { ?>
     152
    85153                                                <?php bp_add_friend_button( $user_ids['users'][$i]->user_id ) ?>
     154
    86155                                        <?php } ?>
     156
    87157                                </div>
    88158                        </li>
     159
    89160                <?php } ?>
     161
    90162                </ul>
     163
    91164        <?php } else { ?>
     165
    92166                <div id="message" class="info">
    93167                        <p><?php _e( "There aren't enough site members to show a random sample just yet.", 'buddypress' ) ?></p>
    94168                </div>
     169
    95170        <?php } ?>
    96171<?php
     
    101176
    102177        $action = $bp->displayed_user->domain . $bp->friends->slug . '/my-friends/search/';
    103         $label = __( 'Filter Friends', 'buddypress' );
    104         ?>
     178        $label = __( 'Filter Friends', 'buddypress' ); ?>
     179
    105180                <form action="<?php echo $action ?>" id="friend-search-form" method="post">
    106181
     
    109184
    110185                        <?php wp_nonce_field( 'friends_search', '_wpnonce_friend_search' ) ?>
     186
    111187                        <input type="hidden" name="initiator" id="initiator" value="<?php echo esc_attr( $bp->displayed_user->id ) ?>" />
    112188
    113189                </form>
     190
    114191        <?php
    115192}
     
    346423                return apply_filters( 'bp_friend_get_total_requests_count', count( BP_Friends_Friendship::get_friend_user_ids( $user_id, true ) ) );
    347424        }
     425
    348426?>
Note: See TracChangeset for help on using the changeset viewer.