Changeset 3607 for branches/plugin/bbp-includes/bbp-topic-functions.php
- Timestamp:
- 11/14/2011 03:50:25 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/plugin/bbp-includes/bbp-topic-functions.php
r3589 r3607 3057 3057 } 3058 3058 3059 /** Permissions ***************************************************************/ 3060 3061 /** 3062 * Redirect if unathorized user is attempting to edit a topic 3063 * 3064 * @since bbPress (r3605) 3065 * 3066 * @uses bbp_is_topic_edit() 3067 * @uses current_user_can() 3068 * @uses bbp_get_topic_id() 3069 * @uses wp_safe_redirect() 3070 * @uses bbp_get_topic_permalink() 3071 */ 3072 function bbp_check_topic_edit() { 3073 3074 // Bail if not editing a topic 3075 if ( !bbp_is_topic_edit() ) 3076 return; 3077 3078 // User cannot edit topic, so redirect back to topic 3079 if ( !current_user_can( 'edit_topic', bbp_get_topic_id() ) ) { 3080 wp_safe_redirect( bbp_get_topic_permalink() ); 3081 exit(); 3082 } 3083 } 3084 3085 /** 3086 * Redirect if unathorized user is attempting to edit a topic tag 3087 * 3088 * @since bbPress (r3605) 3089 * 3090 * @uses bbp_is_topic_tag_edit() 3091 * @uses current_user_can() 3092 * @uses bbp_get_topic_tag_id() 3093 * @uses wp_safe_redirect() 3094 * @uses bbp_get_topic_tag_link() 3095 */ 3096 function bbp_check_topic_tag_edit() { 3097 3098 // Bail if not editing a topic tag 3099 if ( !bbp_is_topic_tag_edit() ) 3100 return; 3101 3102 // Bail if current user cannot edit topic tags 3103 if ( !current_user_can( 'edit_topic_tags', bbp_get_topic_tag_id() ) ) { 3104 wp_safe_redirect( bbp_get_topic_tag_link() ); 3105 exit(); 3106 } 3107 } 3108 3059 3109 ?>
Note: See TracChangeset
for help on using the changeset viewer.