How to create child/sub user under parent user
How to create child/sub user under parent user
How to create child/sub user under parent user
How to create a dedicated folder for specific role via registration
Solved it for different edit pages for different roles. In my method resposible for rendering the field I have: if ( count( array_intersect( $allowed_editors, $user->roles ) ) < 1 ) $readonly = ‘readonly’; Which I later use to either set the input field as readonly or add/remove classes before rendering it. Still working for the … Read more
change in_array(‘contributor’,$user->roles) to (in_array(‘contributor’,$user->roles) || in_array(‘administrator’,$user->roles))
A quick and dirty way of doing this is by adding a .htaccess file to the wp-admin directory, with the following content. <FilesMatch “^options-(.*)\.php$”> Order Allow,Deny Deny from all </FilesMatch>
Search results show only content by admin post authors
User roles and associated capabilities are all stored in the $prefix_options table in the $prefix_user_roles (note that in both of these $prefix is a variable, so if your $prefix is foo_, your table will be foo_options). You need to sync this value between databases. As far as I’m aware, there is not a way to … Read more
add_action(‘future_to_pending’, ‘send_emails_on_new_event’); add_action(‘new_to_pending’, ‘send_emails_on_new_event’); add_action(‘draft_to_pending’, ‘send_emails_on_new_event’); add_action(‘auto-draft_to_pending’, ‘send_emails_on_new_event’); /** * Send emails on event publication * * @param WP_Post $post */ function send_emails_on_new_event($post) { $emails = “[email protected], [email protected]”; //If you want to send to site administrator, use $emails = get_option(‘admin_email’); $title = wp_strip_all_tags(get_the_title($post->ID)); $url = get_permalink($post->ID); $message = “Link to post: \n{$url}”; wp_mail($emails, “New post … Read more
You can do this by checking if the post author is a contributor and post status is pending before the post is saved. Before the post is saved: add_filter( ‘wp_insert_post_data’, ‘disallow_edit_pending_3748’, 99, 2 ); function disallow_edit_pending_3748( $post_data, $post_array ){ if( ‘pending’ == $post_data[‘post_status’] && current_user_can( ‘contributor’ ) ){ // there’s no other way to do … Read more
I found a hacky solution involving redirecting the user: if ((basename($_SERVER[‘SCRIPT_NAME’]) == ‘edit.php’)) { // your code here $author = wp_get_current_user(); if(isset($author->roles[0])){ $current_role = $author->roles[0]; }else{ $current_role=”no_role”; } if($current_role == ‘ai1ec_event_assistant’ && ($_GET[‘post_type’]==”&&$_GET[‘category_name’]==”)){ header(“Location:/wp-admin/edit.php?category_name=events-list”); } }