WordPress.org

Ready to get started?Download WordPress

Forums

Allow user to edit/view/create their own page only (6 posts)

  1. queenielow
    Member
    Posted 9 months ago #

    Hi There,

    Is there a way without hacking the core to only allow user to edit/view and create their own page in the Dashboard, so they are not able to view other pages that is not created by them?

  2. Rod Whiteley
    Member
    Posted 9 months ago #

    Almost certainly, although I haven't done exactly that myself. A site where users cannot even see the home page would be unusual, so I assume you will also want certain pages to be public.

  3. queenielow
    Member
    Posted 9 months ago #

    Hi Rob,

    Yes only certain page/post type that need to apply this rule. Do u have any idea how to do it?

  4. bcworkz
    Member
    Posted 9 months ago #

    When one publishes a post, it can be set to Private. If this must be mandatory for certain users, hook the 'save_post' action and if the user has (or lacks) a certain capability, change the post_status to private.

  5. Rod Whiteley
    Member
    Posted 9 months ago #

    In general there are three steps for this kind of task.

    1. Assign capabilities to allow users to do whatever you need them to be able to do. In your case you could use the existing Author role or add a new role for these users. They will need to be able to create and publish pages.

    2. Restrict the admin interface so that users cannot do everything their capabilities allow. In your case you would restrict these users to creating and publishing just one page. You can do this by injecting CSS and JavaScript into the admin screens to modify them.

    3. Restrict the back end, so that users cannot hack their way around the restrictions at step 2. For example, in your case you would prevent any user from going to any specially constructed URL that would let them edit someone else's page.

    It is not a simple matter to code all this!

  6. queenielow
    Member
    Posted 9 months ago #

    Thanks guys.
    I have tried using your methods and it work.

    Cheers

Reply

You must log in to post.

About this Topic