Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
05/30/2023 05:56:44 AM (3 years ago)
Author:
imath
Message:

Deprecate all functions having a @todo Deprecate inline comment

Fixes #8909

File:
1 edited

Legend:

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

    r13443 r13493  
    6464                return apply_filters( 'bp_get_friends_root_slug', buddypress()->friends->root_slug );
    6565        }
    66 
    67 /**
    68  * Output a block of random friends.
    69  *
    70  * No longer used in BuddyPress.
    71  *
    72  * @todo Deprecate
    73  */
    74 function bp_friends_random_friends() {
    75 
    76         if ( !$friend_ids = wp_cache_get( 'friends_friend_ids_' . bp_displayed_user_id(), 'bp' ) ) {
    77                 $friend_ids = BP_Friends_Friendship::get_random_friends( bp_displayed_user_id() );
    78                 wp_cache_set( 'friends_friend_ids_' . bp_displayed_user_id(), $friend_ids, 'bp' );
    79         } ?>
    80 
    81         <div class="info-group">
    82                 <h4>
    83                         <?php
    84                         /* translators: %s: member name */
    85                         bp_word_or_name( __( "My Friends", 'buddypress' ), __( "%s's Friends", 'buddypress' ) );
    86                         ?>
    87                         &nbsp;
    88                         (<?php echo BP_Friends_Friendship::total_friend_count( bp_displayed_user_id() ); ?>)
    89                         &nbsp;
    90                         <span>
    91                                 <a href="<?php bp_displayed_user_link( array( bp_get_friends_slug() ) ); ?>">
    92                                         <?php esc_html_e( 'See All', 'buddypress' ) ?>
    93                                 </a>
    94                         </span>
    95                 </h4>
    96 
    97                 <?php if ( $friend_ids ) { ?>
    98 
    99                         <ul class="horiz-gallery">
    100 
    101                         <?php for ( $i = 0, $count = count( $friend_ids ); $i < $count; ++$i ) { ?>
    102 
    103                                 <li>
    104                                         <a href="<?php echo bp_members_get_user_url( $friend_ids[$i] ) ?>"><?php echo bp_core_fetch_avatar( array( 'item_id' => $friend_ids[$i], 'type' => 'thumb' ) ) ?></a>
    105                                         <h5><?php echo bp_core_get_userlink($friend_ids[$i]) ?></h5>
    106                                 </li>
    107 
    108                         <?php } ?>
    109 
    110                         </ul>
    111 
    112                 <?php } else { ?>
    113 
    114                         <div id="message" class="info">
    115                                 <p>
    116                                         <?php
    117                                         /* translators: %s: member name */
    118                                         bp_word_or_name( __( "You haven't added any friend connections yet.", 'buddypress' ), __( "%s hasn't created any friend connections yet.", 'buddypress' ) );
    119                                         ?>
    120                                 </p>
    121                         </div>
    122 
    123                 <?php } ?>
    124 
    125                 <div class="clear"></div>
    126         </div>
    127 
    128 <?php
    129 }
    130 
    131 /**
    132  * Pull up a group of random members, and display some profile data about them.
    133  *
    134  * This function is no longer used by BuddyPress core.
    135  *
    136  * @todo Deprecate
    137  *
    138  * @param int $total_members The number of members to retrieve.
    139  */
    140 function bp_friends_random_members( $total_members = 5 ) {
    141 
    142         if ( !$user_ids = wp_cache_get( 'friends_random_users', 'bp' ) ) {
    143                 $user_ids = BP_Core_User::get_users( 'random', $total_members );
    144                 wp_cache_set( 'friends_random_users', $user_ids, 'bp' );
    145         }
    146 
    147         ?>
    148 
    149         <?php if ( $user_ids['users'] ) { ?>
    150 
    151                 <ul class="item-list" id="random-members-list">
    152 
    153                 <?php for ( $i = 0, $count = count( $user_ids['users'] ); $i < $count; ++$i ) { ?>
    154 
    155                         <li>
    156                                 <a href="<?php echo bp_members_get_user_url( $user_ids['users'][$i]->id ) ?>"><?php echo bp_core_fetch_avatar( array( 'item_id' => $user_ids['users'][$i]->id, 'type' => 'thumb' ) ) ?></a>
    157                                 <h5><?php echo bp_core_get_userlink( $user_ids['users'][$i]->id ) ?></h5>
    158 
    159                                 <?php if ( bp_is_active( 'xprofile' ) ) { ?>
    160 
    161                                         <?php $random_data = xprofile_get_random_profile_data( $user_ids['users'][$i]->id, true ); ?>
    162 
    163                                         <div class="profile-data">
    164                                                 <p class="field-name"><?php echo $random_data[0]->name ?></p>
    165 
    166                                                 <?php echo $random_data[0]->value ?>
    167 
    168                                         </div>
    169 
    170                                 <?php } ?>
    171 
    172                                 <div class="action">
    173 
    174                                         <?php if ( bp_is_active( 'friends' ) ) { ?>
    175 
    176                                                 <?php bp_add_friend_button( $user_ids['users'][$i]->id ) ?>
    177 
    178                                         <?php } ?>
    179 
    180                                 </div>
    181                         </li>
    182 
    183                 <?php } ?>
    184 
    185                 </ul>
    186 
    187         <?php } else { ?>
    188 
    189                 <div id="message" class="info">
    190                         <p><?php _e( "There aren't enough site members to show a random sample just yet.", 'buddypress' ) ?></p>
    191                 </div>
    192 
    193         <?php } ?>
    194 <?php
    195 }
    196 
    197 /**
    198  * Display a Friends search form.
    199  *
    200  * No longer used in BuddyPress.
    201  *
    202  * @todo Deprecate
    203  */
    204 function bp_friend_search_form() {
    205         $label        = __( 'Filter Friends', 'buddypress' );
    206         $friends_slug = bp_get_friends_slug();
    207         $action       = bp_displayed_user_url(
    208                 array(
    209                         'single_item_component'        => bp_rewrites_get_slug( 'members', 'member_' . $friends_slug, $friends_slug ),
    210                         'single_item_action'           => bp_rewrites_get_slug( 'members', 'member_' . $friends_slug . '_my_friends', 'my-friends' ),
    211                         'single_item_action_variables' => array( bp_rewrites_get_slug( 'members', 'member_' . $friends_slug . '_search', 'search' ) ),
    212                 )
    213         );
    214         ?>
    215 
    216                 <form action="<?php echo esc_url( $action ) ?>" id="friend-search-form" method="post">
    217 
    218                         <label for="friend-search-box" id="friend-search-label"><?php echo esc_html( $label ); ?></label>
    219                         <input type="search" name="friend-search-box" id="friend-search-box" value="" />
    220 
    221                         <?php wp_nonce_field( 'friends_search', '_wpnonce_friend_search' ) ?>
    222 
    223                         <input type="hidden" name="initiator" id="initiator" value="<?php echo esc_attr( bp_displayed_user_id() ) ?>" />
    224 
    225                 </form>
    226 
    227         <?php
    228 }
    22966
    23067/**
Note: See TracChangeset for help on using the changeset viewer.