Changeset 9938
- Timestamp:
- 06/11/2015 02:50:00 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-groups/bp-groups-template.php
r9906 r9938 256 256 $this->pag_num = bp_sanitize_pagination_arg( 'num', $r['per_page'] ); 257 257 258 if ( bp_current_user_can( 'bp_moderate' ) || ( is_user_logged_in() && $user_id == bp_loggedin_user_id() ) ) 258 if ( bp_current_user_can( 'bp_moderate' ) || ( is_user_logged_in() && $user_id == bp_loggedin_user_id() ) ) { 259 259 $show_hidden = true; 260 } 260 261 261 262 if ( 'invites' == $type ) { … … 378 379 */ 379 380 function has_groups() { 380 if ( $this->group_count ) 381 if ( $this->group_count ) { 381 382 return true; 383 } 382 384 383 385 return false; … … 620 622 global $groups_template; 621 623 622 if ( bp_current_user_can( 'bp_moderate' ) ) 624 if ( bp_current_user_can( 'bp_moderate' ) ) { 623 625 return true; 624 625 if ( empty( $group ) ) 626 } 627 628 if ( empty( $group ) ) { 626 629 $group =& $groups_template->group; 630 } 627 631 628 632 if ( 'public' == $group->status ) { … … 656 660 global $groups_template; 657 661 658 if ( empty( $group ) ) 662 if ( empty( $group ) ) { 659 663 $group =& $groups_template->group; 664 } 660 665 661 666 /** … … 764 769 global $groups_template; 765 770 766 if ( empty( $group ) ) 771 if ( empty( $group ) ) { 767 772 $group =& $groups_template->group; 773 } 768 774 769 775 /** … … 798 804 global $groups_template; 799 805 800 if ( empty( $group ) ) 806 if ( empty( $group ) ) { 801 807 $group =& $groups_template->group; 808 } 802 809 803 810 if ( 'public' == $group->status ) { … … 840 847 global $groups_template; 841 848 842 if ( empty( $group ) ) 849 if ( empty( $group ) ) { 843 850 $group =& $groups_template->group; 851 } 844 852 845 853 /** … … 1006 1014 global $groups_template; 1007 1015 1008 if ( empty( $group ) ) 1016 if ( empty( $group ) ) { 1009 1017 $group =& $groups_template->group; 1018 } 1010 1019 1011 1020 $last_active = $group->last_activity; 1012 1021 1013 if ( !$last_active ) 1022 if ( !$last_active ) { 1014 1023 $last_active = groups_get_groupmeta( $group->id, 'last_activity' ); 1024 } 1015 1025 1016 1026 if ( empty( $last_active ) ) { … … 1083 1093 global $groups_template; 1084 1094 1085 if ( empty( $group ) ) 1095 if ( empty( $group ) ) { 1086 1096 $group =& $groups_template->group; 1097 } 1087 1098 1088 1099 /** … … 1116 1127 global $groups_template; 1117 1128 1118 if ( empty( $group ) ) 1129 if ( empty( $group ) ) { 1119 1130 $group =& $groups_template->group; 1131 } 1120 1132 1121 1133 /** … … 1149 1161 global $groups_template; 1150 1162 1151 if ( empty( $group ) ) 1163 if ( empty( $group ) ) { 1152 1164 $group =& $groups_template->group; 1165 } 1153 1166 1154 1167 /** … … 1186 1199 global $groups_template; 1187 1200 1188 if ( empty( $group ) ) 1201 if ( empty( $group ) ) { 1189 1202 $group =& $groups_template->group; 1203 } 1190 1204 1191 1205 /** … … 1264 1278 global $groups_template; 1265 1279 1266 if ( empty( $group ) ) 1280 if ( empty( $group ) ) { 1267 1281 $group =& $groups_template->group; 1282 } 1268 1283 1269 1284 if ( $group->is_public ) { … … 1298 1313 global $groups_template; 1299 1314 1300 if ( empty( $group ) ) 1315 if ( empty( $group ) ) { 1301 1316 $group =& $groups_template->group; 1317 } 1302 1318 1303 1319 return apply_filters( 'bp_get_group_is_public', $group->is_public ); … … 1324 1340 global $groups_template; 1325 1341 1326 if ( empty( $group ) ) 1342 if ( empty( $group ) ) { 1327 1343 $group =& $groups_template->group; 1344 } 1328 1345 1329 1346 /** … … 1357 1374 global $groups_template; 1358 1375 1359 if ( empty( $group ) ) 1376 if ( empty( $group ) ) { 1360 1377 $group =& $groups_template->group; 1378 } 1361 1379 1362 1380 /** … … 1390 1408 global $groups_template; 1391 1409 1392 if ( empty( $group ) ) 1410 if ( empty( $group ) ) { 1393 1411 $group =& $groups_template->group; 1412 } 1394 1413 1395 1414 /** … … 1423 1442 global $groups_template; 1424 1443 1425 if ( empty( $group ) ) 1444 if ( empty( $group ) ) { 1426 1445 $group =& $groups_template->group; 1446 } 1427 1447 1428 1448 /** … … 1448 1468 global $groups_template; 1449 1469 1450 if ( empty( $group ) ) 1470 if ( empty( $group ) ) { 1451 1471 $group =& $groups_template->group; 1452 1453 if ( empty( $user_id ) ) 1472 } 1473 1474 if ( empty( $user_id ) ) { 1454 1475 $user_id = bp_loggedin_user_id(); 1476 } 1455 1477 1456 1478 return (bool) ( $group->creator_id == $user_id ); … … 1491 1513 global $groups_template; 1492 1514 1493 if ( empty( $group ) ) 1515 if ( empty( $group ) ) { 1494 1516 $group =& $groups_template->group; 1517 } 1495 1518 1496 1519 $defaults = array( … … 1642 1665 global $groups_template; 1643 1666 1644 if ( empty( $group ) ) 1667 if ( empty( $group ) ) { 1645 1668 $group =& $groups_template->group; 1669 } 1646 1670 1647 1671 $admin_ids = array(); … … 1653 1677 } 1654 1678 1655 if ( 'string' == $format ) 1679 if ( 'string' == $format ) { 1656 1680 $admin_ids = implode( ',', $admin_ids ); 1681 } 1657 1682 1658 1683 /** … … 1682 1707 global $groups_template; 1683 1708 1684 if ( empty( $group ) ) 1709 if ( empty( $group ) ) { 1685 1710 $group =& $groups_template->group; 1711 } 1686 1712 1687 1713 $mod_ids = array(); … … 1693 1719 } 1694 1720 1695 if ( 'string' == $format ) 1721 if ( 'string' == $format ) { 1696 1722 $mod_ids = implode( ',', $mod_ids ); 1723 } 1697 1724 1698 1725 /** … … 1725 1752 global $groups_template; 1726 1753 1727 if ( empty( $group ) ) 1754 if ( empty( $group ) ) { 1728 1755 $group =& $groups_template->group; 1756 } 1729 1757 1730 1758 /** … … 1771 1799 */ 1772 1800 function bp_group_show_no_groups_message() { 1773 if ( !groups_total_groups_for_user( bp_displayed_user_id() ) ) 1801 if ( !groups_total_groups_for_user( bp_displayed_user_id() ) ) { 1774 1802 return true; 1803 } 1775 1804 1776 1805 return false; … … 1788 1817 function bp_group_is_activity_permalink() { 1789 1818 1790 if ( !bp_is_single_item() || !bp_is_groups_component() || !bp_is_current_action( bp_get_activity_slug() ) ) 1819 if ( !bp_is_single_item() || !bp_is_groups_component() || !bp_is_current_action( bp_get_activity_slug() ) ) { 1791 1820 return false; 1821 } 1792 1822 1793 1823 return true; … … 1895 1925 global $groups_template; 1896 1926 1897 if ( empty( $group ) ) 1927 if ( empty( $group ) ) { 1898 1928 $group =& $groups_template->group; 1929 } 1899 1930 1900 1931 /** … … 1957 1988 global $groups_template; 1958 1989 1959 if ( empty( $group ) ) 1990 if ( empty( $group ) ) { 1960 1991 $group =& $groups_template->group; 1992 } 1961 1993 1962 1994 /** … … 1999 2031 extract( $r, EXTR_SKIP ); 2000 2032 2001 if ( !$forum_id = groups_get_groupmeta( $groups_template->group->id, 'forum_id' ) ) 2033 if ( !$forum_id = groups_get_groupmeta( $groups_template->group->id, 'forum_id' ) ) { 2002 2034 return false; 2003 2004 if ( !bp_is_active( 'forums' ) ) 2035 } 2036 2037 if ( !bp_is_active( 'forums' ) ) { 2005 2038 return false; 2006 2007 if ( !$groups_template->group->forum_counts ) 2039 } 2040 2041 if ( !$groups_template->group->forum_counts ) { 2008 2042 $groups_template->group->forum_counts = bp_forums_get_forum_topicpost_count( (int) $forum_id ); 2043 } 2009 2044 2010 2045 if ( (bool) $showtext ) { 2011 if ( 1 == (int) $groups_template->group->forum_counts[0]->topics ) 2046 if ( 1 == (int) $groups_template->group->forum_counts[0]->topics ) { 2012 2047 $total_topics = sprintf( __( '%d topic', 'buddypress' ), (int) $groups_template->group->forum_counts[0]->topics ); 2013 else2048 } else { 2014 2049 $total_topics = sprintf( __( '%d topics', 'buddypress' ), (int) $groups_template->group->forum_counts[0]->topics ); 2050 } 2015 2051 } else { 2016 2052 $total_topics = (int) $groups_template->group->forum_counts[0]->topics; … … 2057 2093 extract( $r, EXTR_SKIP ); 2058 2094 2059 if ( !$forum_id = groups_get_groupmeta( $groups_template->group->id, 'forum_id' ) ) 2095 if ( !$forum_id = groups_get_groupmeta( $groups_template->group->id, 'forum_id' ) ) { 2060 2096 return false; 2061 2062 if ( !bp_is_active( 'forums' ) ) 2097 } 2098 2099 if ( !bp_is_active( 'forums' ) ) { 2063 2100 return false; 2064 2065 if ( !$groups_template->group->forum_counts ) 2101 } 2102 2103 if ( !$groups_template->group->forum_counts ) { 2066 2104 $groups_template->group->forum_counts = bp_forums_get_forum_topicpost_count( (int) $forum_id ); 2105 } 2067 2106 2068 2107 if ( (bool) $showtext ) { 2069 if ( 1 == (int) $groups_template->group->forum_counts[0]->posts ) 2108 if ( 1 == (int) $groups_template->group->forum_counts[0]->posts ) { 2070 2109 $total_posts = sprintf( __( '%d post', 'buddypress' ), (int) $groups_template->group->forum_counts[0]->posts ); 2071 else2110 } else { 2072 2111 $total_posts = sprintf( __( '%d posts', 'buddypress' ), (int) $groups_template->group->forum_counts[0]->posts ); 2112 } 2073 2113 } else { 2074 2114 $total_posts = (int) $groups_template->group->forum_counts[0]->posts; … … 2096 2136 global $groups_template; 2097 2137 2098 if ( empty( $group ) ) 2138 if ( empty( $group ) ) { 2099 2139 $group =& $groups_template->group; 2100 2101 if ( ! empty( $group->enable_forum ) ) 2140 } 2141 2142 if ( ! empty( $group->enable_forum ) ) { 2102 2143 return true; 2144 } 2103 2145 2104 2146 return false; … … 2113 2155 global $groups_template; 2114 2156 2115 if ( empty( $group ) ) 2157 if ( empty( $group ) ) { 2116 2158 $group =& $groups_template->group; 2117 2118 if ( $group->enable_forum ) 2159 } 2160 2161 if ( $group->enable_forum ) { 2119 2162 echo ' checked="checked"'; 2163 } 2120 2164 } 2121 2165 … … 2129 2173 global $groups_template; 2130 2174 2131 if ( empty( $group ) ) 2175 if ( empty( $group ) ) { 2132 2176 $group =& $groups_template->group; 2133 2134 if ( $setting == $group->status ) 2177 } 2178 2179 if ( $setting == $group->status ) { 2135 2180 echo ' checked="checked"'; 2181 } 2136 2182 } 2137 2183 … … 2150 2196 $invite_status = bp_group_get_invite_status( $group_id ); 2151 2197 2152 if ( $setting == $invite_status ) 2198 if ( $setting == $invite_status ) { 2153 2199 echo ' checked="checked"'; 2200 } 2154 2201 } 2155 2202 … … 2296 2343 _deprecated_function( __FUNCTION__, '1.5', 'No longer used. See /bp-default/groups/single/admin.php' ); 2297 2344 2298 if ( empty( $group ) ) 2345 if ( empty( $group ) ) { 2299 2346 $group =& $groups_template->group; 2347 } 2300 2348 2301 2349 … … 2372 2420 global $groups_template; 2373 2421 2374 if ( empty( $group ) ) 2422 if ( empty( $group ) ) { 2375 2423 $group =& $groups_template->group; 2424 } 2376 2425 2377 2426 if ( $group_mods = groups_get_group_mods( $group->id ) ) { ?> … … 2441 2490 global $groups_template; 2442 2491 2443 if ( empty( $group ) ) 2492 if ( empty( $group ) ) { 2444 2493 $group =& $groups_template->group; 2494 } 2445 2495 2446 2496 /** … … 2541 2591 global $members_template; 2542 2592 2543 if ( !$user_id ) 2593 if ( !$user_id ) { 2544 2594 $user_id = $members_template->member->user_id; 2595 } 2545 2596 2546 2597 echo bp_get_group_member_demote_link( $user_id ); … … 2558 2609 global $members_template, $groups_template; 2559 2610 2560 if ( empty( $group ) ) 2611 if ( empty( $group ) ) { 2561 2612 $group =& $groups_template->group; 2562 2563 if ( !$user_id ) 2613 } 2614 2615 if ( !$user_id ) { 2564 2616 $user_id = $members_template->member->user_id; 2617 } 2565 2618 2566 2619 /** … … 2583 2636 global $members_template; 2584 2637 2585 if ( !$user_id ) 2638 if ( !$user_id ) { 2586 2639 $user_id = $members_template->member->user_id; 2640 } 2587 2641 2588 2642 echo bp_get_group_member_ban_link( $user_id ); … … 2600 2654 global $groups_template; 2601 2655 2602 if ( empty( $group ) ) 2656 if ( empty( $group ) ) { 2603 2657 $group =& $groups_template->group; 2658 } 2604 2659 2605 2660 /** … … 2622 2677 global $members_template; 2623 2678 2624 if ( !$user_id ) 2679 if ( !$user_id ) { 2625 2680 $user_id = $members_template->member->user_id; 2681 } 2626 2682 2627 2683 echo bp_get_group_member_unban_link( $user_id ); … … 2639 2695 global $members_template, $groups_template; 2640 2696 2641 if ( !$user_id ) 2697 if ( !$user_id ) { 2642 2698 $user_id = $members_template->member->user_id; 2643 2644 if ( empty( $group ) ) 2699 } 2700 2701 if ( empty( $group ) ) { 2645 2702 $group =& $groups_template->group; 2703 } 2646 2704 2647 2705 /** … … 2664 2722 global $members_template; 2665 2723 2666 if ( !$user_id ) 2724 if ( !$user_id ) { 2667 2725 $user_id = $members_template->member->user_id; 2726 } 2668 2727 2669 2728 echo bp_get_group_member_remove_link( $user_id ); … … 2681 2740 global $groups_template; 2682 2741 2683 if ( empty( $group ) ) 2742 if ( empty( $group ) ) { 2684 2743 $group =& $groups_template->group; 2744 } 2685 2745 2686 2746 /** … … 2795 2855 global $groups_template; 2796 2856 2797 if ( empty( $group ) ) 2857 if ( empty( $group ) ) { 2798 2858 $group =& $groups_template->group; 2859 } 2799 2860 2800 2861 /** … … 2828 2889 global $groups_template; 2829 2890 2830 if ( empty( $group ) ) 2891 if ( empty( $group ) ) { 2831 2892 $group =& $groups_template->group; 2832 2833 if ( empty( $page ) ) 2893 } 2894 2895 if ( empty( $page ) ) { 2834 2896 $page = bp_action_variable( 0 ); 2897 } 2835 2898 2836 2899 /** … … 2855 2918 global $groups_template; 2856 2919 2857 if ( empty( $group ) ) 2920 if ( empty( $group ) ) { 2858 2921 $group =& $groups_template->group; 2859 2860 if ( groups_check_for_membership_request( bp_loggedin_user_id(), $group->id ) ) 2922 } 2923 2924 if ( groups_check_for_membership_request( bp_loggedin_user_id(), $group->id ) ) { 2861 2925 return true; 2926 } 2862 2927 2863 2928 return false; … … 2878 2943 2879 2944 // Site admins always have access 2880 if ( bp_current_user_can( 'bp_moderate' ) ) 2945 if ( bp_current_user_can( 'bp_moderate' ) ) { 2881 2946 return true; 2882 2883 if ( empty( $group ) ) 2947 } 2948 2949 if ( empty( $group ) ) { 2884 2950 $group =& $groups_template->group; 2951 } 2885 2952 2886 2953 /** … … 2999 3066 global $groups_template; 3000 3067 3001 if ( empty( $group ) ) 3068 if ( empty( $group ) ) { 3002 3069 $group =& $groups_template->group; 3070 } 3003 3071 3004 3072 $bp = buddypress(); … … 3031 3099 global $groups_template; 3032 3100 3033 if ( empty( $group ) ) 3101 if ( empty( $group ) ) { 3034 3102 $group =& $groups_template->group; 3103 } 3035 3104 3036 3105 $bp = buddypress(); … … 3063 3132 global $groups_template; 3064 3133 3065 if ( empty( $group ) ) 3134 if ( empty( $group ) ) { 3066 3135 $group =& $groups_template->group; 3136 } 3067 3137 3068 3138 /** … … 3093 3163 global $groups_template; 3094 3164 3095 if ( empty( $group ) ) 3165 if ( empty( $group ) ) { 3096 3166 $group =& $groups_template->group; 3167 } 3097 3168 3098 3169 /** … … 3123 3194 global $groups_template; 3124 3195 3125 if ( empty( $group ) ) 3196 if ( empty( $group ) ) { 3126 3197 $group =& $groups_template->group; 3198 } 3127 3199 3128 3200 /** … … 3147 3219 global $groups_template; 3148 3220 3149 if ( !bp_is_active( 'friends' ) ) 3221 if ( !bp_is_active( 'friends' ) ) { 3150 3222 return false; 3151 3152 if ( empty( $group ) ) 3223 } 3224 3225 if ( empty( $group ) ) { 3153 3226 $group =& $groups_template->group; 3154 3155 if ( !friends_check_user_has_friends( bp_loggedin_user_id() ) || !friends_count_invitable_friends( bp_loggedin_user_id(), $group->id ) ) 3227 } 3228 3229 if ( !friends_check_user_has_friends( bp_loggedin_user_id() ) || !friends_count_invitable_friends( bp_loggedin_user_id(), $group->id ) ) { 3156 3230 return false; 3231 } 3157 3232 3158 3233 return true; … … 3184 3259 global $groups_template; 3185 3260 3186 if ( empty( $group ) ) 3261 if ( empty( $group ) ) { 3187 3262 $group =& $groups_template->group; 3188 3189 if ( !is_user_logged_in() || bp_group_is_user_banned() || !bp_is_group_forum() || bp_is_group_forum_topic() ) 3263 } 3264 3265 if ( !is_user_logged_in() || bp_group_is_user_banned() || !bp_is_group_forum() || bp_is_group_forum_topic() ) { 3190 3266 return false; 3267 } 3191 3268 3192 3269 $button = array(
Note: See TracChangeset
for help on using the changeset viewer.