Custom Role Broken
-
I was trying to create a custom role using this line of code. But the problem was when I created the role it had no name. Then when I go to edit it I get directed to an error page saying “The requested role to edit does not exist.” I am unable to delete the role. I just want to get rid of the role I created. I was able to get the code to run write but this code gave me the broken role. I am using a form plugin that fill out custom field from the front end so when you hit submit it runs the code below.
function wpufe_update_post_price( $post_id ) { $post_title = get_post_meta( $post_id, 'registration_name', true ); $role = get_post_meta( $post_id, 'registration_name', true ); $email = get_post_meta( $post_id, 'email', true ); $m_password = get_post_meta( $post_id, 'manager_password', true ); $s_password = get_post_meta( $post_id, 'server_password', true ); $k_password = get_post_meta( $post_id, 'kitchen_password', true ); add_role( $role, 'test', get_role( 'restaurant_template' )->capabilities ); wp_create_user( 'manager', $m_password); wp_create_user( 'server', $s_password, $email); wp_create_user( 'kitchen', $k_password, $email); $my_args = array ( 'ID' => $post_id, 'post_title' => $post_title, ); wp_update_post( $my_args ); } add_action( 'wpuf_add_post_after_insert', 'wpufe_update_post_price' );
Viewing 9 replies - 1 through 9 (of 9 total)
Viewing 9 replies - 1 through 9 (of 9 total)
- The topic ‘Custom Role Broken’ is closed to new replies.