• Resolved Dervila

    (@dervila)


    I need to run a function right after the user hits the “trash” button on a custom post. {$old_status}_{$new_status} won’t help because those and their relations fire after the custom post is trashed. I need the function to run before the custom post is trashed.

    Here’s the detailed explanation: I have a list of members of a group, where the member custom post was created with the Pods plugin. My users are members of that group, and so have access to the list so they can create/modify/delete their data. Some of my users are barely computer literate, and easily confused. I don’t want a user trashing someone else’s post When a user hits the “trash” button on a given member custom post, I hope to run a function that compare’s the current user’s user id to the member post’s user id. If they don’t match, access will be denied.

    I have looked all over the WordPress site, and even looked through the hooks listed for WordPress 3.9 on Adam Brown’s site. I’m afraid I’m stuck.

Viewing 3 replies - 1 through 3 (of 3 total)
  • What role do your members have? You should be able to reduce their role or modify their capabilities so that they can only edit/delete their own posts.

    Thread Starter Dervila

    (@dervila)

    My users are all authors so they can post to the blog, which is really more of a forum.

    I hadn’t thought of changing their capabilities. I’ll look into that. Thanks.

    Thread Starter Dervila

    (@dervila)

    I have been an idiot.

    Either Pods or WordPress already prevents a user from trashing other user’s members. I hadn’t tested the situation as a normal user until now. May others learn from my mistake.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Need hook which fires when user hits "trash" button on custom post’ is closed to new replies.