Changeset 7316 for trunk/bp-groups/bp-groups-classes.php
- Timestamp:
- 07/26/2013 06:13:51 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-groups/bp-groups-classes.php
r7314 r7316 12 12 13 13 class BP_Groups_Group { 14 var$id;15 var$creator_id;16 var$name;17 var$slug;18 var$description;19 var$status;20 var$enable_forum;21 var$date_created;22 23 var$admins;24 var$mods;25 var$total_member_count;14 public $id; 15 public $creator_id; 16 public $name; 17 public $slug; 18 public $description; 19 public $status; 20 public $enable_forum; 21 public $date_created; 22 23 public $admins; 24 public $mods; 25 public $total_member_count; 26 26 27 27 /** … … 49 49 public $user_has_access; 50 50 51 function __construct( $id = null ) {51 public function __construct( $id = null ) { 52 52 if ( !empty( $id ) ) { 53 53 $this->id = $id; … … 56 56 } 57 57 58 function populate() {58 public function populate() { 59 59 global $wpdb, $bp; 60 60 … … 97 97 } 98 98 99 function save() {99 public function save() { 100 100 global $wpdb, $bp; 101 101 … … 168 168 } 169 169 170 function delete() {170 public function delete() { 171 171 global $wpdb, $bp; 172 172 … … 213 213 } 214 214 215 function get_invites( $user_id, $group_id ) {215 public static function get_invites( $user_id, $group_id ) { 216 216 global $wpdb, $bp; 217 217 return $wpdb->get_col( $wpdb->prepare( "SELECT user_id FROM {$bp->groups->table_name_members} WHERE group_id = %d and is_confirmed = 0 AND inviter_id = %d", $group_id, $user_id ) ); 218 218 } 219 219 220 function filter_user_groups( $filter, $user_id = 0, $order = false, $limit = null, $page = null ) {220 public static function filter_user_groups( $filter, $user_id = 0, $order = false, $limit = null, $page = null ) { 221 221 global $wpdb, $bp; 222 222 … … 246 246 * @todo Deprecate in favor of get() 247 247 */ 248 function search_groups( $filter, $limit = null, $page = null, $sort_by = false, $order = false ) {248 public static function search_groups( $filter, $limit = null, $page = null, $sort_by = false, $order = false ) { 249 249 global $wpdb, $bp; 250 250 … … 269 269 } 270 270 271 function check_slug( $slug ) {271 public static function check_slug( $slug ) { 272 272 global $wpdb, $bp; 273 273 … … 275 275 } 276 276 277 function get_slug( $group_id ) {277 public static function get_slug( $group_id ) { 278 278 global $wpdb, $bp; 279 279 … … 281 281 } 282 282 283 function has_members( $group_id ) {283 public static function has_members( $group_id ) { 284 284 global $wpdb, $bp; 285 285 … … 292 292 } 293 293 294 function has_membership_requests( $group_id ) {294 public static function has_membership_requests( $group_id ) { 295 295 global $wpdb, $bp; 296 296 … … 298 298 } 299 299 300 function get_membership_requests( $group_id, $limit = null, $page = null ) {300 public static function get_membership_requests( $group_id, $limit = null, $page = null ) { 301 301 global $wpdb, $bp; 302 302 … … 311 311 } 312 312 313 function get( $args = array() ) {313 public static function get( $args = array() ) { 314 314 global $wpdb, $bp; 315 315 … … 621 621 * @return string $order_by_term 622 622 */ 623 protected function convert_orderby_to_order_by_term( $orderby ) {623 protected static function convert_orderby_to_order_by_term( $orderby ) { 624 624 $order_by_term = ''; 625 625 … … 650 650 } 651 651 652 function get_by_most_forum_topics( $limit = null, $page = null, $user_id = 0, $search_terms = false, $populate_extras = true, $exclude = false ) {652 public static function get_by_most_forum_topics( $limit = null, $page = null, $user_id = 0, $search_terms = false, $populate_extras = true, $exclude = false ) { 653 653 global $wpdb, $bp, $bbdb; 654 654 … … 692 692 } 693 693 694 function get_by_most_forum_posts( $limit = null, $page = null, $search_terms = false, $populate_extras = true, $exclude = false ) {694 public static function get_by_most_forum_posts( $limit = null, $page = null, $search_terms = false, $populate_extras = true, $exclude = false ) { 695 695 global $wpdb, $bp, $bbdb; 696 696 … … 734 734 } 735 735 736 function get_by_letter( $letter, $limit = null, $page = null, $populate_extras = true, $exclude = false ) {736 public static function get_by_letter( $letter, $limit = null, $page = null, $populate_extras = true, $exclude = false ) { 737 737 global $wpdb, $bp; 738 738 … … 777 777 } 778 778 779 function get_random( $limit = null, $page = null, $user_id = 0, $search_terms = false, $populate_extras = true, $exclude = false ) {779 public static function get_random( $limit = null, $page = null, $user_id = 0, $search_terms = false, $populate_extras = true, $exclude = false ) { 780 780 global $wpdb, $bp; 781 781 … … 817 817 } 818 818 819 function get_group_extras( &$paged_groups, &$group_ids, $type = false ) {819 public static function get_group_extras( &$paged_groups, &$group_ids, $type = false ) { 820 820 global $bp, $wpdb; 821 821 … … 852 852 } 853 853 854 function delete_all_invites( $group_id ) {854 public static function delete_all_invites( $group_id ) { 855 855 global $wpdb, $bp; 856 856 … … 858 858 } 859 859 860 function get_total_group_count() {860 public static function get_total_group_count() { 861 861 global $wpdb, $bp; 862 862 … … 868 868 } 869 869 870 function get_global_forum_topic_count( $type ) {870 public static function get_global_forum_topic_count( $type ) { 871 871 global $bbdb, $wpdb, $bp; 872 872 … … 884 884 } 885 885 886 function get_total_member_count( $group_id ) {886 public static function get_total_member_count( $group_id ) { 887 887 global $wpdb, $bp; 888 888 … … 899 899 * @return int The topic count 900 900 */ 901 function get_global_topic_count( $status = 'public', $search_terms = false ) {901 public static function get_global_topic_count( $status = 'public', $search_terms = false ) { 902 902 global $bbdb, $wpdb, $bp; 903 903 … … 945 945 * @return array 946 946 */ 947 function get_group_type_ids() {947 public static function get_group_type_ids() { 948 948 global $wpdb, $bp; 949 949 … … 1195 1195 var $user; 1196 1196 1197 function __construct( $user_id = 0, $group_id = 0, $id = false, $populate = true ) {1197 public function __construct( $user_id = 0, $group_id = 0, $id = false, $populate = true ) { 1198 1198 1199 1199 // User and group are not empty, and ID is … … 1217 1217 } 1218 1218 1219 function populate() {1219 public function populate() { 1220 1220 global $wpdb, $bp; 1221 1221 … … 1246 1246 } 1247 1247 1248 function save() {1248 public function save() { 1249 1249 global $wpdb, $bp; 1250 1250 … … 1290 1290 } 1291 1291 1292 function promote( $status = 'mod' ) {1292 public function promote( $status = 'mod' ) { 1293 1293 if ( 'mod' == $status ) { 1294 1294 $this->is_admin = 0; … … 1306 1306 } 1307 1307 1308 function demote() {1308 public function demote() { 1309 1309 $this->is_mod = 0; 1310 1310 $this->is_admin = 0; … … 1314 1314 } 1315 1315 1316 function ban() {1316 public function ban() { 1317 1317 if ( !empty( $this->is_admin ) ) 1318 1318 return false; … … 1324 1324 } 1325 1325 1326 function unban() {1326 public function unban() { 1327 1327 if ( !empty( $this->is_admin ) ) 1328 1328 return false; … … 1333 1333 } 1334 1334 1335 function accept_invite() {1335 public function accept_invite() { 1336 1336 $this->inviter_id = 0; 1337 1337 $this->is_confirmed = 1; … … 1339 1339 } 1340 1340 1341 function accept_request() {1341 public function accept_request() { 1342 1342 $this->is_confirmed = 1; 1343 1343 $this->date_modified = bp_core_current_time(); 1344 1344 } 1345 1345 1346 function remove() {1346 public function remove() { 1347 1347 global $wpdb, $bp; 1348 1348 … … 1385 1385 } 1386 1386 1387 function delete( $user_id, $group_id ) {1387 public static function delete( $user_id, $group_id ) { 1388 1388 global $wpdb, $bp; 1389 1389 … … 1399 1399 } 1400 1400 1401 function get_group_ids( $user_id, $limit = false, $page = false ) {1401 public static function get_group_ids( $user_id, $limit = false, $page = false ) { 1402 1402 global $wpdb, $bp; 1403 1403 … … 1420 1420 } 1421 1421 1422 function get_recently_joined( $user_id, $limit = false, $page = false, $filter = false ) {1422 public static function get_recently_joined( $user_id, $limit = false, $page = false, $filter = false ) { 1423 1423 global $wpdb, $bp; 1424 1424 … … 1442 1442 } 1443 1443 1444 function get_is_admin_of( $user_id, $limit = false, $page = false, $filter = false ) {1444 public static function get_is_admin_of( $user_id, $limit = false, $page = false, $filter = false ) { 1445 1445 global $wpdb, $bp; 1446 1446 … … 1464 1464 } 1465 1465 1466 function get_is_mod_of( $user_id, $limit = false, $page = false, $filter = false ) {1466 public static function get_is_mod_of( $user_id, $limit = false, $page = false, $filter = false ) { 1467 1467 global $wpdb, $bp; 1468 1468 … … 1518 1518 } 1519 1519 1520 function check_has_invite( $user_id, $group_id, $type = 'sent' ) {1520 public static function check_has_invite( $user_id, $group_id, $type = 'sent' ) { 1521 1521 global $wpdb, $bp; 1522 1522 … … 1532 1532 } 1533 1533 1534 function delete_invite( $user_id, $group_id ) {1534 public static function delete_invite( $user_id, $group_id ) { 1535 1535 global $wpdb, $bp; 1536 1536 … … 1541 1541 } 1542 1542 1543 function delete_request( $user_id, $group_id ) {1543 public static function delete_request( $user_id, $group_id ) { 1544 1544 global $wpdb, $bp; 1545 1545 … … 1595 1595 * @since BuddyPress (1.2.6) 1596 1596 */ 1597 function check_is_creator( $user_id, $group_id ) {1597 public static function check_is_creator( $user_id, $group_id ) { 1598 1598 global $bp, $wpdb; 1599 1599 … … 1604 1604 } 1605 1605 1606 function check_for_membership_request( $user_id, $group_id ) {1606 public static function check_for_membership_request( $user_id, $group_id ) { 1607 1607 global $wpdb, $bp; 1608 1608 … … 1613 1613 } 1614 1614 1615 function get_random_groups( $user_id = 0, $total_groups = 5 ) {1615 public static function get_random_groups( $user_id = 0, $total_groups = 5 ) { 1616 1616 global $wpdb, $bp; 1617 1617 … … 1624 1624 } 1625 1625 1626 function get_group_member_ids( $group_id ) {1626 public static function get_group_member_ids( $group_id ) { 1627 1627 global $bp, $wpdb; 1628 1628 … … 1630 1630 } 1631 1631 1632 function get_group_administrator_ids( $group_id ) {1632 public static function get_group_administrator_ids( $group_id ) { 1633 1633 global $bp, $wpdb; 1634 1634 … … 1636 1636 } 1637 1637 1638 function get_group_moderator_ids( $group_id ) {1638 public static function get_group_moderator_ids( $group_id ) { 1639 1639 global $bp, $wpdb; 1640 1640 … … 1642 1642 } 1643 1643 1644 function get_all_membership_request_user_ids( $group_id ) {1644 public static function get_all_membership_request_user_ids( $group_id ) { 1645 1645 global $bp, $wpdb; 1646 1646 … … 1648 1648 } 1649 1649 1650 function get_all_for_group( $group_id, $limit = false, $page = false, $exclude_admins_mods = true, $exclude_banned = true, $exclude = false ) {1650 public static function get_all_for_group( $group_id, $limit = false, $page = false, $exclude_admins_mods = true, $exclude_banned = true, $exclude = false ) { 1651 1651 global $bp, $wpdb; 1652 1652 … … 1708 1708 } 1709 1709 1710 function delete_all( $group_id ) {1710 public static function delete_all( $group_id ) { 1711 1711 global $wpdb, $bp; 1712 1712 … … 1723 1723 * @uses BP_Groups_Member 1724 1724 */ 1725 function delete_all_for_user( $user_id ) {1725 public static function delete_all_for_user( $user_id ) { 1726 1726 global $bp, $wpdb; 1727 1727
Note: See TracChangeset
for help on using the changeset viewer.