Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8959777
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:31:12+00:00 2026-06-15T15:31:12+00:00

I am designing a plugin that need to assign users to a particular post

  • 0

I am designing a plugin that need to assign users to a particular post (of a custom type).

For instance, I have a custom post type: ClassifiedFile

For posts of that type, I will need somewhere in the interface to assign users to it, each having different capabilities. In that case, that could be:

  • Reviewers assigned to a particular classified file can read it and mark it as approved
  • Readers assigned to a particular classified file can only read it
  • Or course, readers and reviewers do not have access to other classified files than the ones they are allowed to see.
  • Managers who can assign Reviewers and Readers to classified files
  • PluginAdmin who can assign Managers to classified files

Ideally, the solution should lend to efficient requests of the type:

  • I want to list all classified files a user can read (be it as reviewer or as reader).

So far :

  • I have stored a few particular properties in the meta data of the post (such as the approval status).
  • I have created custom capabilities : “plugin-admin”, “manage-file-users”, “approve-file” and “read-file”
  • I provide two custom roles for that : File Group Manager (“plugin-admin”), File Group Manager (“manage-users”) , File Reviewer (“approve-file”, “read-file”) and File Reader (“read-file”)

I must say I am struggling to find a nice way to address the listing and storing of priviledges per classified file. Ideally I’d like to avoid having to create a separate DB table but if that is the way to do it then I’ll do that.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T15:31:13+00:00Added an answer on June 15, 2026 at 3:31 pm

    Assigning roles was not much a problem, the question was more a matter of where and how to store the information.

    I have decided to do that:

    • I define groups (which are in fact WP_Role objects) which are common to all ClassifiedFile
    • For each ClassifiedFile, I store a meta value which is an array of strings containing the role and id of a user. For instance: [ reviewer|50|, reader|123|, reader|13| ]
    • I can then query all ClassifiedFile of a particular user using the criteria:

      ‘meta_query’ => array( array(
      ‘key’ => ‘users’,
      ‘value’ => ‘|’ . $user_id . ‘|’,
      ‘compare’ => ‘LIKE’
      ))

    • Or using a group:

      ‘meta_query’ => array( array(
      ‘key’ => ‘users’,
      ‘value’ => $group . ‘|’ . $user_id . ‘|’,
      ‘compare’ => ‘=’
      ))

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm designing a WPF program that will use a DLL-plugin architecture. The host application
I have a unique issue - I am designing a web application that creates
I'm designing an application that supports plugin development. Its more of a learning exercise.
I'm designing a web site where I've got a blog post and have the
I am currently developing a rather complex jQuery plugin. One that I am designing
I'm designing an application that will benefit from having the user's Facebook friends suggested
When designing a C API for configuring a library/utility, I have a co-worker who
Im designing a website, and often I need to present information in a nice
When designing a form I have the option of putting a close button at
Are there any tools/Firefox plugins that will allow you to drag elements (divs, images

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.