Associating an “author” with a custom taxonomy

I have a custom role, “Ministry Representative”, which is able to log in and create and manage their own “Opportunities” and “Events”, which is each a custom post type.

On the front end of the site, you can filter opportunities or events by “Ministry”, which is a custom taxonomy associated with both the “Opportunities” and “Events” custom post type.

On the backend, I create an account for a “Ministry Representative” to manage what appears on their profile as well as within the filtered results on the “Opportunities” and “Events” index pages.

The Challenge

When a “Ministry Representative” goes to create a new “Event”, they enter the details, and, from the custom taxonomy, they have to choose:

  • Location (a hierarchal custom taxonomy)
  • Presenter (a non-hierarchal custom taxonomy)
  • Ministry (a non-hierarchal custom taxonomy)

So, in essence, they have to choose themselves. John Doe, who is a “Ministry Representative” for “Ministry A”, has to choose his own ministry from a dropdown (a custom meta box via WP Alchemy).

The Ideal Solution

Ideally, when a new “Event” or “Opportunity” is created by John Doe of “Ministry A”, the association is made without any input required on the interface level by the end-user.

So, what I think I’m looking for is a way to associate a user account with a specific term within a custom taxonomy.

Does that make sense? Is there, perhaps, another way to look at the problem? As I’m imagining, I could see other applications which could make this useful. An account is created and when X user contributes a given type of content, pre-selected terms are automatically associated to their contributed content.

Any thoughts or ideas are greatly appreciated. Thank you!

2 Answers
2

I was able to come up with a work around! First, I used Role Scoper to limit a user account to a specific term – in this case, a Ministry Representative is limited to the name of their Ministry in the “ministries” taxonomy. Then, I used the WPAlchemy class to create a custom metabox that would list the terms and, since it only returned one (theirs), I would have it already selected. Next, I hid it via an admin stylesheet.

The effect is that, when a Ministry Representative creates a new Event or Opportunity, their ministry name is already selected (though they don’t see it) and the association is made on save. It requires a bit of work on the part of the admins to setup the term and I would still like a cleaner way of doing the same if it exists.

If anyone would like further details on my work-around, let me know.

Leave a Comment