Skip to main content
edited tags
Link
fuxia
  • 107.1k
  • 38
  • 255
  • 459
Source Link

Is there a way for users only saved in the contact form 7 database to view a wordpress private page?

Originally, I have it this way, every time a user signs up using the contact form 7 it will give the user a subscriber role allowing it to view the private page. The problem with this one is it keeps creating a new user under the users profile in the admin dashboard and emails the user their own Wordpress username and password and I don't want that. I just want a simple view allowing the users in the contact form 7 database to view that private page. I'm really out of options, can anyone suggest another alternative?

add_action ('admin_init','add_sub_caps');
 
function add_sub_caps() {
    global $wp_roles;
    $role = get_role('subscriber');
    $role->add_cap('read_private_pages');
}