/** * register post form for Posting/editing * @return type */ public function register_form() { //make sure the Front end simple post plugin is active if (!function_exists('bp_new_simple_blog_post_form')) { return; } $post_status = buddyblog_get_option('post_status'); $user_id = get_current_user_id(); if (!buddyblog_user_can_post($user_id)) { $post_status = 'draft'; } $settings = array('post_type' => buddyblog_get_posttype(), 'post_status' => $post_status, 'comment_status' => buddyblog_get_option('comment_status'), 'show_comment_option' => buddyblog_get_option('show_comment_option'), 'custom_field_title' => '', 'custom_fields' => array('_is_buddyblog_post' => array('type' => 'hidden', 'label' => '', 'default' => 1)), 'upload_count' => 0, 'has_post_thumbnail' => 1, 'current_user_can_post' => current_user_can(buddyblog_get_option('post_cap'))); if (buddyblog_get_option('enable_taxonomy')) { $taxonomies = array(); $tax = buddyblog_get_option('allowed_taxonomies'); if (!empty($tax)) { foreach ((array) $tax as $tax_name) { $view = 'checkbox'; //is_taxonomy_hierarchical($tax_name); $taxonomies[$tax_name] = array('taxonomy' => $tax_name, 'view_type' => 'checkbox'); } } if (!empty($taxonomies)) { $settings['tax'] = $taxonomies; } } //use it to add extra fields or filter the post type etc $settings = apply_filters('buddyblog_post_form_settings', $settings); bp_new_simple_blog_post_form('buddyblog-user-posts', $settings); // the blog form }
/** * register post form for Posting/editing * @return type */ public function register_form() { //make sure the Front end simple post plugin is active if (!function_exists('bp_new_simple_blog_post_form')) { return; } $post_status = 'draft'; $user_id = get_current_user_id(); $group_id = bp_get_current_group_id(); $settings = array('post_type' => bcg_get_post_type(), 'post_author' => $user_id, 'post_status' => $post_status, 'comment_status' => 'open', 'show_comment_option' => false, 'custom_field_title' => '', 'custom_fields' => array('_is_bcg_post' => array('type' => 'hidden', 'label' => '', 'default' => 1)), 'tax' => array(bcg_get_taxonomy() => array('include' => bcg_get_categories($group_id))), 'upload_count' => 3, 'has_post_thumbnail' => 1, 'current_user_can_post' => bcg_current_user_can_post(), 'update_callback' => array($this, 'on_save')); //use it to add extra fields or filter the post type etc $settings = apply_filters('bcg_form_args', $settings); $form = bp_new_simple_blog_post_form('bcg_form', $settings); }