Support » Plugin: CMB2 » Getting “no terms” message in place of select field

  • Resolved catonezillion

    (@catonezillion)


    Hi,

    Thanks for this plugin! I used it to create a meta box for a custom post type. For this post type I select users and assign them to a post, and these users are stored with a custom taxonomy (xxx_uid). So I’d like to display all of the users associated with x_x_uid in the taxonomy select box.

    I’ve set up the meta box for a taxonomy select field and when I use ‘category’ as the taxonomy slug the select box shows all of my tags correctly. But when I replace ‘category’ with the custom taxonomy ‘xxx_uid’ I get the message “No terms.” I registered the custom field and I think I did it correctly, but I could be wrong.

    I’m using the plugin admin columns and I’m able to select the xxx_uid, add it to the post’s admin table, and get it to display the user associated with each post.

    Thanks for any help with this issue,

    Cathy

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Michael Beckwith

    (@tw2113)

    The BenchPresser

    When you say “Users” do you mean the actual WordPress users? or are you referring to some sort of “user” custom post type? I’m wondering if there’s a disconnect between data that you’re not noticing at the moment. Term data stored on one content type, and the metabox trying to query for term data from a different source that doesn’t have any.

    Hi,

    Thanks for getting back to me!

    I do mean regular WP users. The custom post type has categories (I’m not sure if these are the same as default WP categories- they are listed in the database term_taxonomy as xxx_category) and on the category edit page I select a WP user to be assigned to that category. The WP user is not associated with the XXX_uid taxonomy until I assign him/her to a category. So I am just trying to list all of the WP users who I have already assigned to a category.
    When I look in the database table postmeta, the xxx_uid is a meta_key and for each post of the custom post type the WP user’s id # is the meta_value. XXX_uid is not in the databases term_taxonomy, terms, termmeta or usersmeta.
    I understand your question about storage location and the query location but I haven’t been doing this long enough to know if what I’ve just told you means that this is the problem.
    Thanks,
    Cathy

    Plugin Author Michael Beckwith

    (@tw2113)

    The BenchPresser

    Not quite sure how you’re assigning users to a category, unless this is all term meta data. If that’s the case, then you’ll need to figure out how to populate the dropdowns with that data. As is, I believe it’s trying to find terms based on assignment to posts, not users. Thus why it’s coming back with “no terms found”

    Hi Michael,

    Thanks for the help with this- I don’t really know how I’m assigning users either. Maybe it is all term meta data.

    I just thought of another approach- all users who are assigned to xxx_uid are also assigned a unique WP role. I tried using the slug of the role in place of XXX_uid and got the error “invalid taxonomy.” Is there a way to display a drop-down list of all users with a certain role?

    Thanks,

    Cathy

    Plugin Author Michael Beckwith

    (@tw2113)

    The BenchPresser

    You could piece together a regular select and fill in the options as appropriate: https://github.com/CMB2/CMB2/wiki/Field-Types#select

    This would be in place of the taxonomy_select I infer you are presently using.

    Hi Michael,

    Thanks for the tip. I’ll give that a try and see how it goes.

    Cathy

    Plugin Author Michael Beckwith

    (@tw2113)

    The BenchPresser

    Welcome.

    Plugin Author Michael Beckwith

    (@tw2113)

    The BenchPresser

    Just wanted to check in and see if there’s anything lingering @catonezillion

    Hi Michael,

    Thanks for checking in! I’m still trying to get this figured out.

    Cathy

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Getting “no terms” message in place of select field’ is closed to new replies.