Beispiel #1
0
            $id = intval($_POST['id']);
            // 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');
Beispiel #2
0
 /**
  * Register bundled theme packages
  *
  * Note that since we currently have complete control over bbp-themes and
  * the bbp-theme-compat folders, it's fine to hardcode these here. If at a
  * later date we need to automate this, and API will need to be built.
  *
  * @since bbPress (r3829)
  */
 public function register_theme_packages()
 {
     // Register the default theme compatibility package
     bbp_register_theme_package(array('id' => 'default', 'name' => __('bbPress Default', 'bbpress'), 'version' => bbp_get_version(), 'dir' => trailingslashit($this->themes_dir . 'default'), 'url' => trailingslashit($this->themes_url . 'default')));
     // Register the basic theme stack. This is really dope.
     bbp_register_template_stack('get_stylesheet_directory', 10);
     bbp_register_template_stack('get_template_directory', 12);
     bbp_register_template_stack('bbp_get_theme_compat_dir', 14);
 }
Beispiel #3
0
 /**
  * Register bundled theme packages
  *
  * Note that since we currently have complete control over bbp-themes and
  * the bbp-theme-compat folders, it's fine to hardcode these here. If at a
  * later date we need to automate this, and API will need to be built.
  *
  * @since bbPress (r3829)
  */
 public function register_theme_packages()
 {
     /** Default Theme *****************************************************/
     bbp_register_theme_package(array('id' => 'default', 'name' => __('bbPress Default', 'bbpress'), 'version' => bbp_get_version(), 'dir' => trailingslashit($this->plugin_dir . 'bbp-theme-compat'), 'url' => trailingslashit($this->plugin_url . 'bbp-theme-compat')));
     /** Twenty Ten ********************************************************/
     bbp_register_theme_package(array('id' => 'bbp-twentyten', 'name' => __('Twenty Ten (bbPress)', 'bbpress'), 'version' => bbp_get_version(), 'dir' => trailingslashit($this->themes_dir . 'bbp-twentyten'), 'url' => trailingslashit($this->themes_url . 'bbp-twentyten')));
 }