Ejemplo n.º 1
0
 /**
  * Setup the default bbPress theme compatibility location.
  *
  * @since bbPress (r3778)
  */
 public function setup_theme()
 {
     // Bail if something already has this under control
     if (!empty($this->theme_compat->theme)) {
         return;
     }
     // Setup the theme package to use for compatibility
     bbp_setup_theme_compat(bbp_get_theme_package_id());
 }
Ejemplo n.º 2
0
            // Bail if user cannot add favorites for this user
            if (!current_user_can('edit_user', $user_id)) {
                bbp_ajax_response(false, __('You do not have permission to do this.', 'bbpress'), 302);
            }
            // Get the topic
            $topic = bbp_get_topic($id);
            // Bail if topic cannot be found
            if (empty($topic)) {
                bbp_ajax_response(false, __('The topic could not be found.', 'bbpress'), 303);
            }
            // Bail if user did not take this action
            if (!isset($_POST['nonce']) || !wp_verify_nonce($_POST['nonce'], 'toggle-subscription_' . $topic->ID)) {
                bbp_ajax_response(false, __('Are you sure you meant to do that?', 'bbpress'), 304);
            }
            // Take action
            $status = bbp_is_user_subscribed($user_id, $topic->ID) ? bbp_remove_user_subscription($user_id, $topic->ID) : bbp_add_user_subscription($user_id, $topic->ID);
            // Bail if action failed
            if (empty($status)) {
                bbp_ajax_response(false, __('The request was unsuccessful. Please try again.', 'bbpress'), 305);
            }
            // Put subscription attributes in convenient array
            $attrs = array('topic_id' => $topic->ID, 'user_id' => $user_id);
            // Action succeeded
            bbp_ajax_response(true, bbp_get_user_subscribe_link($attrs, $user_id, false), 200);
        }
    }
    new BBP_IOA();
}
bbp_register_theme_package(array('id' => 'IOA', 'name' => __('BBPress IOA', 'bbpress'), 'version' => bbp_get_version(), 'dir' => trailingslashit(get_template_directory() . '/bbpress'), 'url' => trailingslashit(get_template_directory_uri() . '/bbpress')));
bbp_setup_theme_compat('IOA');