Changeset 3605
- Timestamp:
- 11/14/2011 03:33:48 AM (13 years ago)
- Location:
- branches/2.0/bbp-includes
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.0/bbp-includes/bbp-common-template.php
r3541 r3605 434 434 function bbp_is_user_home() { 435 435 global $bbp; 436 437 if ( !is_user_logged_in() ) 438 return false; 436 439 437 440 if ( empty( $bbp->displayed_user ) ) -
branches/2.0/bbp-includes/bbp-core-compatibility.php
r3602 r3605 1571 1571 if ( !empty( $is_edit ) ) { 1572 1572 1573 // Only allow super admins on multisite to edit every user.1574 if ( !is_user_logged_in() || ( is_multisite() && !current_user_can( 'manage_network_users' ) && ( $user->ID != bbp_get_current_user_id() ) && !apply_filters( 'enable_edit_any_user_configuration', true ) ) || !current_user_can( 'edit_user', $user->ID ) ) {1575 wp_die( __( 'You do not have the permission to edit this user.', 'bbpress' ) );1576 }1577 1578 1573 // We are editing a profile 1579 1574 $posts_query->bbp_is_single_user_edit = true; … … 1631 1626 // Topic/Reply Edit Page 1632 1627 } elseif ( !empty( $is_edit ) ) { 1633 1634 // Bail from edit if user is not logged in1635 if ( !is_user_logged_in() ) {1636 return;1637 }1638 1628 1639 1629 // We are editing a topic -
branches/2.0/bbp-includes/bbp-core-hooks.php
r3515 r3605 37 37 add_action( 'generate_rewrite_rules', 'bbp_generate_rewrite_rules', 10 ); 38 38 add_action( 'wp_enqueue_scripts', 'bbp_enqueue_scripts', 10 ); 39 add_action( 'template_redirect', 'bbp_template_redirect', 10 ); 39 40 add_filter( 'template_include', 'bbp_template_include', 10 ); 40 41 … … 228 229 add_action( 'bbp_activation', 'flush_rewrite_rules' ); 229 230 add_action( 'bbp_deactivation', 'flush_rewrite_rules' ); 231 232 // Redirect user if needed 233 add_action( 'bbp_template_redirect', 'bbp_check_user_edit', 10 ); 234 add_action( 'bbp_template_redirect', 'bbp_check_topic_edit', 10 ); 235 add_action( 'bbp_template_redirect', 'bbp_check_reply_edit', 10 ); 236 add_action( 'bbp_template_redirect', 'bbp_check_topic_tag_edit', 10 ); 230 237 231 238 /** … … 710 717 } 711 718 719 /** Theme Permissions *********************************************************/ 720 721 /** 722 * The main action used for redirecting bbPress theme actions that are not 723 * permitted by the current_user 724 * 725 * @since bbPress (r3605) 726 * 727 * @uses do_action() 728 */ 729 function bbp_template_redirect() { 730 do_action( 'bbp_template_redirect' ); 731 } 732 712 733 ?> -
branches/2.0/bbp-includes/bbp-reply-functions.php
r3544 r3605 1444 1444 } 1445 1445 1446 /** Permissions ***************************************************************/ 1447 1448 /** 1449 * Redirect if unathorized user is attempting to edit a reply 1450 * 1451 * @since bbPress (r3605) 1452 * 1453 * @uses bbp_is_reply_edit() 1454 * @uses current_user_can() 1455 * @uses bbp_get_topic_id() 1456 * @uses wp_safe_redirect() 1457 * @uses bbp_get_topic_permalink() 1458 */ 1459 function bbp_check_reply_edit() { 1460 1461 // Bail if not editing a topic 1462 if ( !bbp_is_reply_edit() ) 1463 return; 1464 1465 // User cannot edit topic, so redirect back to reply 1466 if ( !current_user_can( 'edit_reply', bbp_get_reply_id() ) ) { 1467 wp_safe_redirect( bbp_get_reply_url() ); 1468 exit(); 1469 } 1470 } 1471 1446 1472 ?> -
branches/2.0/bbp-includes/bbp-topic-functions.php
r3545 r3605 3042 3042 } 3043 3043 3044 /** Permissions ***************************************************************/ 3045 3046 /** 3047 * Redirect if unathorized user is attempting to edit a topic 3048 * 3049 * @since bbPress (r3605) 3050 * 3051 * @uses bbp_is_topic_edit() 3052 * @uses current_user_can() 3053 * @uses bbp_get_topic_id() 3054 * @uses wp_safe_redirect() 3055 * @uses bbp_get_topic_permalink() 3056 */ 3057 function bbp_check_topic_edit() { 3058 3059 // Bail if not editing a topic 3060 if ( !bbp_is_topic_edit() ) 3061 return; 3062 3063 // User cannot edit topic, so redirect back to topic 3064 if ( !current_user_can( 'edit_topic', bbp_get_topic_id() ) ) { 3065 wp_safe_redirect( bbp_get_topic_permalink() ); 3066 exit(); 3067 } 3068 } 3069 3070 /** 3071 * Redirect if unathorized user is attempting to edit a topic tag 3072 * 3073 * @since bbPress (r3605) 3074 * 3075 * @uses bbp_is_topic_tag_edit() 3076 * @uses current_user_can() 3077 * @uses bbp_get_topic_tag_id() 3078 * @uses wp_safe_redirect() 3079 * @uses bbp_get_topic_tag_link() 3080 */ 3081 function bbp_check_topic_tag_edit() { 3082 3083 // Bail if not editing a topic tag 3084 if ( !bbp_is_topic_tag_edit() ) 3085 return; 3086 3087 // Bail if current user cannot edit topic tags 3088 if ( !current_user_can( 'edit_topic_tags', bbp_get_topic_tag_id() ) ) { 3089 wp_safe_redirect( bbp_get_topic_tag_link() ); 3090 exit(); 3091 } 3092 } 3093 3044 3094 ?> -
branches/2.0/bbp-includes/bbp-user-functions.php
r3505 r3605 1249 1249 } 1250 1250 1251 /** Premissions ***************************************************************/ 1252 1253 /** 1254 * Redirect if unathorized user is attempting to edit a topic 1255 * 1256 * @since bbPress (r3605) 1257 * 1258 * @uses bbp_is_topic_edit() 1259 * @uses current_user_can() 1260 * @uses bbp_get_topic_id() 1261 * @uses wp_safe_redirect() 1262 * @uses bbp_get_topic_permalink() 1263 */ 1264 function bbp_check_user_edit() { 1265 1266 // Bail if not editing a topic 1267 if ( !bbp_is_single_user_edit() ) 1268 return; 1269 1270 // Only allow super admins on multisite to edit every user. 1271 if ( !is_user_logged_in() || ( is_multisite() && !current_user_can( 'manage_network_users' ) && bbp_is_user_home() && !apply_filters( 'enable_edit_any_user_configuration', true ) ) || !current_user_can( 'edit_user', bbp_get_displayed_user_id() ) ) { 1272 wp_safe_redirect( bbp_get_user_profile_url( bbp_get_displayed_user_id() ) ); 1273 exit(); 1274 } 1275 } 1276 1251 1277 ?>
Note: See TracChangeset
for help on using the changeset viewer.