Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter bostondave08

    (@bostondave08)

    I posted a similar question on Justin Ts post about this topic. I can get the form in the user profile to be checkboxes but have been unable to get it to store multiple selections. Only one at a time.

    Am I missing something.

    Plugin Author Damian Gostomski

    (@gostomski)

    Hi

    Firstly, apologies for taking so long to get back to you… It seems WP.org doesn’t auto alert plugin authors of support requests!

    What you’re after is a feature I plan on adding as soon as I get a spare few hours. (The long term solution would be to make it behave like categories and tags for posts, but for now multi select chockes would be a sufficient solution).

    I’ll hopefully find some time this week to work on it, and will update this thread when I push out an update – Hopefully that’s not too late for your project.

    Hey Damian, I’d love to see your change for handling multi select – planning on using your code for a project and need the multi-select piece. I have some time this week to look at adding it in – but curious if you already have a direction you are going with this?

    If anyone is interested in a fix for this check my replacement of the save_profile method

    /**
     * Save the custom user taxonomies when saving a users profile
     *
     * @param Integer $user_id	- The ID of the user to update
     */
    public function save_profile($user_id) {
    	foreach(self::$taxonomies as $key => $taxonomy) {
    		// Check the current user can edit this user and assign terms for this taxonomy
    		if(!current_user_can('edit_user', $user_id) && current_user_can($taxonomy->cap->assign_terms)) return false;
    		// Save the data
    		$user_terms = ! is_array($_POST[$key]) ? array($_POST[$key]) : $_POST[$key];
    		wp_set_object_terms($user_id, $user_terms, $key, false);
    		clean_object_term_cache($user_id, $key);
    	}
    }

    I’ve created a gist for saving the fields as I continue to work on this https://gist.github.com/3150723

    Plugin Author Damian Gostomski

    (@gostomski)

    Thanks Timothy, great contribution
    I’ll get this patched back into the plugin and update it this weekend

    benjaminniess

    (@benjaminniess)

    Hello,

    Thanks Timothy for your patch.

    It requires a little modification in the user_profile function. The name of the field must finish by [] like this :

    <input type="checkbox" name="<?php echo $key?>[]" id="<?php echo "{$key}-{$term->slug}"?>" value="<?php echo $term->slug?>" <?php checked(true, is_object_in_term($user->ID, $key, $term))?> />

    Hi!

    Thanks for this plugin, this is very useful!
    I managed to make the radio buttons into checkboxes and to implement multiple checks, but is there a way to see the hierarchy of the categories?
    For the moment, all my categories are visible in alphabetical order, be they children of a parent category or not, and I would like to see the children under their parent.
    Thanks in advance for the help ??

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Plugin: User Taxonomies] Allow multiple select for each user taxonomy’ is closed to new replies.