bpbbpst_save_support_type

Hooks bbp_new_topic_post_extras to safely insert the support request.

Description

bpbbpst_save_support_type( (int) $topic_id = 0 ); 

Parameters (1)

0. $topic_id — Optional. (int)
The id of the topic

Usage

  1. if ( !function_exists( 'bpbbpst_save_support_type' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddy-bbpress-support-topic/includes/functions.php'; 
  3.  
  4. // the id of the topic 
  5. $topic_id = -1; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bpbbpst_save_support_type($topic_id); 
  9.  

Defined (1)

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

/includes/functions.php  
  1. function bpbbpst_save_support_type( $topic_id = 0 ) { 
  2. // if safe then store 
  3. if ( ! empty( $_POST['_bp_bbp_st_is_support'] ) && wp_verify_nonce( $_POST['_wpnonce_bpbbpst_support_define'], 'bpbbpst_support_define' ) ) { 
  4. // no need to sanitize value as i arbitrary set the support topic option to 1 
  5. update_post_meta( $topic_id, '_bpbbpst_support_topic', 1 ); 
  6.  
  7. if ( ! empty( $_POST['_bp_bbp_st_referer'] ) ) { 
  8. update_post_meta( $topic_id, '_bpbbpst_support_referer', esc_url_raw( $_POST['_bp_bbp_st_referer'] ) ); 
  9.