Changeset 5567 for trunk/bp-forums/bp-forums-functions.php
- Timestamp:
- 12/17/2011 03:33:32 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-forums/bp-forums-functions.php
r5305 r5567 302 302 303 303 /** 304 * Check to see whether a user has already left this particular reply on a given post. 305 * Prevents dupes. 306 * 307 * @since 1.6 308 * 309 * @param str $text The text of the comment 310 * @param int $topic_id The topic id 311 * @param int $user_id The user id 312 */ 313 function bp_forums_reply_exists( $text = '', $topic_id = 0, $user_id = 0 ) { 314 $reply_exists = false; 315 316 if ( $text && $topic_id && $user_id ) { 317 do_action( 'bbpress_init' ); 318 319 $args = array( 320 'post_author_id' => $user_id, 321 'topic_id' => $topic_id 322 ); 323 324 // BB_Query's post_text parameter does a MATCH, while we need exact matches 325 add_filter( 'get_posts_where', create_function( '$q', 'return $q . " AND p.post_text = \'' . $text . '\'";' ) ); 326 327 $query = new BB_Query( 'post', $args ); 328 329 $reply_exists = !empty( $query->results ); 330 } 331 332 return apply_filters( 'bp_forums_reply_exists', $reply_exists, $text, $topic_id, $user_id ); 333 } 334 335 /** 304 336 * Get a total "Topics Started" count for a given user 305 337 *
Note: See TracChangeset
for help on using the changeset viewer.