• Hey,
    i am using a hook for CF7 and it is as follows –
    it add roles to user after submitting specific role , and if the user has that role it skips the process.
    I have even tried doing some other processes with the hook but they dont work.
    Code is as follows –
    add_action(“wpcf7_posted_data”, “ccdit”,10, 1 );
    function ccdit($cf7) { $wpcf7 = WPCF7_ContactForm::get_current();
    if($wpcf7->id == 505) {
    $u = wp_get_current_user();
    if ( in_array( ‘verifiedcustomer’, (array) $u->roles ) ) {
    //skip
    }
    else{
    $u->add_role( ‘verifiedcustomer’ );
    }}}

  • The topic ‘Code Snippets not working’ is closed to new replies.