How to set privilege to wordpress subscriber for private page

Without a plugin something like this should work //functions.php function get_user_role() { global $current_user; $user_roles = $current_user->roles; $user_role = array_shift($user_roles); return $user_role; } //page template $role = get_user_role(); if($role == “subscriber”){ //cool you can see this } else { //sorry not allowed } A BETTER way would be to use something like the Members Plugins … Read more

Forbid contributors viewing drafts

Yes, but you might need a plugin like ‘User Role Editor‘. You can then edit the capabilities of roles, including contributors. So they can edit their own posts/drafts, but not the posts/drafts of others you should ensure that core capabilities: edit_posts is checked. edit_others_posts is unchecked

One time username change from frontend?

Just add a meta record that tracks the state of the username-changing actions: $user = wp_get_current_user(); $did_one_change = get_user_meta($user->ID, ‘changed_username’, true); if($did_one_change !== false) wp_die(‘You already changed your user name once!’); wp_update_user(array( ‘ID’ => $user->ID, ‘first_name’ => $_POST[‘first_name’], ‘last_name’ => $_POST[‘last_name’], )); // here add a meta entry that suggests the user has changed their … Read more

How to allow editor to edit privacy page / settings only?

Editing the privacy policy page is restricted to manage_privacy_options as pointed out in a comment in the WordPress core file wp-includes/capabilities.php: /* * Setting the privacy policy page requires `manage_privacy_options`, * so editing it should require that too. */ if ( (int) get_option( ‘wp_page_for_privacy_policy’ ) === $post->ID ) { $caps = array_merge( $caps, map_meta_cap( ‘manage_privacy_options’, … Read more

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