Changeset 13086 for trunk/src/bp-groups/classes/class-bp-groups-group.php
- Timestamp:
- 08/22/2021 03:16:06 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-groups/classes/class-bp-groups-group.php
r12731 r13086 180 180 * Raw arguments passed to the constructor. 181 181 * 182 * Not currently used by BuddyPress. 183 * 182 184 * @since 2.0.0 183 185 * @var array … … 198 200 */ 199 201 public function __construct( $id = null, $args = array() ) { 200 if ( !empty( $id ) ) { 202 203 // Deprecated notice about $args. 204 if ( ! empty( $args ) ) { 205 _deprecated_argument( 206 __METHOD__, 207 '1.6.0', 208 sprintf( 209 /* translators: 1: the name of the method. 2: the name of the file. */ 210 esc_html__( '%1$s no longer accepts arguments. See the inline documentation at %2$s for more details.', 'buddypress' ), 211 __METHOD__, 212 __FILE__ 213 ) 214 ); 215 } 216 217 if ( ! empty( $id ) ) { 201 218 $this->id = (int) $id; 202 219 $this->populate(); … … 672 689 * 673 690 * @since 1.6.0 691 * @since 10.0.0 Updated to add the deprecated notice. 674 692 * 675 693 * @param string $slug Slug to check. 676 694 * @param string|bool $table_name Deprecated. 677 * @return int|null Group ID if found; nullif not.695 * @return int|null|bool False if empty slug, group ID if found; `null` if not. 678 696 */ 679 697 public static function group_exists( $slug, $table_name = false ) { 680 global $wpdb; 698 699 if ( false !== $table_name ) { 700 _deprecated_argument( 701 __METHOD__, 702 '1.6.0', 703 sprintf( 704 /* translators: 1: the name of the method. 2: the name of the file. */ 705 esc_html__( '%1$s no longer accepts a table name argument. See the inline documentation at %2$s for more details.', 'buddypress' ), 706 __METHOD__, 707 __FILE__ 708 ) 709 ); 710 } 681 711 682 712 if ( empty( $slug ) ) { … … 684 714 } 685 715 686 $args = array( 687 'slug' => $slug, 688 'per_page' => 1, 689 'page' => 1, 690 'update_meta_cache' => false, 691 'show_hidden' => true, 716 $groups = self::get( 717 array( 718 'slug' => $slug, 719 'per_page' => 1, 720 'page' => 1, 721 'update_meta_cache' => false, 722 'show_hidden' => true, 723 ) 692 724 ); 693 694 $groups = BP_Groups_Group::get( $args );695 725 696 726 $group_id = null; … … 710 740 * 711 741 * @param string $slug See {@link BP_Groups_Group::group_exists()}. 712 * @return int|null See {@link BP_Groups_Group::group_exists()}.742 * @return int|null|bool See {@link BP_Groups_Group::group_exists()}. 713 743 */ 714 744 public static function get_id_from_slug( $slug ) { 715 return BP_Groups_Group::group_exists( $slug );745 return self::group_exists( $slug ); 716 746 } 717 747 … … 1056 1086 // Backward compatibility with old method of passing arguments. 1057 1087 if ( ! is_array( $args ) || count( $function_args ) > 1 ) { 1058 _deprecated_argument( __METHOD__, '1.7', sprintf( __( 'Arguments passed to %1$s should be in an associative array. See the inline documentation at %2$s for more details.', 'buddypress' ), __METHOD__, __FILE__ ) ); 1088 _deprecated_argument( 1089 __METHOD__, 1090 '1.7', 1091 sprintf( 1092 /* translators: 1: the name of the method. 2: the name of the file. */ 1093 esc_html__( 'Arguments passed to %1$s should be in an associative array. See the inline documentation at %2$s for more details.', 'buddypress' ), 1094 __METHOD__, 1095 __FILE__ 1096 ) 1097 ); 1059 1098 1060 1099 $old_args_keys = array( … … 1537 1576 */ 1538 1577 public static function get_by_letter( $letter, $limit = null, $page = null, $populate_extras = true, $exclude = false ) { 1539 global $wpdb; 1540 1541 $pag_sql = $hidden_sql = $exclude_sql = ''; 1578 1579 if ( true !== $populate_extras ) { 1580 _deprecated_argument( 1581 __METHOD__, 1582 '1.6.0', 1583 sprintf( 1584 /* translators: 1: the name of the method. 2: the name of the file. */ 1585 esc_html__( '%1$s no longer accepts setting $populate_extras. See the inline documentation at %2$s for more details.', 'buddypress' ), 1586 __METHOD__, 1587 __FILE__ 1588 ) 1589 ); 1590 } 1542 1591 1543 1592 // Multibyte compliance. … … 1552 1601 } 1553 1602 1554 $args = array( 1555 'per_page' => $limit, 1556 'page' => $page, 1557 'search_terms' => $letter . '*', 1558 'search_columns' => array( 'name' ), 1559 'exclude' => $exclude, 1603 return self::get( 1604 array( 1605 'per_page' => $limit, 1606 'page' => $page, 1607 'search_terms' => $letter . '*', 1608 'search_columns' => array( 'name' ), 1609 'exclude' => $exclude, 1610 ) 1560 1611 ); 1561 1562 return BP_Groups_Group::get( $args );1563 1612 } 1564 1613 … … 1569 1618 * 1570 1619 * @since 1.6.0 1620 * @since 10.0.0 Deprecate the `$populate_extras` arg. 1571 1621 * 1572 1622 * @param int|null $limit Optional. The max number of results to return. … … 1578 1628 * @param string|bool $search_terms Optional. Limit groups to those whose name 1579 1629 * or description field contain the search string. 1580 * @param bool $populate_extras Optional. Whether to fetch extra 1581 * information about the groups. Default: true. 1630 * @param bool $populate_extras Deprecated. 1582 1631 * @param string|array|bool $exclude Optional. Array or comma-separated list of group 1583 1632 * IDs to exclude from results. … … 1590 1639 */ 1591 1640 public static function get_random( $limit = null, $page = null, $user_id = 0, $search_terms = false, $populate_extras = true, $exclude = false ) { 1592 $args = array( 1593 'type' => 'random', 1594 'per_page' => $limit, 1595 'page' => $page, 1596 'user_id' => $user_id, 1597 'search_terms' => $search_terms, 1598 'exclude' => $exclude, 1641 1642 if ( true !== $populate_extras ) { 1643 _deprecated_argument( 1644 __METHOD__, 1645 '10.0.0', 1646 sprintf( 1647 /* translators: 1: the name of the method. 2: the name of the file. */ 1648 esc_html__( '%1$s no longer accepts setting $populate_extras. See the inline documentation at %2$s for more details.', 'buddypress' ), 1649 __METHOD__, 1650 __FILE__ 1651 ) 1652 ); 1653 } 1654 1655 return self::get( 1656 array( 1657 'type' => 'random', 1658 'per_page' => $limit, 1659 'page' => $page, 1660 'user_id' => $user_id, 1661 'search_terms' => $search_terms, 1662 'exclude' => $exclude, 1663 ) 1599 1664 ); 1600 1601 return BP_Groups_Group::get( $args );1602 1665 } 1603 1666
Note: See TracChangeset
for help on using the changeset viewer.