WordPress.org

Ready to get started?Download WordPress

Forums

User Taxonomies
Allow multiple select for each user taxonomy (8 posts)

  1. bostondave08
    Member
    Posted 2 years ago #

    I tried looking for this in the plugin code but could not get it to change on the edit user panel in the admin. I would like to allow users to select multiple tags instead of just one as in the example. This could be easy but any help appreciated.

    http://wordpress.org/extend/plugins/user-taxonomies/

  2. bostondave08
    Member
    Posted 2 years ago #

    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.

  3. Damian Gostomski
    Member
    Plugin Author

    Posted 2 years ago #

    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.

  4. Timothy Wood
    Member
    Posted 2 years ago #

    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?

  5. Timothy Wood
    Member
    Posted 2 years ago #

    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

  6. Damian Gostomski
    Member
    Plugin Author

    Posted 2 years ago #

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

  7. benjaminniess
    Member
    Posted 1 year ago #

    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))?> />

  8. GwennR
    Member
    Posted 1 year ago #

    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 :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags