bb_ksd_submit

The BuddyPress bb ksd submit function.

Description

bb_ksd_submit( $submit, (bool) $type = false ); 

Parameters (2)

0. $submit
The submit.
1. $type — Optional. (bool) => false
The type.

Usage

  1. if ( !function_exists( 'bb_ksd_submit' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-forums/bbpress/bb-plugins/akismet.php'; 
  3.  
  4. // The submit. 
  5. $submit = null; 
  6.  
  7. // The type. 
  8. $type = false; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = bb_ksd_submit($submit, $type); 
  12.  

Defined (1)

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

/bp-forums/bbpress/bb-plugins/akismet.php  
  1. function bb_ksd_submit( $submit, $type = false ) 
  2. global $bb_ksd_api_host; 
  3. global $bb_ksd_api_port; 
  4.  
  5. switch ( $type ) { 
  6. case 'ham': 
  7. case 'spam': 
  8. $path = '/1.1/submit-' . $type; 
  9.  
  10. $bb_post = bb_get_post( $submit ); 
  11. if ( !$bb_post ) { 
  12. return; 
  13. $user = bb_get_user( $bb_post->poster_id ); 
  14. if ( bb_is_trusted_user( $user->ID ) ) { 
  15. return; 
  16.  
  17. $_submit = array( 
  18. 'blog' => bb_get_uri( null, null, BB_URI_CONTEXT_TEXT + BB_URI_CONTEXT_AKISMET ),  
  19. 'user_ip' => $bb_post->poster_ip,  
  20. 'permalink' => get_topic_link( $bb_post->topic_id ), // First page 
  21. 'comment_type' => 'forum',  
  22. 'comment_author' => get_user_name( $user->ID ),  
  23. 'comment_author_email' => bb_get_user_email( $user->ID ),  
  24. 'comment_author_url' => get_user_link( $user->ID ),  
  25. 'comment_content' => $bb_post->post_text,  
  26. 'comment_date_gmt' => $bb_post->post_time 
  27. ); 
  28. break; 
  29.  
  30. case 'hammer': 
  31. case 'spammer': 
  32. $path = '/1.1/submit-' . substr( $type, 0, -3 ); 
  33.  
  34. $user = bb_get_user( $submit ); 
  35. if ( !$user ) { 
  36. return; 
  37. if ( bb_is_trusted_user( $user->ID ) ) { 
  38. return; 
  39.  
  40. $_submit = array( 
  41. 'blog' => bb_get_uri( null, null, BB_URI_CONTEXT_TEXT + BB_URI_CONTEXT_AKISMET ),  
  42. 'permalink' => get_user_profile_link( $user->ID ),  
  43. 'comment_type' => 'profile',  
  44. 'comment_author' => get_user_name( $user->ID ),  
  45. 'comment_author_email' => bb_get_user_email( $user->ID ),  
  46. 'comment_author_url' => get_user_link( $user->ID ),  
  47. 'comment_content' => $user->occ . ' ' . $user->interests,  
  48. 'comment_date_gmt' => $user->user_registered 
  49. ); 
  50. break; 
  51.  
  52. default: 
  53. return; 
  54.  
  55. $path = '/1.1/comment-check'; 
  56.  
  57. $_submit = array( 
  58. 'blog' => bb_get_uri( null, null, BB_URI_CONTEXT_TEXT + BB_URI_CONTEXT_AKISMET ),  
  59. 'user_ip' => preg_replace( '/[^0-9., ]/', '', $_SERVER['REMOTE_ADDR'] ),  
  60. 'user_agent' => $_SERVER['HTTP_USER_AGENT'],  
  61. 'referrer' => $_SERVER['HTTP_REFERER'],  
  62. 'comment_type' => isset($_POST['topic_id']) ? 'forum' : 'profile',  
  63. 'comment_author' => bb_get_current_user_info( 'name' ),  
  64. 'comment_author_email' => bb_get_current_user_info( 'email' ),  
  65. 'comment_author_url' => bb_get_current_user_info( 'url' ),  
  66. 'comment_content' => $submit 
  67. ); 
  68. if ( isset( $_POST['topic_id'] ) ) { 
  69. $_submit['permalink'] = get_topic_link( $_POST['topic_id'] ); // First page 
  70. break; 
  71.  
  72. $query_string = ''; 
  73. foreach ( $_submit as $key => $data ) { 
  74. $query_string .= $key . '=' . urlencode( stripslashes( $data ) ) . '&'; 
  75. return bb_ksd_http_post( $query_string, $bb_ksd_api_host, $path, $bb_ksd_api_port );