disable trashability for certain pages

Add this to your functions.php in your theme folder: function restrict_post_deletion($post_ID){ $user = get_current_user_id(); $restricted_users = array(21,25,54,2,19); $restricted_pages = array(2,21,52,64); if(in_array($user, $restricted_users) && in_array($post_ID, $restricted_pages)){ echo “You are not authorized to delete this page.”; exit; } } add_action(‘wp_trash_post’, ‘restrict_post_deletion’, 10, 1); add_action(‘wp_delete_post’, ‘restrict_post_deletion’, 10, 1); Taken from here and updated to the latest WP version.

Hide user fields based off capability

This filter needs to return something. Try this function modify_contact_methods($profile_fields) { if(current_user_can(‘edit_users’)) { // Field addition and removal will be done here // Add new fields $profile_fields[‘company_name’] = ‘Company Name’; $profile_fields[‘company_id’] = ‘Company ID’; } return $profile_fields; } add_filter(‘user_contactmethods’, ‘modify_contact_methods’);

Custom User Role

Okay, so I have done it. Reading about roles and capabilities: http://codex.wordpress.org/Roles_and_Capabilities A default set of capabilities is pre-assigned to each role, but other capabilites can be assigned or removed using the add_cap() and remove_cap() functions. New roles can be introduced or removed using the add_role() and remove_role() functions. Add a capability: http://codex.wordpress.org/Function_Reference/add_cap If you … Read more

Add role and edit page capabilities

The edit_pages capability only allows a user to edit his own unpublished pages. It does neither allow to edit others pages (this would require the edit_others_pages capability) nor does it allow to publish or edit published pages (capabilities: publish_pages and edit_published_pages). I’d strongly recommend having a look on this wonderful table: https://codex.wordpress.org/Roles_and_Capabilities#Capability_vs._Role_Table listing up all … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)