Changeset 3504
- Timestamp:
- 09/10/2011 07:30:45 PM (13 years ago)
- Location:
- branches/plugin/bbp-includes
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/plugin/bbp-includes/bbp-core-caps.php
r3423 r3504 181 181 182 182 // Add do_not_allow cap if user is spam or deleted 183 if ( bbp_is_user_ spammer( $user_id ) || bbp_is_user_deleted( $user_id ) )183 if ( bbp_is_user_inactive( $user_id ) ) 184 184 $caps = array( 'do_not_allow' ); 185 185 … … 195 195 196 196 // Add 'do_not_allow' cap if user is spam or deleted 197 if ( bbp_is_user_ spammer( $user_id ) || bbp_is_user_deleted( $user_id ) )197 if ( bbp_is_user_inactive( $user_id ) ) 198 198 $caps[] = 'do_not_allow'; 199 199 … … 217 217 218 218 // Add 'do_not_allow' cap if user is spam or deleted 219 if ( bbp_is_user_ spammer( $user_id ) || bbp_is_user_deleted( $user_id ) )219 if ( bbp_is_user_inactive( $user_id ) ) 220 220 $caps[] = 'do_not_allow'; 221 221 … … 239 239 240 240 // Add 'do_not_allow' cap if user is spam or deleted 241 if ( bbp_is_user_ spammer( $user_id ) || bbp_is_user_deleted( $user_id ) )241 if ( bbp_is_user_inactive( $user_id ) ) 242 242 $caps[] = 'do_not_allow'; 243 243 … … 479 479 * @uses is_multisite() 480 480 * @uses bbp_allow_global_access() 481 * @uses bbp_is_user_deleted() 482 * @uses bbp_is_user_spammer() 481 * @uses bbp_is_user_inactive() 483 482 * @uses is_user_logged_in() 484 483 * @uses current_user_can() … … 493 492 return; 494 493 495 // Bail if user is marked as spam or is deleted496 if ( bbp_is_user_ deleted() || bbp_is_user_spammer() )494 // Bail if user is not active 495 if ( bbp_is_user_inactive() ) 497 496 return; 498 497 … … 562 561 * @uses is_multisite() 563 562 * @uses bbp_allow_global_access() 564 * @uses bbp_is_user_deleted() 565 * @uses bbp_is_user_spammer() 563 * @uses bbp_is_user_inactive() 566 564 * @uses is_user_logged_in() 567 565 * @uses current_user_can() … … 579 577 580 578 // Bail if user is marked as spam or is deleted 581 if ( bbp_is_user_ deleted() || bbp_is_user_spammer() )579 if ( bbp_is_user_inactive() ) 582 580 return; 583 581 -
branches/plugin/bbp-includes/bbp-user-functions.php
r3453 r3504 1186 1186 } 1187 1187 1188 /** 1189 * Checks if user is active 1190 * 1191 * @since bbPress (r3502) 1192 * 1193 * @uses is_user_logged_in() To check if user is logged in 1194 * @uses bbp_get_displayed_user_id() To get current user ID 1195 * @uses bbp_is_user_spammer() To check if user is spammer 1196 * @uses bbp_is_user_deleted() To check if user is deleted 1197 * 1198 * @param int $user_id The user ID to check 1199 * @return bool True if public, false if not 1200 */ 1201 function bbp_is_user_active( $user_id = 0 ) { 1202 1203 // Default to current user 1204 if ( empty( $user_id ) && is_user_logged_in() ) 1205 $user_id = bbp_get_current_user_id(); 1206 1207 // No user to check 1208 if ( empty( $user_id ) ) 1209 return false; 1210 1211 // Check spam 1212 if ( bbp_is_user_spammer( $user_id ) ) 1213 return false; 1214 1215 // Check deleted 1216 if ( bbp_is_user_deleted( $user_id ) ) 1217 return false; 1218 1219 // Assume true if not spam or deleted 1220 return true; 1221 } 1222 1223 /** 1224 * Checks if user is not active. 1225 * 1226 * @since bbPress (r3502) 1227 * 1228 * @uses is_user_logged_in() To check if user is logged in 1229 * @uses bbp_get_displayed_user_id() To get current user ID 1230 * @uses bbp_is_user_active() To check if user is active 1231 * 1232 * @param int $user_id The user ID to check 1233 * @return bool True if inactive, false if active 1234 */ 1235 function bbp_is_user_inactive( $user_id = 0 ) { 1236 1237 // Default to current user 1238 if ( empty( $user_id ) && is_user_logged_in() ) 1239 $user_id = bbp_get_current_user_id(); 1240 1241 // No user to check 1242 if ( empty( $user_id ) ) 1243 return false; 1244 1245 // Return the inverse of active 1246 return !bbp_is_user_active( $user_id ); 1247 } 1248 1188 1249 ?> -
branches/plugin/bbp-includes/bbp-user-template.php
r3485 r3504 1155 1155 * @uses is_user_logged_in() 1156 1156 * @uses bbp_allow_anonymous() 1157 * @uses bbp_is_user_active() 1157 1158 * @uses current_user_can() 1158 1159 * @uses apply_filters() … … 1174 1175 1175 1176 // User is logged in 1176 elseif ( !bbp_is_user_spammer() && !bbp_is_user_deleted() && current_user_can( 'publish_topics' ) )1177 elseif ( bbp_is_user_active() && current_user_can( 'publish_topics' ) ) 1177 1178 $retval = true; 1178 1179 … … 1189 1190 * @uses is_user_logged_in() 1190 1191 * @uses bbp_allow_anonymous() 1192 * @uses bbp_is_user_active() 1191 1193 * @uses current_user_can() 1192 1194 * @uses apply_filters() … … 1208 1210 1209 1211 // User is logged in 1210 elseif ( !bbp_is_user_spammer() && !bbp_is_user_deleted() && current_user_can( 'publish_replies' ) )1212 elseif ( bbp_is_user_active() && current_user_can( 'publish_replies' ) ) 1211 1213 $retval = true; 1212 1214 … … 1288 1290 1289 1291 // Looking at a single forum & forum is open 1290 if ( ( bbp_is_single_forum() || is_page() || is_single() ) && bbp_is_forum_open() ) {1292 if ( ( bbp_is_single_forum() || is_page() || is_single() ) && bbp_is_forum_open() ) 1291 1293 $retval = bbp_current_user_can_publish_topics(); 1292 1294 1293 1295 // User can edit this topic 1294 } elseif ( bbp_is_topic_edit() ) {1296 elseif ( bbp_is_topic_edit() ) 1295 1297 $retval = current_user_can( 'edit_topic', bbp_get_topic_id() ); 1296 }1297 1298 1298 1299 // Allow access to be filtered … … 1323 1324 1324 1325 // Looking at a single topic, topic is open, and forum is open 1325 if ( ( bbp_is_single_topic() || is_page() || is_single() ) && bbp_is_topic_open() && bbp_is_forum_open() ) {1326 if ( ( bbp_is_single_topic() || is_page() || is_single() ) && bbp_is_topic_open() && bbp_is_forum_open() ) 1326 1327 $retval = bbp_current_user_can_publish_replies(); 1327 1328 1328 1329 // User can edit this topic 1329 } elseif ( bbp_is_reply_edit() ) {1330 elseif ( bbp_is_reply_edit() ) 1330 1331 $retval = current_user_can( 'edit_reply', bbp_get_reply_id() ); 1331 }1332 1332 1333 1333 // Allow access to be filtered
Note: See TracChangeset
for help on using the changeset viewer.