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-core/deprecated/12.0.php

    r13490 r13493  
    959959 */
    960960function bp_group_mod_memberlist( $admin_list = false, $group = false ) {
     961    _deprecated_function( __FUNCTION__, '12.0.0' );
    961962    global $groups_template;
    962963
     
    10521053    <?php }
    10531054}
     1055
     1056/**
     1057 * Output the activities title.
     1058 *
     1059 * @since 1.0.0
     1060 * @deprecated 12.0.0
     1061 */
     1062function bp_activities_title() {
     1063    _deprecated_function( __FUNCTION__, '12.0.0' );
     1064    echo bp_get_activities_title();
     1065}
     1066
     1067/**
     1068 * Return the activities title.
     1069 *
     1070 * @since 1.0.0
     1071 * @deprecated 12.0.0
     1072 *
     1073 * @global string $bp_activity_title
     1074 *
     1075 * @return string The activities title.
     1076 */
     1077function bp_get_activities_title() {
     1078    _deprecated_function( __FUNCTION__, '12.0.0' );
     1079    global $bp_activity_title;
     1080
     1081    /**
     1082     * Filters the activities title for the activity template.
     1083     *
     1084     * @since 1.0.0
     1085     * @deprecated 12.0.0
     1086     *
     1087     * @param string $bp_activity_title The title to be displayed.
     1088     */
     1089    return apply_filters_deprecated( 'bp_get_activities_title', array( $bp_activity_title ), '12.0.0' );
     1090}
     1091
     1092/**
     1093 * {@internal Missing Description}
     1094 *
     1095 * @since 1.0.0
     1096 * @deprecated 12.0.0
     1097 */
     1098function bp_activities_no_activity() {
     1099    _deprecated_function( __FUNCTION__, '12.0.0' );
     1100    echo bp_get_activities_no_activity();
     1101}
     1102
     1103/**
     1104 * {@internal Missing Description}
     1105 *
     1106 * @since 1.0.0
     1107 * @deprecated 12.0.0
     1108 *
     1109 * @global string $bp_activity_no_activity
     1110 *
     1111 * @return string
     1112 */
     1113function bp_get_activities_no_activity() {
     1114    _deprecated_function( __FUNCTION__, '12.0.0' );
     1115    global $bp_activity_no_activity;
     1116
     1117    /**
     1118     * Filters the text used when there is no activity to display.
     1119     *
     1120     * @since 1.0.0
     1121     * @deprecated 12.0.0
     1122     *
     1123     * @param string $bp_activity_no_activity Text to display for no activity.
     1124     */
     1125    return apply_filters_deprecated( 'bp_get_activities_no_activity', array( $bp_activity_no_activity ), '12.0.0' );
     1126}
     1127
     1128/**
     1129 * Get the 'bp_options_title' property from the BP global.
     1130 *
     1131 * Not currently used in BuddyPress.
     1132 *
     1133 * @deprecated 12.0.0
     1134 */
     1135function bp_get_options_title() {
     1136    _deprecated_function( __FUNCTION__, '12.0.0' );
     1137    $bp = buddypress();
     1138
     1139    if ( empty( $bp->bp_options_title ) ) {
     1140        $bp->bp_options_title = __( 'Options', 'buddypress' );
     1141    }
     1142
     1143    echo apply_filters_deprecated( 'bp_get_options_title', array( esc_attr( $bp->bp_options_title ) ), '12.0.0' );
     1144}
     1145
     1146/**
     1147 * Check to see if there is an options avatar.
     1148 *
     1149 * An options avatar is an avatar for something like a group, or a friend.
     1150 * Basically an avatar that appears in the sub nav options bar.
     1151 *
     1152 * @deprecated 12.0.0
     1153 *
     1154 * @return bool $value Returns true if an options avatar has been set, otherwise false.
     1155 */
     1156function bp_has_options_avatar() {
     1157    _deprecated_function( __FUNCTION__, '12.0.0' );
     1158    return (bool) buddypress()->bp_options_avatar;
     1159}
     1160
     1161/**
     1162 * Output the options avatar.
     1163 *
     1164 * @deprecated 12.0.0
     1165 */
     1166function bp_get_options_avatar() {
     1167    _deprecated_function( __FUNCTION__, '12.0.0' );
     1168    echo apply_filters_deprecated( 'bp_get_options_avatar', array( buddypress()->bp_options_avatar ), '12.0.0' );
     1169}
     1170
     1171/**
     1172 * Output a comment author's avatar.
     1173 *
     1174 * @deprecated 12.0.0
     1175 */
     1176function bp_comment_author_avatar() {
     1177    _deprecated_function( __FUNCTION__, '12.0.0' );
     1178    global $comment;
     1179
     1180    echo apply_filters_deprecated(
     1181        'bp_comment_author_avatar',
     1182        array(
     1183            bp_core_fetch_avatar(
     1184                array(
     1185                    'item_id' => $comment->user_id,
     1186                    'type'    => 'thumb',
     1187                    'alt'     => sprintf(
     1188                        /* translators: %s: member name */
     1189                        __( 'Profile photo of %s', 'buddypress' ),
     1190                        bp_core_get_user_displayname( $comment->user_id )
     1191                    ),
     1192                )
     1193            )
     1194        ),
     1195        '12.0.0'
     1196    );
     1197}
     1198
     1199/**
     1200 * Output a post author's avatar.
     1201 *
     1202 * @deprecated 12.0.0
     1203 */
     1204function bp_post_author_avatar() {
     1205    _deprecated_function( __FUNCTION__, '12.0.0' );
     1206    global $post;
     1207
     1208    echo apply_filters_deprecated(
     1209        'bp_post_author_avatar',
     1210        array(
     1211            bp_core_fetch_avatar(
     1212                array(
     1213                    'item_id' => $post->post_author,
     1214                    'type'    => 'thumb',
     1215                    'alt'     => sprintf(
     1216                        /* translators: %s: member name */
     1217                        __( 'Profile photo of %s', 'buddypress' ),
     1218                        bp_core_get_user_displayname( $post->post_author )
     1219                    ),
     1220                )
     1221            )
     1222        ),
     1223        '12.0.0'
     1224    );
     1225}
     1226
     1227/**
     1228 * Output the avatar cropper <img> markup.
     1229 *
     1230 * @deprecated 12.0.0
     1231 */
     1232function bp_avatar_cropper() {
     1233    _deprecated_function( __FUNCTION__, '12.0.0' );
     1234?>
     1235    <img id="avatar-to-crop" class="avatar" src="<?php echo esc_url( buddypress()->avatar_admin->image ); ?>" />
     1236<?php
     1237}
     1238
     1239/**
     1240 * Do the 'bp_styles' action, and call wp_print_styles().
     1241 *
     1242 * @deprecated 12.0.0
     1243 */
     1244function bp_styles() {
     1245    _deprecated_function( __FUNCTION__, '12.0.0' );
     1246
     1247    do_action_deprecated( 'bp_styles', array(), '12.0.0' );
     1248    wp_print_styles();
     1249}
     1250
     1251/**
     1252 * Fire the 'bp_custom_profile_boxes' action.
     1253 *
     1254 * No longer used in BuddyPress.
     1255 *
     1256 * @deprecated 12.0.0
     1257 */
     1258function bp_custom_profile_boxes() {
     1259    _deprecated_function( __FUNCTION__, '12.0.0' );
     1260    do_action( 'bp_custom_profile_boxes' );
     1261}
     1262
     1263/**
     1264 * Fire the 'bp_custom_profile_sidebar_boxes' action.
     1265 *
     1266 * No longer used in BuddyPress.
     1267 *
     1268 * @deprecated 12.0.0
     1269 */
     1270function bp_custom_profile_sidebar_boxes() {
     1271    _deprecated_function( __FUNCTION__, '12.0.0' );
     1272    do_action_deprecated( 'bp_custom_profile_sidebar_boxes', arrray(), '12.0.0' );
     1273}
     1274
     1275/**
     1276 * Output whether blog signup is allowed.
     1277 *
     1278 * @deprecated 12.0.0
     1279 */
     1280function bp_blog_signup_allowed() {
     1281    _deprecated_function( __FUNCTION__, '12.0.0' );
     1282    echo bp_get_blog_signup_allowed();
     1283}
     1284
     1285/**
     1286 * Output a block of random friends.
     1287 *
     1288 * No longer used in BuddyPress.
     1289 *
     1290 * @deprecated 12.0.0
     1291 */
     1292function bp_friends_random_friends() {
     1293    _deprecated_function( __FUNCTION__, '12.0.0' );
     1294
     1295    if ( !$friend_ids = wp_cache_get( 'friends_friend_ids_' . bp_displayed_user_id(), 'bp' ) ) {
     1296        $friend_ids = BP_Friends_Friendship::get_random_friends( bp_displayed_user_id() );
     1297        wp_cache_set( 'friends_friend_ids_' . bp_displayed_user_id(), $friend_ids, 'bp' );
     1298    } ?>
     1299
     1300    <div class="info-group">
     1301        <h4>
     1302            <?php
     1303            /* translators: %s: member name */
     1304            bp_word_or_name( __( "My Friends", 'buddypress' ), __( "%s's Friends", 'buddypress' ) );
     1305            ?>
     1306            &nbsp;
     1307            (<?php echo BP_Friends_Friendship::total_friend_count( bp_displayed_user_id() ); ?>)
     1308            &nbsp;
     1309            <span>
     1310                <a href="<?php bp_displayed_user_link( array( bp_get_friends_slug() ) ); ?>">
     1311                    <?php esc_html_e( 'See All', 'buddypress' ) ?>
     1312                </a>
     1313            </span>
     1314        </h4>
     1315
     1316        <?php if ( $friend_ids ) { ?>
     1317
     1318            <ul class="horiz-gallery">
     1319
     1320            <?php for ( $i = 0, $count = count( $friend_ids ); $i < $count; ++$i ) { ?>
     1321
     1322                <li>
     1323                    <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>
     1324                    <h5><?php echo bp_core_get_userlink($friend_ids[$i]) ?></h5>
     1325                </li>
     1326
     1327            <?php } ?>
     1328
     1329            </ul>
     1330
     1331        <?php } else { ?>
     1332
     1333            <div id="message" class="info">
     1334                <p>
     1335                    <?php
     1336                    /* translators: %s: member name */
     1337                    bp_word_or_name( __( "You haven't added any friend connections yet.", 'buddypress' ), __( "%s hasn't created any friend connections yet.", 'buddypress' ) );
     1338                    ?>
     1339                </p>
     1340            </div>
     1341
     1342        <?php } ?>
     1343
     1344        <div class="clear"></div>
     1345    </div>
     1346
     1347<?php
     1348}
     1349
     1350/**
     1351 * Pull up a group of random members, and display some profile data about them.
     1352 *
     1353 * This function is no longer used by BuddyPress core.
     1354 *
     1355 * @deprecated 12.0.0
     1356 *
     1357 * @param int $total_members The number of members to retrieve.
     1358 */
     1359function bp_friends_random_members( $total_members = 5 ) {
     1360    _deprecated_function( __FUNCTION__, '12.0.0' );
     1361
     1362    if ( !$user_ids = wp_cache_get( 'friends_random_users', 'bp' ) ) {
     1363        $user_ids = BP_Core_User::get_users( 'random', $total_members );
     1364        wp_cache_set( 'friends_random_users', $user_ids, 'bp' );
     1365    }
     1366
     1367    ?>
     1368
     1369    <?php if ( $user_ids['users'] ) { ?>
     1370
     1371        <ul class="item-list" id="random-members-list">
     1372
     1373        <?php for ( $i = 0, $count = count( $user_ids['users'] ); $i < $count; ++$i ) { ?>
     1374
     1375            <li>
     1376                <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>
     1377                <h5><?php echo bp_core_get_userlink( $user_ids['users'][$i]->id ) ?></h5>
     1378
     1379                <?php if ( bp_is_active( 'xprofile' ) ) { ?>
     1380
     1381                    <?php $random_data = xprofile_get_random_profile_data( $user_ids['users'][$i]->id, true ); ?>
     1382
     1383                    <div class="profile-data">
     1384                        <p class="field-name"><?php echo $random_data[0]->name ?></p>
     1385
     1386                        <?php echo $random_data[0]->value ?>
     1387
     1388                    </div>
     1389
     1390                <?php } ?>
     1391
     1392                <div class="action">
     1393
     1394                    <?php if ( bp_is_active( 'friends' ) ) { ?>
     1395
     1396                        <?php bp_add_friend_button( $user_ids['users'][$i]->id ) ?>
     1397
     1398                    <?php } ?>
     1399
     1400                </div>
     1401            </li>
     1402
     1403        <?php } ?>
     1404
     1405        </ul>
     1406
     1407    <?php } else { ?>
     1408
     1409        <div id="message" class="info">
     1410            <p><?php _e( "There aren't enough site members to show a random sample just yet.", 'buddypress' ) ?></p>
     1411        </div>
     1412
     1413    <?php } ?>
     1414<?php
     1415}
     1416
     1417/**
     1418 * Display a Friends search form.
     1419 *
     1420 * No longer used in BuddyPress.
     1421 *
     1422 * @deprecated 12.0.0
     1423 */
     1424function bp_friend_search_form() {
     1425    _deprecated_function( __FUNCTION__, '12.0.0' );
     1426    $label        = __( 'Filter Friends', 'buddypress' );
     1427    $friends_slug = bp_get_friends_slug();
     1428    $action       = bp_displayed_user_url(
     1429        array(
     1430            'single_item_component'        => bp_rewrites_get_slug( 'members', 'member_' . $friends_slug, $friends_slug ),
     1431            'single_item_action'           => bp_rewrites_get_slug( 'members', 'member_' . $friends_slug . '_my_friends', 'my-friends' ),
     1432            'single_item_action_variables' => array( bp_rewrites_get_slug( 'members', 'member_' . $friends_slug . '_search', 'search' ) ),
     1433        )
     1434    );
     1435    ?>
     1436
     1437        <form action="<?php echo esc_url( $action ) ?>" id="friend-search-form" method="post">
     1438
     1439            <label for="friend-search-box" id="friend-search-label"><?php echo esc_html( $label ); ?></label>
     1440            <input type="search" name="friend-search-box" id="friend-search-box" value="" />
     1441
     1442            <?php wp_nonce_field( 'friends_search', '_wpnonce_friend_search' ) ?>
     1443
     1444            <input type="hidden" name="initiator" id="initiator" value="<?php echo esc_attr( bp_displayed_user_id() ) ?>" />
     1445
     1446        </form>
     1447
     1448    <?php
     1449}
     1450
     1451/**
     1452 * Output the permalink of a group's Members page.
     1453 *
     1454 * @since 1.0.0
     1455 * @since 10.0.0 Added the `$group` parameter.
     1456 * @deprecated 12.0.0
     1457 *
     1458 * @param false|int|string|BP_Groups_Group $group (Optional) The Group ID, the Group Slug or the Group object.
     1459 *                                                Default: false.
     1460 */
     1461function bp_group_all_members_permalink( $group = false ) {
     1462    _deprecated_function( __FUNCTION__, '12.0.0' );
     1463    echo esc_url( bp_get_group_all_members_permalink( $group ) );
     1464}
     1465
     1466/**
     1467 * Return the permalink of the Members page of a group.
     1468 *
     1469 * @since 1.0.0
     1470 * @since 10.0.0 Updated to use `bp_get_group`.
     1471 * @deprecated 12.0.0
     1472 *
     1473 * @param false|int|string|BP_Groups_Group $group (Optional) The Group ID, the Group Slug or the Group object.
     1474 *                                                Default: false.
     1475 * @return string
     1476 */
     1477function bp_get_group_all_members_permalink( $group = false ) {
     1478    _deprecated_function( __FUNCTION__, '12.0.0' );
     1479    $path_chunks = bp_groups_get_path_chunks( array( 'members' ) );
     1480    $url         = bp_get_group_url( $group, $path_chunks );
     1481
     1482    /**
     1483     * Filters the permalink of the Members page for a group.
     1484     *
     1485     * @since 1.0.0
     1486     * @since 2.5.0 Added the `$group` parameter.
     1487     * @deprecated 12.0.0
     1488     *
     1489     * @param string          $url   Permalink of the Members page for a group.
     1490     * @param BP_Groups_Group $group The group object.
     1491     */
     1492    return apply_filters_deprecated( 'bp_get_group_all_members_permalink', array( $url, $group ), '12.0.0' );
     1493}
     1494
     1495/**
     1496 * Display a Groups search form.
     1497 *
     1498 * No longer used in BuddyPress.
     1499 *
     1500 * @deprecated 12.0.0
     1501 */
     1502function bp_group_search_form() {
     1503    _deprecated_function( __FUNCTION__, '12.0.0' );
     1504    $label       = __('Filter Groups', 'buddypress');
     1505    $name        = 'group-filter-box';
     1506    $groups_slug = bp_get_groups_slug();
     1507    $action      = bp_displayed_user_url(
     1508        array(
     1509            'single_item_component'        => bp_rewrites_get_slug( 'members', 'member_' . $groups_slug, $groups_slug ),
     1510            'single_item_action'           => bp_rewrites_get_slug( 'members', 'member_' . $groups_slug . '_my_groups', 'my-groups' ),
     1511            'single_item_action_variables' => array( bp_rewrites_get_slug( 'members', 'member_' . $groups_slug . '_search', 'search' ) ),
     1512        )
     1513    );
     1514
     1515    $search_form_html = '<form action="' . esc_url( $action ) . '" id="group-search-form" method="post">
     1516        <label for="'. $name .'" id="'. $name .'-label">'. esc_html( $label ) .'</label>
     1517        <input type="search" name="'. $name . '" id="'. $name .'" value=""/>
     1518
     1519        '. wp_nonce_field( 'group-filter-box', '_wpnonce_group_filter', true, false ) .'
     1520        </form>';
     1521
     1522    echo apply_filters( 'bp_group_search_form', $search_form_html );
     1523}
     1524
     1525/**
     1526 * Determine whether the displayed user has no groups.
     1527 *
     1528 * No longer used in BuddyPress.
     1529 *
     1530 * @deprecated 12.0.0
     1531 *
     1532 * @return bool True if the displayed user has no groups, otherwise false.
     1533 */
     1534function bp_group_show_no_groups_message() {
     1535    _deprecated_function( __FUNCTION__, '12.0.0' );
     1536
     1537    if ( !groups_total_groups_for_user( bp_displayed_user_id() ) ) {
     1538        return true;
     1539    }
     1540
     1541    return false;
     1542}
     1543
     1544/**
     1545 * Determine whether the current page is a group activity permalink.
     1546 *
     1547 * No longer used in BuddyPress.
     1548 *
     1549 * @deprecated 12.0.0
     1550 *
     1551 * @return bool True if this is a group activity permalink, otherwise false.
     1552 */
     1553function bp_group_is_activity_permalink() {
     1554    _deprecated_function( __FUNCTION__, '12.0.0' );
     1555
     1556    if ( !bp_is_single_item() || !bp_is_groups_component() || !bp_is_current_action( bp_get_activity_slug() ) ) {
     1557        return false;
     1558    }
     1559
     1560    return true;
     1561}
     1562
     1563/**
     1564 * Displays group filter titles.
     1565 *
     1566 * @since 1.0.0
     1567 * @deprecated 12.0.0
     1568 */
     1569function bp_groups_filter_title() {
     1570    _deprecated_function( __FUNCTION__, '12.0.0' );
     1571    $current_filter = bp_action_variable( 0 );
     1572
     1573    switch ( $current_filter ) {
     1574        case 'recently-active': default:
     1575            _e( 'Recently Active', 'buddypress' );
     1576            break;
     1577        case 'recently-joined':
     1578            _e( 'Recently Joined', 'buddypress' );
     1579            break;
     1580        case 'most-popular':
     1581            _e( 'Most Popular', 'buddypress' );
     1582            break;
     1583        case 'admin-of':
     1584            _e( 'Administrator Of', 'buddypress' );
     1585            break;
     1586        case 'mod-of':
     1587            _e( 'Moderator Of', 'buddypress' );
     1588            break;
     1589        case 'alphabetically':
     1590            _e( 'Alphabetically', 'buddypress' );
     1591        break;
     1592    }
     1593
     1594    do_action_deprecated( 'bp_groups_filter_title', array(), '12.0.0' );
     1595}
     1596
     1597
     1598/**
     1599 * Return the ID of a user, based on user_login.
     1600 *
     1601 * No longer used.
     1602 *
     1603 * @deprecated 12.0.0
     1604 *
     1605 * @param string $user_login user_login of the user being queried.
     1606 * @return int
     1607 */
     1608function bp_core_get_displayed_userid( $user_login ) {
     1609    _deprecated_function( __FUNCTION__, '12.0.0' );
     1610    $id = bp_core_get_userid( $user_login );
     1611
     1612    return apply_filters_deprecated( 'bp_core_get_displayed_userid', array( $id ), '12.0.0' );
     1613}
     1614
     1615/**
     1616 * Fetch every post that is authored by the given user for the current blog.
     1617 *
     1618 * No longer used in BuddyPress.
     1619 *
     1620 * @deprecated 12.0.0
     1621 *
     1622 * @param int $user_id ID of the user being queried.
     1623 * @return array Post IDs.
     1624 */
     1625function bp_core_get_all_posts_for_user( $user_id = 0 ) {
     1626    _deprecated_function( __FUNCTION__, '12.0.0' );
     1627    global $wpdb;
     1628
     1629    if ( empty( $user_id ) ) {
     1630        $user_id = bp_displayed_user_id();
     1631    }
     1632
     1633    $all_posts = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE post_author = %d AND post_status = 'publish' AND post_type = 'post'", $user_id ) );
     1634
     1635    return apply_filters( 'bp_core_get_all_posts_for_user', array( $all_posts ), '12.0.0' );
     1636}
Note: See TracChangeset for help on using the changeset viewer.