Changeset 3025
- Timestamp:
- 04/24/2011 12:11:59 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/plugin/bbp-includes/bbp-forum-functions.php
r3013 r3025 183 183 184 184 // Find this forum in the array 185 $offset = array_search( $forum_id, $private ); 186 187 // Splice around it 188 array_splice( $private, $offset, 1 ); 189 190 // Update private forums minus this one 191 update_option( '_bbp_private_forums', $private ); 185 if ( in_array( $forum_id, $private ) ) { 186 187 $offset = array_search( $forum_id, (array) $private ); 188 189 // Splice around it 190 array_splice( $private, $offset, 1 ); 191 192 // Update private forums minus this one 193 update_option( '_bbp_private_forums', array_unique( array_values( $private ) ) ); 194 } 192 195 } 193 196 … … 199 202 200 203 // Find this forum in the array 201 $offset = array_search( $forum_id, $hidden ); 202 203 // Splice around it 204 array_splice( $hidden, $offset, 1 ); 205 206 // Update hidden forums minus this one 207 update_option( '_bbp_hidden_forums', $hidden ); 204 if ( in_array( $forum_id, $hidden ) ) { 205 206 $offset = array_search( $forum_id, (array) $hidden ); 207 208 // Splice around it 209 array_splice( $hidden, $offset, 1 ); 210 211 // Update hidden forums minus this one 212 update_option( '_bbp_hidden_forums', array_unique( array_values( $hidden ) ) ); 213 } 208 214 } 209 215 … … 242 248 243 249 // Find this forum in the array 244 $offset = array_search( $forum_id, $hidden ); 245 246 // Splice around it 247 array_splice( $hidden, $offset, 1 ); 248 249 // Update hidden forums minus this one 250 update_option( '_bbp_hidden_forums', $hidden ); 250 if ( in_array( $forum_id, $hidden ) ) { 251 252 $offset = array_search( $forum_id, (array) $hidden ); 253 254 // Splice around it 255 array_splice( $hidden, $offset, 1 ); 256 257 // Update hidden forums minus this one 258 update_option( '_bbp_hidden_forums', array_unique( array_values( $hidden ) ) ); 259 } 251 260 } 252 261 … … 254 263 $private = bbp_get_private_forum_ids(); 255 264 $private[] = $forum_id; 256 update_option( '_bbp_private_forums', $private);265 update_option( '_bbp_private_forums', array_unique( array_values( $private ) ) ); 257 266 258 267 // Update forums visibility setting … … 290 299 291 300 // Find this forum in the array 292 if ( $offset = array_search( $forum_id, $private ) ) { 301 if ( in_array( $forum_id, $private ) ) { 302 303 $offset = array_search( $forum_id, (array) $private ); 293 304 294 305 // Splice around it … … 296 307 297 308 // Update private forums minus this one 298 update_option( '_bbp_private_forums', $private);309 update_option( '_bbp_private_forums', array_unique( array_values( $private ) ) ); 299 310 } 300 311 } 301 312 302 313 // Add to '_bbp_hidden_forums' site option 303 $hidden = bbp_get_ private_forum_ids();314 $hidden = bbp_get_hidden_forum_ids(); 304 315 $hidden[] = $forum_id; 305 update_option( '_bbp_hidden_forums', $hidden);316 update_option( '_bbp_hidden_forums', array_unique( array_values( $hidden ) ) ); 306 317 307 318 // Update forums visibility setting
Note: See TracChangeset
for help on using the changeset viewer.