Changeset 3287 for branches/plugin/bbp-includes/bbp-topic-functions.php
- Timestamp:
- 06/01/2011 02:01:58 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/plugin/bbp-includes/bbp-topic-functions.php
r3275 r3287 2190 2190 global $bbp; 2191 2191 2192 // Get topic 2192 2193 if ( !$topic = wp_get_single_post( $topic_id, ARRAY_A ) ) 2193 2194 return $topic; 2194 2195 2196 // Bail if already closed 2195 2197 if ( $topic['post_status'] == $bbp->closed_status_id ) 2196 2198 return false; 2197 2199 2200 // Execute pre close code 2198 2201 do_action( 'bbp_close_topic', $topic_id ); 2199 2202 2203 // Add pre close status 2200 2204 add_post_meta( $topic_id, '_bbp_status', $topic['post_status'] ); 2201 2205 2206 // Set closed status 2202 2207 $topic['post_status'] = $bbp->closed_status_id; 2203 2208 2209 // No revisions 2210 remove_action( 'pre_post_update', 'wp_save_post_revision' ); 2211 2212 // Update topic 2204 2213 $topic_id = wp_insert_post( $topic ); 2205 2214 2215 // Execute post close code 2206 2216 do_action( 'bbp_closed_topic', $topic_id ); 2207 2217 2218 // Return topic_id 2208 2219 return $topic_id; 2209 2220 } … … 2226 2237 global $bbp; 2227 2238 2239 // Get topic 2228 2240 if ( !$topic = wp_get_single_post( $topic_id, ARRAY_A ) ) 2229 2241 return $topic; 2230 2242 2243 // Bail if already open 2231 2244 if ( $topic['post_status'] != $bbp->closed_status_id ) 2232 2245 return false; 2233 2246 2247 // Execute pre open code 2234 2248 do_action( 'bbp_open_topic', $topic_id ); 2235 2249 2250 // Get previous status 2236 2251 $topic_status = get_post_meta( $topic_id, '_bbp_status', true ); 2252 2253 // Set previous status 2237 2254 $topic['post_status'] = $topic_status; 2238 2255 2256 // Remove old status meta 2239 2257 delete_post_meta( $topic_id, '_bbp_status' ); 2240 2258 2259 // No revisions 2260 remove_action( 'pre_post_update', 'wp_save_post_revision' ); 2261 2262 // Update topic 2241 2263 $topic_id = wp_insert_post( $topic ); 2242 2264 2265 // Execute post open code 2243 2266 do_action( 'bbp_opened_topic', $topic_id ); 2244 2267 2268 // Return topic_id 2245 2269 return $topic_id; 2246 2270 } … … 2262 2286 global $bbp; 2263 2287 2288 // Get the topic 2264 2289 if ( !$topic = wp_get_single_post( $topic_id, ARRAY_A ) ) 2265 2290 return $topic; 2266 2291 2292 // Bail if topic is spam 2267 2293 if ( $topic['post_status'] == $bbp->spam_status_id ) 2268 2294 return false; 2269 2295 2296 // Execute pre spam code 2270 2297 do_action( 'bbp_spam_topic', $topic_id ); 2271 2298 2299 // Add the original post status as post meta for future restoration 2272 2300 add_post_meta( $topic_id, '_bbp_spam_meta_status', $topic['post_status'] ); 2273 2301 2302 // Set post status to spam 2274 2303 $topic['post_status'] = $bbp->spam_status_id; 2275 2304 2305 // No revisions 2306 remove_action( 'pre_post_update', 'wp_save_post_revision' ); 2307 2308 // Update the topic 2276 2309 $topic_id = wp_insert_post( $topic ); 2277 2310 2311 // Execute post spam code 2278 2312 do_action( 'bbp_spammed_topic', $topic_id ); 2279 2313 2314 // Return topic_id 2280 2315 return $topic_id; 2281 2316 } … … 2298 2333 global $bbp; 2299 2334 2335 // Get the topic 2300 2336 if ( !$topic = wp_get_single_post( $topic_id, ARRAY_A ) ) 2301 2337 return $topic; 2302 2338 2339 // Bail if already not spam 2303 2340 if ( $topic['post_status'] != $bbp->spam_status_id ) 2304 2341 return false; 2305 2342 2343 // Execute pre unspam code 2306 2344 do_action( 'bbp_unspam_topic', $topic_id ); 2307 2345 2346 // Get pre spam status 2308 2347 $topic_status = get_post_meta( $topic_id, '_bbp_spam_meta_status', true ); 2348 2349 // Set post status to pre spam 2309 2350 $topic['post_status'] = $topic_status; 2310 2351 2352 // Delete pre spam meta 2311 2353 delete_post_meta( $topic_id, '_bbp_spam_meta_status' ); 2312 2354 2355 // No revisions 2356 remove_action( 'pre_post_update', 'wp_save_post_revision' ); 2357 2358 // Update the topic 2313 2359 $topic_id = wp_insert_post( $topic ); 2314 2360 2361 // Execute post unspam code 2315 2362 do_action( 'bbp_unspammed_topic', $topic_id ); 2316 2363 2364 // Return topic_id 2317 2365 return $topic_id; 2318 2366 }
Note: See TracChangeset
for help on using the changeset viewer.