I want to update user meta after the user submits a form. function updateUserType(){update_user_meta works as expected alone, however it does not work when the form is called with do_shortcode.
echo do_shortcode('[contact-form-7 id="031c4e8" title="Dosya"]');
add_action( 'wpcf7_before_send_mail', 'updateUserType');
function updateUserType() {
$user_idd = get_current_user_id();
update_user_meta( $user_idd, '_user_type', 'general' ) ;}
Using the CF7 Meta field 'current_user_id' would return the user id whether it's called via
do_shortcodeor otherwise. You could add a 'subscriber_mode:on' to the extra settings in the form to prevent non-logged in users from completing the form if you wanted to.This has been tested and works.