Changeset 3605 for branches/2.0/bbp-includes/bbp-topic-functions.php
- Timestamp:
- 11/14/2011 03:33:48 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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 ?>
Note: See TracChangeset
for help on using the changeset viewer.