Changeset 3727 for branches/plugin/bbp-includes/bbp-forum-functions.php
- Timestamp:
- 01/30/2012 07:23:19 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/plugin/bbp-includes/bbp-forum-functions.php
r3716 r3727 171 171 /** Forum Parent **********************************************************/ 172 172 173 // Cast Forum parent id to int 174 $forum_parent_id = (int) $_POST['bbp_forum_parent_id']; 173 // Forum parent was passed (the norm) 174 if ( !empty( $_POST['bbp_forum_parent_id'] ) ) { 175 $forum_parent_id = (int) $_POST['bbp_forum_parent_id']; 176 177 // No forum parent was passed (should never happen) 178 } elseif ( !isset( $_POST['bbp_forum_parent_id'] ) ) { 179 bbp_add_error( 'bbp_new_forum_missing_parent', __( '<strong>ERROR</strong>: Your forum must have a parent.', 'bbpress' ) ); 180 } 181 182 // Filter and sanitize 183 $forum_parent_id = apply_filters( 'bbp_new_forum_pre_parent_id', $forum_parent_id ); 175 184 176 185 // Forum exists … … 178 187 179 188 // Forum is a category 180 if ( bbp_is_forum_category( $forum_parent_id ) ) 181 bbp_add_error( 'bbp_edit_forum_forum_category', __( '<strong>ERROR</strong>: This forum is a category. No forums can be created in this forum.', 'bbpress' ) ); 189 if ( bbp_is_forum_category( $forum_parent_id ) ) { 190 bbp_add_error( 'bbp_new_forum_forum_category', __( '<strong>ERROR</strong>: This forum is a category. No forums can be created in this forum.', 'bbpress' ) ); 191 } 182 192 183 193 // Forum is closed and user cannot access 184 if ( bbp_is_forum_closed( $forum_parent_id ) && !current_user_can( 'edit_forum', $forum_parent_id ) ) 185 bbp_add_error( 'bbp_edit_forum_forum_closed', __( '<strong>ERROR</strong>: This forum has been closed to new forums.', 'bbpress' ) ); 194 if ( bbp_is_forum_closed( $forum_parent_id ) && !current_user_can( 'edit_forum', $forum_parent_id ) ) { 195 bbp_add_error( 'bbp_new_forum_forum_closed', __( '<strong>ERROR</strong>: This forum has been closed to new forums.', 'bbpress' ) ); 196 } 186 197 187 198 // Forum is private and user cannot access 188 if ( bbp_is_forum_private( $forum_parent_id ) && !current_user_can( 'read_private_forums' ) ) 189 bbp_add_error( 'bbp_edit_forum_forum_private', __( '<strong>ERROR</strong>: This forum is private and you do not have the capability to read or create new forums in it.', 'bbpress' ) ); 199 if ( bbp_is_forum_private( $forum_parent_id ) && !current_user_can( 'read_private_forums' ) ) { 200 bbp_add_error( 'bbp_new_forum_forum_private', __( '<strong>ERROR</strong>: This forum is private and you do not have the capability to read or create new forums in it.', 'bbpress' ) ); 201 } 190 202 191 203 // Forum is hidden and user cannot access 192 if ( bbp_is_forum_hidden( $forum_parent_id ) && !current_user_can( 'read_hidden_forums' ) ) 193 bbp_add_error( 'bbp_edit_forum_forum_hidden', __( '<strong>ERROR</strong>: This forum is hidden and you do not have the capability to read or create new forums in it.', 'bbpress' ) ); 204 if ( bbp_is_forum_hidden( $forum_parent_id ) && !current_user_can( 'read_hidden_forums' ) ) { 205 bbp_add_error( 'bbp_new_forum_forum_hidden', __( '<strong>ERROR</strong>: This forum is hidden and you do not have the capability to read or create new forums in it.', 'bbpress' ) ); 206 } 194 207 } 195 208
Note: See TracChangeset
for help on using the changeset viewer.