bb_user_subscribe_checkbox

Outputs the post form subscription checkbox.

Description

bb_user_subscribe_checkbox( (null) $args = null ); 

Checks if user is subscribed and outputs checkbox based on status.

Parameters (1)

0. $args — Optional. (null) => null
The args.

Usage

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

Defined (1)

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

/bp-forums/bbpress/bb-includes/functions.bb-template.php  
  1. function bb_user_subscribe_checkbox( $args = null ) { 
  2.  
  3. if ( !bb_is_user_logged_in() ) 
  4. return false; 
  5.  
  6. $is_current = false; 
  7. $defaults = array( 'tab' => false ); 
  8. $args = wp_parse_args( $args, $defaults ); 
  9. $tab = $args['tab'] !== false ? ' tabindex="' . $args['tab'] . '"' : ''; 
  10.  
  11. // Change subscription checkbox message if current or moderating 
  12. if ( bb_is_topic_edit() && !$is_current ) 
  13. $text = __( 'This user should be notified of follow-up posts via email' ); 
  14. else 
  15. $text = __( 'Notify me of follow-up posts via email' ); 
  16.  
  17. echo ' 
  18. <label for="subscription_checkbox"> 
  19. <input name="subscription_checkbox" id="subscription_checkbox" type="checkbox" value="subscribe" ' . checked( true, bb_is_user_subscribed(), false ) . $tab . ' /> 
  20. ' . apply_filters( 'bb_user_subscribe_checkbox_label', $text, (bool) $is_current ) . ' 
  21. </label>'; 
  22.