Changeset 3287
- Timestamp:
- 06/01/2011 02:01:58 AM (14 years ago)
- Location:
- branches/plugin/bbp-includes
- Files:
-
- 3 edited
-
bbp-forum-functions.php (modified) (2 diffs)
-
bbp-reply-functions.php (modified) (2 diffs)
-
bbp-topic-functions.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/plugin/bbp-includes/bbp-forum-functions.php
r3243 r3287 72 72 * @uses wp_get_single_post() To get the forum 73 73 * @uses do_action() Calls 'bbp_close_forum' with the forum id 74 * @uses add_post_meta() To add the previous status to a meta 75 * @uses wp_insert_post() To update the forum with the new status 74 * @uses update_post_meta() To add the previous status to a meta 76 75 * @uses do_action() Calls 'bbp_opened_forum' with the forum id 77 76 * @return mixed False or {@link WP_Error} on failure, forum id on success … … 99 98 * @uses do_action() Calls 'bbp_open_forum' with the forum id 100 99 * @uses get_post_meta() To get the previous status 101 * @uses delete_post_meta() To delete the previous status meta 102 * @uses wp_insert_post() To update the forum with the new status 100 * @uses update_post_meta() To delete the previous status meta 103 101 * @uses do_action() Calls 'bbp_opened_forum' with the forum id 104 102 * @return mixed False or {@link WP_Error} on failure, forum id on success -
branches/plugin/bbp-includes/bbp-reply-functions.php
r3276 r3287 997 997 global $bbp; 998 998 999 // Get reply 999 1000 if ( !$reply = wp_get_single_post( $reply_id, ARRAY_A ) ) 1000 1001 return $reply; 1001 1002 1003 // Bail if already spam 1002 1004 if ( $reply['post_status'] == $bbp->spam_status_id ) 1003 1005 return false; 1004 1006 1007 // Execute pre spam code 1005 1008 do_action( 'bbp_spam_reply', $reply_id ); 1006 1009 1010 // Add the original post status as post meta for future restoration 1007 1011 add_post_meta( $reply_id, '_bbp_spam_meta_status', $reply['post_status'] ); 1008 1012 1013 // Set post status to spam 1009 1014 $reply['post_status'] = $bbp->spam_status_id; 1010 1015 1016 // No revisions 1017 remove_action( 'pre_post_update', 'wp_save_post_revision' ); 1018 1019 // Update the reply 1011 1020 $reply_id = wp_insert_post( $reply ); 1012 1021 1022 // Execute post spam code 1013 1023 do_action( 'bbp_spammed_reply', $reply_id ); 1014 1024 1025 // Return reply_id 1015 1026 return $reply_id; 1016 1027 } … … 1033 1044 global $bbp; 1034 1045 1046 // Get reply 1035 1047 if ( !$reply = wp_get_single_post( $reply_id, ARRAY_A ) ) 1036 1048 return $reply; 1037 1049 1050 // Bail if already not spam 1038 1051 if ( $reply['post_status'] != $bbp->spam_status_id ) 1039 1052 return false; 1040 1053 1054 // Execute pre unspam code 1041 1055 do_action( 'bbp_unspam_reply', $reply_id ); 1042 1056 1057 // Get pre spam status 1043 1058 $reply_status = get_post_meta( $reply_id, '_bbp_spam_meta_status', true ); 1059 1060 // Set post status to pre spam 1044 1061 $reply['post_status'] = $reply_status; 1045 1062 1063 // Delete pre spam meta 1046 1064 delete_post_meta( $reply_id, '_bbp_spam_meta_status' ); 1047 1065 1066 // No revisions 1067 remove_action( 'pre_post_update', 'wp_save_post_revision' ); 1068 1069 // Update the reply 1048 1070 $reply_id = wp_insert_post( $reply ); 1049 1071 1072 // Execute post unspam code 1050 1073 do_action( 'bbp_unspammed_reply', $reply_id ); 1051 1074 1075 // Return reply_id 1052 1076 return $reply_id; 1053 1077 } -
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.