Skip to:
Content
Pages
Categories
Search
Top
Bottom

Profile field Validation


  • sunil1988lits
    Participant

    @sunil1988lits

    Is there a way to validate the file type fields, before the saving to db. I am using this hook but it’s not working add_action( ‘xprofile_data_before_save’, ‘validate_required_unshared_fields’);

Viewing 1 replies (of 1 total)

  • ladypersonal11
    Participant

    @ladypersonal11

    To validate file type fields before saving to the database, ensure you are using the correct hook and validation logic. The xprofile_data_before_save hook is intended for profile data in BuddyPress, but your issue might be with the validation function itself. Verify that your validate_required_unshared_fields function is properly defined and hooked. Additionally, check that you are correctly accessing and validating the file type fields within this function. Ensure your function looks something like this:

    php
    Copy code
    function validate_required_unshared_fields($field) {
    // Add your validation logic here
    if (/* validation fails */) {
    // Handle validation failure
    }
    }
    add_action(‘xprofile_data_before_save’, ‘validate_required_unshared_fields’);
    Make sure to replace the placeholder comments with your actual validation logic.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.
Skip to toolbar