Ticket #2661: 2661.001.patch
File 2661.001.patch, 3.4 KB (added by , 14 years ago) |
---|
-
bp-groups-templatetags.php
old new 1020 1020 return apply_filters( 'bp_group_is_member', $is_member ); 1021 1021 } 1022 1022 1023 /** 1024 * bp_group_is_member_banned() 1025 * 1026 * Checks if a user is banned from a group. 1027 * 1028 * @uses is_super_admin Check if current user is super admin 1029 * @uses apply_filters Creates bp_group_is_member_banned and passes $is_banned 1030 * @usedby groups/single/forum/forum.php, groups/single/forum/topic.php to determine post form visibility 1031 * @global array $bp BuddyPress Master global 1032 * @global object $groups_template Current Group (usually in template loop) 1033 * @param object $group Group to check if user is banned from the group 1034 * @return bool If user is banned from the group or not 1035 */ 1036 function bp_group_is_member_banned( $group = false, $user_id = false ) { 1037 global $bp, $groups_template; 1038 1039 // Site admins always have access 1040 if ( is_super_admin() ) 1041 return false; 1042 1043 // Load group if none passed 1044 if ( !$group ) 1045 $group =& $groups_template->group; 1046 1047 // Pass logged-in user ID if none passed 1048 if ( !$user_id ) 1049 $user_id = $bp->loggedin_user->id; 1050 1051 if ( groups_is_user_banned( $user_id, $group->id ) ) 1052 $is_banned = true; 1053 else 1054 $is_banned = false; 1055 1056 // Return 1057 return apply_filters( 'bp_group_is_member_banned', $is_banned ); 1058 } 1059 1023 1060 function bp_group_accept_invite_link() { 1024 1061 echo bp_get_group_accept_invite_link(); 1025 1062 } … … 1096 1133 } 1097 1134 1098 1135 function bp_group_new_topic_button() { 1099 if ( bp_is_group_forum() && is_user_logged_in() && !bp_is_group_forum_topic() ) {1136 if ( bp_is_group_forum() && is_user_logged_in() && !bp_is_group_forum_topic() && !bp_group_is_member_banned() ) { 1100 1137 bp_button( array ( 1101 1138 'id' => 'new_topic', 1102 1139 'component' => 'groups', … … 1210 1247 } 1211 1248 1212 1249 // Filter and return the HTML button 1213 return bp_get_button( apply_filters( 'bp_get_group_join_button', $button ) ); 1250 if ( !bp_group_is_member_banned() ) 1251 return bp_get_button( apply_filters( 'bp_get_group_join_button', $button ) ); 1252 1253 return false; 1214 1254 } 1215 1255 1216 1256 function bp_group_status_message( $group = false ) { -
buddypress/bp-themes/bp-default/groups/single/forum.php
18 18 19 19 <?php if ( !bp_is_group_forum_topic_edit() && !bp_is_group_forum_topic() ) : ?> 20 20 21 <?php if ( ( is_user_logged_in() && 'public' == bp_get_group_status() ) || bp_group_is_member() ) : ?>21 <?php if ( ( is_user_logged_in() && 'public' == bp_get_group_status() && !bp_group_is_member_banned() ) || bp_group_is_member() ) : ?> 22 22 23 23 <form action="" method="post" id="forum-topic-form" class="standard-form"> 24 24 <div id="post-new-topic"> -
C:/
old new 74 74 75 75 </div> 76 76 77 <?php if ( ( is_user_logged_in() && 'public' == bp_get_group_status() ) || bp_group_is_member() ) : ?>77 <?php if ( ( is_user_logged_in() && 'public' == bp_get_group_status() && !bp_group_is_member_banned() ) || bp_group_is_member() ) : ?> 78 78 79 79 <?php if ( bp_get_the_topic_is_last_page() ) : ?> 80 80