• Resolved razvanfrandes

    (@razvanfrandes)


    Hello,

    I want to hook into the form submission. For example I want to check if the email from the form, matches from a list of emails. And return an error if it doesn’t match.

    I tried buddyforms_update_post_args and buddyforms_after_save_post, but this will already create the post and only after they will do my logic.

    I tried also buddyforms_process_post_start, but this I think is a old hook that doesn’t exists anymore.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Sven Lehnert

    (@svenl77)

    Hi @razvanfrandes yes, you can do browser and server-side custom validation. Please take a look at the documentation on how to create an Ajax request for your custom jQuery validation. https://docs.buddyforms.com/article/692-extend-the-default-validation-with-a-custom-ajax-based-validation

    You can create a custom server site validation or use the inbuilt validation logic. If you are a developer and like to understand the validation, take a look at this Documentation https://docs.buddyforms.com/article/402-validation

    I hope this answer helps you. Please let me know if you have any questions. I like to help.

    Thread Starter razvanfrandes

    (@razvanfrandes)

    Thank you.

    It works.

    I have another question. How I can auto accept and auto login users and skip email verification?

    Can you please guide me?

    Thank you.

    Thread Starter razvanfrandes

    (@razvanfrandes)

    I did this

    function custom_buddyforms_auto_activate_user($post_id) {
    
    ? $user_id = get_post_field('post_author', $post_id);
    
    ? $user = get_user_by('id', $user_id);
    
    ? if ($user) {
    
    ? ? // Remove the activation key for the user to simulate activation.
    
    ? ? delete_user_meta($user_id, 'activation_key');
    
    ? ? // Log the user in.
    
    ? ? wp_clear_auth_cookie();
    
    ? ? wp_set_current_user($user->ID);
    
    ? ? wp_set_auth_cookie($user->ID);
    
    ? }
    
    }
    
    add_action('buddyforms_after_save_post', 'custom_buddyforms_auto_activate_user');
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Before Form Submit’ is closed to new replies.