Empty members list when editing custom post type metabox
-
Hello, let me describe my problem…
I created custom post type and one of meta fields will be list of buddypress members with chekboxes next ot them. Everything works great when I go to “Add new”, but when using Edit I always get info that no members were found.
<?php /** * Register post type */ add_action('init', 'create_project_post_type'); function create_project_post_type() { register_post_type( 'project', array( 'labels' => array( 'name' => __('Projects'), 'singular_name' => __('Project'), 'add_new' => __('Add New', 'lw_project'), 'add_new_item' => __('Add New Project'), 'edit_item' => __('Edit Project'), 'new_item' => __('New Project'), 'all_items' => __('All Projects'), 'view_item' => __('View Project'), 'search_items' => __('Search Projects'), 'not_found' => __('No projects found'), 'not_found_in_trash' => __('No projects found in Trash'), 'parent_item_colon' => '', ), 'public' => true, 'has_archive' => true, 'query_var' => 'project', 'rewrite' => array( 'slug' => 'projects', 'with_front' => false ), 'supports' => array( 'title', 'editor' ), 'taxonomies' => array( 'category' ) ) ); } /** * Display the metabox */ function project_details_metabox() { global $post; $website = get_post_meta($post->ID, 'website', true); if (!preg_match( "/http(s?)<img src="smileys/irritated.gif" width="" height="" alt=":" title=":" class="bbcode_smiley" />///", $website)) $website = 'http://'; ?> <label for="website">Website:</label> <input id="website" size="40" name="website" value="" /> <label>Associated contributors:</label> <?php $fullname = fullname(true, null, false); if($fullname == 'footnote' || $fullname == 'Guest' || $fullname == 'Joe' || $fullname == 'Jon') continue; ?> <input type="checkbox" name="cont_" value="yes" id, "cont_" . bp_get_member_user_id(), true) == "yes") { echo 'checked="checked"'; } ?>/> <?php } /** * Process the custom metabox fields */ function save_project_details($post_id) { global $post; if ($_POST) { update_post_meta($post->ID, 'website', $_POST); /*foreach($_POST as $key => $value) { echo "POST parameter '$key' has '$value'; }*/ } } // Add action hooks add_action('admin_init', 'add_project_details_metabox'); add_action('save_post', 'save_project_details'); /** * Add meta box */ function add_project_details_metabox() { add_meta_box('projct-details-metabox', __('Project details'), 'project_details_metabox', 'project', 'normal', 'high'); } /** * Get and return the values for the project details */ function get_project_details() { global $post; $website = get_post_meta($post->ID, 'website', true); return array($website); } ?>
Now info about environment:
1. Which version of WordPress are you running? – 3.2.1
2. Did you install WordPress as a directory or subdomain install? – subdomain
3. If a directory install, is it in root or in a subdirectory? – root
4. Which version of BP are you running? – 1.5
5. Do you have any plugins other than BuddyPress installed and activated? If so, which ones? – bbPress, BP Profile Search, BuddyPress Edit User Profiles,
6. Are you using the standard BuddyPress themes or customized themes? – customized
7. If running bbPress, which version? Or did your BuddyPress install come with a copy of bbPress built-in? – 2.0
8. Is your server running Windows, or if Linux; Apache, nginx or something else? – Linux
- The topic ‘Empty members list when editing custom post type metabox’ is closed to new replies.