diff --git src/bp-groups/bp-groups-template.php src/bp-groups/bp-groups-template.php
index 4ba18f121..ce3ae0a19 100644
|
|
function bp_group_member_promote_admin_link( $args = '' ) { |
2764 | 2764 | * Output a URL for demoting a user to member. |
2765 | 2765 | * |
2766 | 2766 | * @since 1.0.0 |
| 2767 | * @since 10.0.0 Added the `$group` paremeter. |
2767 | 2768 | * |
2768 | | * @param int $user_id ID of the member to demote. Default: current member in |
2769 | | * a member loop. |
| 2769 | * @param int $user_id ID of the member to demote. Default: 0. |
| 2770 | * @param false|int|string|BP_Groups_Group $group (Optional) The Group ID, the Group Slug or the Group object. |
| 2771 | * Default: false. |
2770 | 2772 | */ |
2771 | | function bp_group_member_demote_link( $user_id = 0 ) { |
2772 | | global $members_template; |
2773 | | |
2774 | | if ( !$user_id ) { |
2775 | | $user_id = $members_template->member->user_id; |
2776 | | } |
2777 | | |
2778 | | echo bp_get_group_member_demote_link( $user_id ); |
| 2773 | function bp_group_member_demote_link( $user_id = 0, $group = false ) { |
| 2774 | echo bp_get_group_member_demote_link( $user_id, $group ); |
2779 | 2775 | } |
2780 | 2776 | /** |
2781 | 2777 | * Generate a URL for demoting a user to member. |
2782 | 2778 | * |
2783 | 2779 | * @since 1.0.0 |
| 2780 | * @since 10.0.0 Updated to use `bp_get_group`. |
2784 | 2781 | * |
2785 | | * @param int $user_id ID of the member to demote. Default: current |
2786 | | * member in a member loop. |
2787 | | * @param object|bool $group Optional. Group object. Default: current group. |
| 2782 | * @param int $user_id ID of the member to demote. Default: 0. |
| 2783 | * @param false|int|string|BP_Groups_Group $group (Optional) The Group ID, the Group Slug or the Group object. |
| 2784 | * Default: false. |
2788 | 2785 | * @return string |
2789 | 2786 | */ |
2790 | 2787 | function bp_get_group_member_demote_link( $user_id = 0, $group = false ) { |
2791 | | global $members_template, $groups_template; |
| 2788 | global $members_template; |
2792 | 2789 | |
2793 | | if ( empty( $group ) ) { |
2794 | | $group =& $groups_template->group; |
| 2790 | $group = bp_get_group( $group ); |
| 2791 | |
| 2792 | if ( empty( $group->id ) ) { |
| 2793 | return ''; |
2795 | 2794 | } |
2796 | 2795 | |
2797 | | if ( !$user_id ) { |
| 2796 | if ( ! $user_id ) { |
2798 | 2797 | $user_id = $members_template->member->user_id; |
2799 | 2798 | } |
2800 | 2799 | |
… |
… |
function bp_group_member_demote_link( $user_id = 0 ) { |
2802 | 2801 | * Filters a URL for demoting a user to member. |
2803 | 2802 | * |
2804 | 2803 | * @since 1.0.0 |
2805 | | * @since 2.5.0 Added the `$group` parameter. |
| 2804 | * @since 2.5.0 Added the `$group` parameter. |
| 2805 | * @since 10.0.0 Added the `$user_id` parameter. |
2806 | 2806 | * |
2807 | | * @param string $value URL to use for demoting a user to member. |
2808 | | * @param object $group Group object. |
| 2807 | * @param string $value URL to use for demoting a user to member. |
| 2808 | * @param BP_Groups_Group $group The group object. |
| 2809 | * @param int $user_id The user ID. |
2809 | 2810 | */ |
2810 | | return apply_filters( 'bp_get_group_member_demote_link', wp_nonce_url( trailingslashit( bp_get_group_permalink( $group ) . 'admin/manage-members/demote/' . $user_id ), 'groups_demote_member' ), $group ); |
| 2811 | return apply_filters( |
| 2812 | 'bp_get_group_member_demote_link', |
| 2813 | wp_nonce_url( trailingslashit( bp_get_group_permalink( $group ) . 'admin/manage-members/demote/' . $user_id ), 'groups_demote_member' ), |
| 2814 | $group, |
| 2815 | $user_id |
| 2816 | ); |
2811 | 2817 | } |
2812 | 2818 | |
2813 | 2819 | /** |
2814 | 2820 | * Output a URL for banning a member from a group. |
2815 | 2821 | * |
2816 | 2822 | * @since 1.0.0 |
| 2823 | * @since 10.0.0 Added the `$group` paremeter. |
2817 | 2824 | * |
2818 | | * @param int $user_id ID of the member to ban. |
2819 | | * Default: current member in a member loop. |
| 2825 | * @param int $user_id ID of the member. Default: 0. |
| 2826 | * @param false|int|string|BP_Groups_Group $group (Optional) The Group ID, the Group Slug or the Group object. |
| 2827 | * Default: false. |
2820 | 2828 | */ |
2821 | | function bp_group_member_ban_link( $user_id = 0 ) { |
2822 | | global $members_template; |
2823 | | |
2824 | | if ( !$user_id ) { |
2825 | | $user_id = $members_template->member->user_id; |
2826 | | } |
2827 | | |
2828 | | echo bp_get_group_member_ban_link( $user_id ); |
| 2829 | function bp_group_member_ban_link( $user_id = 0, $group = false ) { |
| 2830 | echo bp_get_group_member_ban_link( $user_id, $group ); |
2829 | 2831 | } |
2830 | 2832 | /** |
2831 | 2833 | * Generate a URL for banning a member from a group. |
2832 | 2834 | * |
2833 | 2835 | * @since 1.0.0 |
| 2836 | * @since 10.0.0 Updated to use `bp_get_group`. |
2834 | 2837 | * |
2835 | | * @param int $user_id ID of the member to ban. |
2836 | | * Default: current member in a member loop. |
2837 | | * @param object|bool $group Optional. Group object. Default: current group. |
| 2838 | * @param int $user_id ID of the member to ban. Default: 0. |
| 2839 | * @param false|int|string|BP_Groups_Group $group (Optional) The Group ID, the Group Slug or the Group object. |
| 2840 | * Default: false. |
2838 | 2841 | * @return string |
2839 | 2842 | */ |
2840 | 2843 | function bp_get_group_member_ban_link( $user_id = 0, $group = false ) { |
2841 | | global $groups_template; |
| 2844 | global $members_template; |
2842 | 2845 | |
2843 | | if ( empty( $group ) ) { |
2844 | | $group =& $groups_template->group; |
| 2846 | $group = bp_get_group( $group ); |
| 2847 | |
| 2848 | if ( empty( $group->id ) ) { |
| 2849 | return ''; |
| 2850 | } |
| 2851 | |
| 2852 | if ( ! $user_id ) { |
| 2853 | $user_id = $members_template->member->user_id; |
2845 | 2854 | } |
2846 | 2855 | |
2847 | 2856 | /** |
2848 | 2857 | * Filters a URL for banning a member from a group. |
2849 | 2858 | * |
2850 | 2859 | * @since 1.0.0 |
| 2860 | * @since 10.0.0 Added the `$group`and `$user_id` parameter. |
2851 | 2861 | * |
2852 | | * @param string $value URL to use for banning a member. |
| 2862 | * @param string $value URL to use for banning a member. |
| 2863 | * @param BP_Groups_Group $group The group object. |
| 2864 | * @param int $user_id The user ID. |
2853 | 2865 | */ |
2854 | | return apply_filters( 'bp_get_group_member_ban_link', wp_nonce_url( trailingslashit( bp_get_group_permalink( $group ) . 'admin/manage-members/ban/' . $user_id ), 'groups_ban_member' ) ); |
| 2866 | return apply_filters( |
| 2867 | 'bp_get_group_member_ban_link', |
| 2868 | wp_nonce_url( trailingslashit( bp_get_group_permalink( $group ) . 'admin/manage-members/ban/' . $user_id ), 'groups_ban_member' ), |
| 2869 | $group, |
| 2870 | $user_id |
| 2871 | ); |
2855 | 2872 | } |
2856 | 2873 | |
2857 | 2874 | /** |
2858 | 2875 | * Output a URL for unbanning a member from a group. |
2859 | 2876 | * |
2860 | 2877 | * @since 1.0.0 |
| 2878 | * @since 10.0.0 Added the `$group` paremeter. |
2861 | 2879 | * |
2862 | | * @param int $user_id ID of the member to unban. |
2863 | | * Default: current member in a member loop. |
| 2880 | * @param int $user_id ID of the member to unban. Default: 0. |
| 2881 | * @param false|int|string|BP_Groups_Group $group (Optional) The Group ID, the Group Slug or the Group object. |
| 2882 | * Default: false. |
2864 | 2883 | */ |
2865 | | function bp_group_member_unban_link( $user_id = 0 ) { |
2866 | | global $members_template; |
2867 | | |
2868 | | if ( !$user_id ) { |
2869 | | $user_id = $members_template->member->user_id; |
2870 | | } |
2871 | | |
2872 | | echo bp_get_group_member_unban_link( $user_id ); |
| 2884 | function bp_group_member_unban_link( $user_id = 0, $group = false ) { |
| 2885 | echo bp_get_group_member_unban_link( $user_id, $group ); |
2873 | 2886 | } |
2874 | 2887 | /** |
2875 | 2888 | * Generate a URL for unbanning a member from a group. |
2876 | 2889 | * |
2877 | 2890 | * @since 1.0.0 |
| 2891 | * @since 10.0.0 Updated to use `bp_get_group`. |
2878 | 2892 | * |
2879 | | * @param int $user_id ID of the member to unban. |
2880 | | * Default: current member in a member loop. |
2881 | | * @param object|bool $group Optional. Group object. Default: current group. |
| 2893 | * @param int $user_id ID of the member to unban. Default: 0. |
| 2894 | * @param false|int|string|BP_Groups_Group $group (Optional) The Group ID, the Group Slug or the Group object. |
| 2895 | * Default: false. |
2882 | 2896 | * @return string |
2883 | 2897 | */ |
2884 | 2898 | function bp_get_group_member_unban_link( $user_id = 0, $group = false ) { |
2885 | | global $members_template, $groups_template; |
| 2899 | global $members_template; |
2886 | 2900 | |
2887 | | if ( !$user_id ) { |
2888 | | $user_id = $members_template->member->user_id; |
| 2901 | $group = bp_get_group( $group ); |
| 2902 | |
| 2903 | if ( empty( $group->id ) ) { |
| 2904 | return ''; |
2889 | 2905 | } |
2890 | 2906 | |
2891 | | if ( empty( $group ) ) { |
2892 | | $group =& $groups_template->group; |
| 2907 | if ( ! $user_id ) { |
| 2908 | $user_id = $members_template->member->user_id; |
2893 | 2909 | } |
2894 | 2910 | |
2895 | 2911 | /** |
2896 | 2912 | * Filters a URL for unbanning a member from a group. |
2897 | 2913 | * |
2898 | 2914 | * @since 1.0.0 |
| 2915 | * @since 10.0.0 Added the `$group`and `$user_id` parameter. |
2899 | 2916 | * |
2900 | | * @param string $value URL to use for unbanning a member. |
| 2917 | * @param string $value URL to use for unbanning a member. |
| 2918 | * @param BP_Groups_Group $group The group object. |
| 2919 | * @param int $user_id The user ID. |
2901 | 2920 | */ |
2902 | | return apply_filters( 'bp_get_group_member_unban_link', wp_nonce_url( trailingslashit( bp_get_group_permalink( $group ) . 'admin/manage-members/unban/' . $user_id ), 'groups_unban_member' ) ); |
| 2921 | return apply_filters( |
| 2922 | 'bp_get_group_member_unban_link', |
| 2923 | wp_nonce_url( trailingslashit( bp_get_group_permalink( $group ) . 'admin/manage-members/unban/' . $user_id ), 'groups_unban_member' ), |
| 2924 | $group, |
| 2925 | $user_id |
| 2926 | ); |
2903 | 2927 | } |
2904 | 2928 | |
2905 | 2929 | /** |
2906 | 2930 | * Output a URL for removing a member from a group. |
2907 | 2931 | * |
2908 | 2932 | * @since 1.2.6 |
| 2933 | * @since 10.0.0 Added the `$group` paremeter. |
2909 | 2934 | * |
2910 | | * @param int $user_id ID of the member to remove. |
2911 | | * Default: current member in a member loop. |
| 2935 | * @param int $user_id ID of the member to remove. Default: 0. |
| 2936 | * @param false|int|string|BP_Groups_Group $group (Optional) The Group ID, the Group Slug or the Group object. |
| 2937 | * Default: false. |
2912 | 2938 | */ |
2913 | | function bp_group_member_remove_link( $user_id = 0 ) { |
2914 | | global $members_template; |
2915 | | |
2916 | | if ( !$user_id ) { |
2917 | | $user_id = $members_template->member->user_id; |
2918 | | } |
2919 | | |
2920 | | echo bp_get_group_member_remove_link( $user_id ); |
| 2939 | function bp_group_member_remove_link( $user_id = 0, $group = false ) { |
| 2940 | echo bp_get_group_member_remove_link( $user_id, $group ); |
2921 | 2941 | } |
2922 | 2942 | /** |
2923 | 2943 | * Generate a URL for removing a member from a group. |
2924 | 2944 | * |
2925 | 2945 | * @since 1.2.6 |
| 2946 | * @since 10.0.0 Updated to use `bp_get_group`. |
2926 | 2947 | * |
2927 | | * @param int $user_id ID of the member to remove. |
2928 | | * Default: current member in a member loop. |
2929 | | * @param object|bool $group Optional. Group object. Default: current group. |
| 2948 | * @param int $user_id ID of the member to remove. Default: 0. |
| 2949 | * @param false|int|string|BP_Groups_Group $group (Optional) The Group ID, the Group Slug or the Group object. |
| 2950 | * Default: false. |
2930 | 2951 | * @return string |
2931 | 2952 | */ |
2932 | 2953 | function bp_get_group_member_remove_link( $user_id = 0, $group = false ) { |
2933 | | global $groups_template; |
| 2954 | global $members_template; |
2934 | 2955 | |
2935 | | if ( empty( $group ) ) { |
2936 | | $group =& $groups_template->group; |
| 2956 | $group = bp_get_group( $group ); |
| 2957 | |
| 2958 | if ( empty( $group->id ) ) { |
| 2959 | return ''; |
| 2960 | } |
| 2961 | |
| 2962 | if ( ! $user_id ) { |
| 2963 | $user_id = $members_template->member->user_id; |
2937 | 2964 | } |
2938 | 2965 | |
2939 | 2966 | /** |
2940 | 2967 | * Filters a URL for removing a member from a group. |
2941 | 2968 | * |
2942 | 2969 | * @since 1.2.6 |
2943 | | * @since 2.5.0 Added the `$group` parameter. |
| 2970 | * @since 2.5.0 Added the `$group` parameter. |
| 2971 | * @since 10.0.0 Added the `$user_id` parameter. |
2944 | 2972 | * |
2945 | | * @param string $value URL to use for removing a member. |
2946 | | * @param object $group Group object. |
| 2973 | * @param string $value URL to use for removing a member. |
| 2974 | * @param BP_Groups_Group $group The group object. |
| 2975 | * @param int $user_id The user ID. |
2947 | 2976 | */ |
2948 | | return apply_filters( 'bp_get_group_member_remove_link', wp_nonce_url( trailingslashit( bp_get_group_permalink( $group ) . 'admin/manage-members/remove/' . $user_id ), 'groups_remove_member' ), $group ); |
| 2977 | return apply_filters( |
| 2978 | 'bp_get_group_member_remove_link', |
| 2979 | wp_nonce_url( trailingslashit( bp_get_group_permalink( $group ) . 'admin/manage-members/remove/' . $user_id ), 'groups_remove_member' ), |
| 2980 | $group, |
| 2981 | $user_id |
| 2982 | ); |
2949 | 2983 | } |
2950 | 2984 | |
2951 | 2985 | /** |
… |
… |
function bp_group_total_for_member() { |
3040 | 3074 | * Output the 'action' attribute for a group form. |
3041 | 3075 | * |
3042 | 3076 | * @since 1.0.0 |
| 3077 | * @since 10.0.0 Added the `$group` paremeter. |
3043 | 3078 | * |
3044 | | * @param string $page Page slug. |
| 3079 | * @param string $page Page slug. |
| 3080 | * @param false|int|string|BP_Groups_Group $group (Optional) The Group ID, the Group Slug or the Group object. |
| 3081 | * Default: false. |
3045 | 3082 | */ |
3046 | | function bp_group_form_action( $page ) { |
3047 | | echo bp_get_group_form_action( $page ); |
| 3083 | function bp_group_form_action( $page, $group = false ) { |
| 3084 | echo bp_get_group_form_action( $page, $group ); |
3048 | 3085 | } |
3049 | 3086 | /** |
3050 | 3087 | * Generate the 'action' attribute for a group form. |
3051 | 3088 | * |
3052 | 3089 | * @since 1.0.0 |
| 3090 | * @since 10.0.0 Updated to use `bp_get_group`. |
3053 | 3091 | * |
3054 | | * @param string $page Page slug. |
3055 | | * @param object|bool $group Optional. Group object. |
3056 | | * Default: current group in the loop. |
| 3092 | * @param string $page Page slug. |
| 3093 | * @param false|int|string|BP_Groups_Group $group (Optional) The Group ID, the Group Slug or the Group object. |
| 3094 | * Default: false. |
3057 | 3095 | * @return string |
3058 | 3096 | */ |
3059 | 3097 | function bp_get_group_form_action( $page, $group = false ) { |
3060 | | global $groups_template; |
| 3098 | $group = bp_get_group( $group ); |
3061 | 3099 | |
3062 | | if ( empty( $group ) ) { |
3063 | | $group =& $groups_template->group; |
| 3100 | if ( empty( $group->id ) || empty( $page ) ) { |
| 3101 | return ''; |
3064 | 3102 | } |
3065 | 3103 | |
3066 | 3104 | /** |
… |
… |
function bp_group_form_action( $page ) { |
3069 | 3107 | * @since 1.0.0 |
3070 | 3108 | * @since 2.5.0 Added the `$group` parameter. |
3071 | 3109 | * |
3072 | | * @param string $value Action attribute for a group form. |
3073 | | * @param object $group Group object. |
| 3110 | * @param string $value Action attribute for a group form. |
| 3111 | * @param BP_Groups_Group $group The group object. |
| 3112 | * @param int|string|bool $page Page slug. |
3074 | 3113 | */ |
3075 | | return apply_filters( 'bp_group_form_action', trailingslashit( bp_get_group_permalink( $group ) . $page ), $group ); |
| 3114 | return apply_filters( 'bp_group_form_action', trailingslashit( bp_get_group_permalink( $group ) . $page ), $group, $page ); |
3076 | 3115 | } |
3077 | 3116 | |
3078 | 3117 | /** |
3079 | 3118 | * Output the 'action' attribute for a group admin form. |
3080 | 3119 | * |
3081 | 3120 | * @since 1.0.0 |
| 3121 | * @since 10.0.0 Added the `$group` paremeter. |
3082 | 3122 | * |
3083 | | * @param string|bool $page Optional. Page slug. |
| 3123 | * @param false|string|bool $page (Optional). Page slug. Default: false. |
| 3124 | * @param false|int|string|BP_Groups_Group $group (Optional) The Group ID, the Group Slug or the Group object. |
| 3125 | * Default: false. |
3084 | 3126 | */ |
3085 | | function bp_group_admin_form_action( $page = false ) { |
3086 | | echo bp_get_group_admin_form_action( $page ); |
| 3127 | function bp_group_admin_form_action( $page = false, $group = false ) { |
| 3128 | echo bp_get_group_admin_form_action( $page, $group ); |
3087 | 3129 | } |
3088 | 3130 | /** |
3089 | 3131 | * Generate the 'action' attribute for a group admin form. |
3090 | 3132 | * |
3091 | 3133 | * @since 1.0.0 |
| 3134 | * @since 10.0.0 Updated to use `bp_get_group`. |
3092 | 3135 | * |
3093 | | * @param string|bool $page Optional. Page slug. |
3094 | | * @param object|bool $group Optional. Group object. |
3095 | | * Default: current group in the loop. |
| 3136 | * @param false|string|bool $page (Optional). Page slug. Default: false. |
| 3137 | * @param false|int|string|BP_Groups_Group $group (Optional) The Group ID, the Group Slug or the Group object. |
| 3138 | * Default: false. |
3096 | 3139 | * @return string |
3097 | 3140 | */ |
3098 | 3141 | function bp_get_group_admin_form_action( $page = false, $group = false ) { |
3099 | | global $groups_template; |
| 3142 | $group = bp_get_group( $group ); |
3100 | 3143 | |
3101 | | if ( empty( $group ) ) { |
3102 | | $group =& $groups_template->group; |
| 3144 | if ( empty( $group->id ) ) { |
| 3145 | return ''; |
3103 | 3146 | } |
3104 | 3147 | |
3105 | 3148 | if ( empty( $page ) ) { |
… |
… |
function bp_group_admin_form_action( $page = false ) { |
3110 | 3153 | * Filters the 'action' attribute for a group admin form. |
3111 | 3154 | * |
3112 | 3155 | * @since 1.0.0 |
3113 | | * @since 2.5.0 Added the `$group` parameter. |
| 3156 | * @since 2.5.0 Added the `$group` parameter. |
| 3157 | * @since 10.0.0 Added the `$page` parameter. |
3114 | 3158 | * |
3115 | | * @param string $value Action attribute for a group admin form. |
3116 | | * @param object $group Group object. |
| 3159 | * @param string $value Action attribute for a group admin form. |
| 3160 | * @param BP_Groups_Group $group The group object. |
| 3161 | * @param int|string|bool $page Page slug. |
3117 | 3162 | */ |
3118 | | return apply_filters( 'bp_group_admin_form_action', trailingslashit( bp_get_group_permalink( $group ) . 'admin/' . $page ), $group ); |
| 3163 | return apply_filters( 'bp_group_admin_form_action', trailingslashit( bp_get_group_permalink( $group ) . 'admin/' . $page ), $group, $page ); |
3119 | 3164 | } |
3120 | 3165 | |
3121 | 3166 | /** |
3122 | 3167 | * Determine whether the logged-in user has requested membership to a group. |
3123 | 3168 | * |
3124 | 3169 | * @since 1.0.0 |
| 3170 | * @since 10.0.0 Updated to use `bp_get_group`. |
3125 | 3171 | * |
3126 | | * @param object|bool $group Optional. Group object. |
3127 | | * Default: current group in the loop. |
| 3172 | * @param false|int|string|BP_Groups_Group $group (Optional) The Group ID, the Group Slug or the Group object. |
| 3173 | * Default: false. |
3128 | 3174 | * @return bool |
3129 | 3175 | */ |
3130 | 3176 | function bp_group_has_requested_membership( $group = false ) { |
3131 | | global $groups_template; |
3132 | | |
3133 | | if ( empty( $group ) ) { |
3134 | | $group =& $groups_template->group; |
3135 | | } |
| 3177 | $group = bp_get_group( $group ); |
3136 | 3178 | |
3137 | | if ( groups_check_for_membership_request( bp_loggedin_user_id(), $group->id ) ) { |
3138 | | return true; |
| 3179 | if ( empty( $group->id ) ) { |
| 3180 | return false; |
3139 | 3181 | } |
3140 | 3182 | |
3141 | | return false; |
| 3183 | return ( groups_check_for_membership_request( bp_loggedin_user_id(), $group->id ) ); |
3142 | 3184 | } |
3143 | 3185 | |
3144 | 3186 | /** |
… |
… |
function bp_group_create_button() { |
3662 | 3704 | * |
3663 | 3705 | * @since 2.0.0 |
3664 | 3706 | * |
3665 | | * @param string $button HTML button for creating a group. |
| 3707 | * @param array $button_args HTML button for creating a group. |
3666 | 3708 | */ |
3667 | | return bp_get_button( apply_filters( 'bp_get_group_create_button', $button_args ) ); |
| 3709 | $button_args = apply_filters( 'bp_get_group_create_button', $button_args ); |
| 3710 | |
| 3711 | return bp_get_button( $button_args ); |
3668 | 3712 | } |
3669 | 3713 | |
3670 | 3714 | /** |
… |
… |
function bp_group_create_button() { |
3675 | 3719 | function bp_group_create_nav_item() { |
3676 | 3720 | echo bp_get_group_create_nav_item(); |
3677 | 3721 | } |
3678 | | |
3679 | 3722 | /** |
3680 | 3723 | * Get the Create a Group nav item. |
3681 | 3724 | * |
… |
… |
function bp_total_group_count() { |
3839 | 3882 | * |
3840 | 3883 | * @param int $value Total number of groups found. |
3841 | 3884 | */ |
3842 | | return apply_filters( 'bp_get_total_group_count', groups_get_total_group_count() ); |
| 3885 | return apply_filters( 'bp_get_total_group_count', (int) groups_get_total_group_count() ); |
3843 | 3886 | } |
3844 | 3887 | |
3845 | 3888 | /** |
… |
… |
function bp_group_member_avatar_mini( $width = 30, $height = 30 ) { |
4112 | 4155 | function bp_group_member_name() { |
4113 | 4156 | echo bp_get_group_member_name(); |
4114 | 4157 | } |
4115 | | |
4116 | 4158 | /** |
4117 | 4159 | * @since 1.0.0 |
4118 | 4160 | * |
… |
… |
function bp_group_member_name() { |
4137 | 4179 | function bp_group_member_url() { |
4138 | 4180 | echo bp_get_group_member_url(); |
4139 | 4181 | } |
4140 | | |
4141 | 4182 | /** |
4142 | 4183 | * @since 1.0.0 |
4143 | 4184 | * |
… |
… |
function bp_group_member_url() { |
4162 | 4203 | function bp_group_member_link() { |
4163 | 4204 | echo bp_get_group_member_link(); |
4164 | 4205 | } |
4165 | | |
4166 | 4206 | /** |
4167 | 4207 | * @since 1.0.0 |
4168 | 4208 | * |
… |
… |
function bp_group_member_link() { |
4187 | 4227 | function bp_group_member_domain() { |
4188 | 4228 | echo bp_get_group_member_domain(); |
4189 | 4229 | } |
4190 | | |
4191 | 4230 | /** |
4192 | 4231 | * @since 1.2.0 |
4193 | 4232 | * |
… |
… |
function bp_group_member_domain() { |
4212 | 4251 | function bp_group_member_is_friend() { |
4213 | 4252 | echo bp_get_group_member_is_friend(); |
4214 | 4253 | } |
4215 | | |
4216 | 4254 | /** |
4217 | 4255 | * @since 1.2.0 |
4218 | 4256 | * |
… |
… |
function bp_group_member_is_friend() { |
4240 | 4278 | } |
4241 | 4279 | |
4242 | 4280 | /** |
| 4281 | * Check whether the member is banned from the current group. |
| 4282 | * |
4243 | 4283 | * @since 1.0.0 |
4244 | 4284 | */ |
4245 | 4285 | function bp_group_member_is_banned() { |
4246 | 4286 | echo bp_get_group_member_is_banned(); |
4247 | 4287 | } |
4248 | | |
4249 | 4288 | /** |
| 4289 | * Check whether the member is banned from the current group. |
| 4290 | * |
4250 | 4291 | * @since 1.0.0 |
4251 | 4292 | * |
4252 | | * @return mixed|void |
| 4293 | * @return bool |
4253 | 4294 | */ |
4254 | 4295 | function bp_get_group_member_is_banned() { |
4255 | 4296 | global $members_template; |
4256 | 4297 | |
| 4298 | if ( ! isset( $members_template->member->is_banned ) ) { |
| 4299 | return false; |
| 4300 | } |
| 4301 | |
4257 | 4302 | /** |
4258 | 4303 | * Filters whether the member is banned from the current group. |
4259 | 4304 | * |
… |
… |
function bp_group_member_is_banned() { |
4261 | 4306 | * |
4262 | 4307 | * @param bool $is_banned Whether or not the member is banned. |
4263 | 4308 | */ |
4264 | | return apply_filters( 'bp_get_group_member_is_banned', $members_template->member->is_banned ); |
| 4309 | return apply_filters( 'bp_get_group_member_is_banned', (bool) $members_template->member->is_banned ); |
4265 | 4310 | } |
4266 | 4311 | |
4267 | 4312 | /** |
| 4313 | * Output CSS if group member is banned. |
| 4314 | * |
4268 | 4315 | * @since 1.2.6 |
| 4316 | * @since 10.0.0 Updated to use `bp_get_group_member_is_banned`. |
4269 | 4317 | */ |
4270 | 4318 | function bp_group_member_css_class() { |
4271 | | global $members_template; |
4272 | | |
4273 | | if ( $members_template->member->is_banned ) { |
| 4319 | if ( bp_get_group_member_is_banned() ) { |
4274 | 4320 | |
4275 | 4321 | /** |
4276 | 4322 | * Filters the class to add to the HTML if member is banned. |
… |
… |
function bp_group_member_joined_since( $args = array() ) { |
4340 | 4386 | } |
4341 | 4387 | |
4342 | 4388 | /** |
| 4389 | * Get group member from current group. |
| 4390 | * |
4343 | 4391 | * @since 1.0.0 |
4344 | 4392 | */ |
4345 | 4393 | function bp_group_member_id() { |
4346 | 4394 | echo bp_get_group_member_id(); |
4347 | 4395 | } |
4348 | | |
4349 | 4396 | /** |
| 4397 | * Get group member from current group. |
| 4398 | * |
4350 | 4399 | * @since 1.0.0 |
4351 | 4400 | * |
4352 | | * @return mixed|void |
| 4401 | * @return int |
4353 | 4402 | */ |
4354 | 4403 | function bp_get_group_member_id() { |
4355 | 4404 | global $members_template; |
4356 | 4405 | |
| 4406 | if ( ! isset( $members_template->member->user_id ) ) { |
| 4407 | return 0; |
| 4408 | } |
| 4409 | |
4357 | 4410 | /** |
4358 | 4411 | * Filters the member's user ID for group members loop. |
4359 | 4412 | * |
… |
… |
function bp_group_member_id() { |
4361 | 4414 | * |
4362 | 4415 | * @param int $user_id User ID of the member. |
4363 | 4416 | */ |
4364 | | return apply_filters( 'bp_get_group_member_id', $members_template->member->user_id ); |
| 4417 | return apply_filters( 'bp_get_group_member_id', (int) $members_template->member->user_id ); |
4365 | 4418 | } |
4366 | 4419 | |
4367 | 4420 | /** |
… |
… |
function bp_group_member_id() { |
4372 | 4425 | function bp_group_member_needs_pagination() { |
4373 | 4426 | global $members_template; |
4374 | 4427 | |
4375 | | if ( $members_template->total_member_count > $members_template->pag_num ) { |
4376 | | return true; |
4377 | | } |
4378 | | |
4379 | | return false; |
| 4428 | return ( $members_template->total_member_count > $members_template->pag_num ); |
4380 | 4429 | } |
4381 | 4430 | |
4382 | 4431 | /** |
… |
… |
function bp_group_member_needs_pagination() { |
4385 | 4434 | function bp_group_pag_id() { |
4386 | 4435 | echo bp_get_group_pag_id(); |
4387 | 4436 | } |
4388 | | |
4389 | 4437 | /** |
4390 | 4438 | * @since 1.0.0 |
4391 | 4439 | * |
… |
… |
function bp_group_member_pagination() { |
4410 | 4458 | echo bp_get_group_member_pagination(); |
4411 | 4459 | wp_nonce_field( 'bp_groups_member_list', '_member_pag_nonce' ); |
4412 | 4460 | } |
4413 | | |
4414 | 4461 | /** |
4415 | 4462 | * @since 1.0.0 |
4416 | 4463 | * |
… |
… |
function bp_group_member_pagination() { |
4435 | 4482 | function bp_group_member_pagination_count() { |
4436 | 4483 | echo bp_get_group_member_pagination_count(); |
4437 | 4484 | } |
4438 | | |
4439 | 4485 | /** |
4440 | 4486 | * @since 1.0.0 |
4441 | 4487 | * |
… |
… |
function bp_group_member_admin_pagination() { |
4476 | 4522 | echo bp_get_group_member_admin_pagination(); |
4477 | 4523 | wp_nonce_field( 'bp_groups_member_admin_list', '_member_admin_pag_nonce' ); |
4478 | 4524 | } |
4479 | | |
4480 | 4525 | /** |
4481 | 4526 | * @since 1.0.0 |
4482 | 4527 | * |
diff --git tests/phpunit/testcases/groups/template.php tests/phpunit/testcases/groups/template.php
index af1e8159c..6e6f6712f 100644
|
|
class BP_Tests_Groups_Template extends BP_UnitTestCase { |
977 | 977 | $this->assertTrue( bp_group_is_forum_enabled( $g2 ) ); |
978 | 978 | } |
979 | 979 | |
| 980 | /** |
| 981 | * @group bp_get_group_member_is_banned |
| 982 | */ |
| 983 | public function test_bp_group_member_is_banned() { |
| 984 | $this->assertFalse( bp_get_group_member_is_banned() ); |
| 985 | } |
| 986 | |
| 987 | /** |
| 988 | * @group bp_get_group_member_id |
| 989 | */ |
| 990 | public function test_bp_get_group_member_id() { |
| 991 | $this->assertFalse( (bool) bp_get_group_member_id() ); |
| 992 | } |
| 993 | |
| 994 | /** |
| 995 | * @group bp_get_group_form_action |
| 996 | */ |
| 997 | public function test_bp_bp_get_group_form_action_when_empty() { |
| 998 | $this->assertEmpty( bp_get_group_form_action( '' ) ); |
| 999 | } |
| 1000 | |
| 1001 | /** |
| 1002 | * @group bp_get_group_form_action |
| 1003 | */ |
| 1004 | public function test_bp_bp_get_group_form_action() { |
| 1005 | $g = $this->factory->group->create(); |
| 1006 | $p = 2; |
| 1007 | $url = trailingslashit( bp_get_group_permalink( $g ) . $p ); |
| 1008 | |
| 1009 | $this->assertSame( bp_get_group_form_action( $p, $g ), $url ); |
| 1010 | } |
| 1011 | |
980 | 1012 | /** |
981 | 1013 | * @group bp_get_group_member_count |
982 | 1014 | */ |