Home›Topic Tag: Controlling access to content editing
Topic Tag: Controlling access to content editing
Access plugin allows you to control access to content editing for different users. You can set access rules for entire user types or for specific users.
When you ask for help or report issues, make sure to tell us on which content and user types you are trying to apply access control.
Viewing 15 topics - 196 through 210 (of 218 total)
Problem: I would like to programmatically change the post status of all posts by the current User in a PHP hook I have set up to handle User role changes.
Solution: You can use the WordPress get_posts function to query all the author's posts, then update each of the posts as needed with wp_update_post. Here is a basic example:
...
$user->set_role( 'tsn_bronze' );
// get all the published Voyage posts by the current user
$args = array(
'post_type' => 'voyage',
'post_status' => 'publish',
'author' => $user_id,
'posts_per_page' => -1);
$posts_array = get_posts($args);
// loop over those posts and update each one to status "pending"
foreach ($posts_array as $the_post) {
$update_post = array(
'ID' => $the_post->ID,
'post_status' => 'pending'
);
wp_update_post( $update_post );
}
If you want to use the same code to update posts of more than one custom post type, modify the 'post_type' argument to use an array instead of a single string:
Problem: I would like to restrict edit access to some posts using categories.
Solution: Access can restrict User access based on User role and post group, but not post category (or categories). Post Groups and custom User roles might work but you can only assign one Group to any Post, and only one Role to any User. If you have multiple combinations of post permissions this might not be an option. If your Users are only editing posts with CRED, then you can use conditional HTML or CRED conditionals to show or hide specific content depending on some criteria of the current User, like a custom field value. Store some value in the User's custom field and check that value to determine whether or not to show them a specific CRED form.
The readonly attribute only works for text controls, not select fields or checkboxes and so forth. If you want to show the values of those fields, you can use the standard types field shortcode like this:
Problem:
The issue here is that the user wanted to setup and automatic parent connection in CRED. This means that when the form is submitted, the parent is automatically assigned. Solution:
Actually this is possible if you were to use the CRED child post link on your Parent page after its created
Take a look at this link below for assistance on how to set this up.
When a account is created and try and sign in, the password I've set is not being recognised?
Solution:
Edit the CRED form for creating users, in section "Content", click button "Auto-Generate Form", disable option "Autogenerate Password", and save the CRED form.
Problem:
How to grant Edit permission to a taxonomy "career categories" as a user with a custom Role "HR Manager". This custom Role has the taxonomy "career categories" all items checked but I get the "Cheatin’ uh? Sorry, you are not allowed to edit this item."
Solution:
We are unable to reproduce this issue at the moment. If you see the issue, please feel free to open a new ticket.