bb_topics_replied_on_undelete_post

The BuddyPress bb topics replied on undelete post function.

Description

bb_topics_replied_on_undelete_post( $post_id ); 

Parameters (1)

0. $post_id
The post id.

Usage

  1. if ( !function_exists( 'bb_topics_replied_on_undelete_post' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-forums/bbpress/bb-includes/functions.bb-posts.php'; 
  3.  
  4. // The post id. 
  5. $post_id = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bb_topics_replied_on_undelete_post($post_id); 
  9.  

Defined (1)

The function is defined in the following location(s).

/bp-forums/bbpress/bb-includes/functions.bb-posts.php  
  1. function bb_topics_replied_on_undelete_post( $post_id ) { 
  2. global $bbdb; 
  3. $bb_post = bb_get_post( $post_id ); 
  4. $topic = get_topic( $bb_post->topic_id ); 
  5.  
  6. $user_posts = new BB_Query( 'post', array( 'post_author_id' => $bb_post->poster_id, 'topic_id' => $topic->topic_id ) ); 
  7.  
  8. if ( 1 == count($user_posts) && $user = bb_get_user( $bb_post->poster_id ) ) { 
  9. $topics_replied_key = $bbdb->prefix . 'topics_replied'; 
  10. bb_update_usermeta( $user->ID, $topics_replied_key, $user->$topics_replied_key + 1 );