Skip to:
Content
Pages
Categories
Search
Top
Bottom

buddypress bp_core_add_message() doesn't fire why?

  • @vimes1984

    Participant

    Ok I have the following php which work ok as in it run through to the IF but no matter what i do I can’t get the bp_core message to fire on screen it just gives me the changes saved message…
    why what am i doing wrong!

    function valid_postcode ($self) {
    $getFieldID = $self->field_id;
    $PostCodeFieldID = 23;
    $postcodecheck = $_POST[‘field_23’];
    if ( $getFieldID == $PostCodeFieldID || $postcodecheck == ”){

    $GetValuePost = $self->value;

    $regex = ‘/[a-z][0-9][a-z][- ]?[0-9][a-z][0-9]$/i’;

    if(!preg_match($regex, $GetValuePost)) {

    bp_core_add_message( __( ‘That Postcode is invalid. Check the formatting and try again.’, ‘buddypress’ ), ‘error’ );

    }elseif (!isset($getFieldID)) {

    bp_core_add_message( __( ‘You need to fill out the post code.’, ‘buddypress’ ), ‘error’ );

    }
    }

    }
    add_action( ‘xprofile_data_before_save’, ‘valid_postcode’, 1, 1 );

  • The topic ‘buddypress bp_core_add_message() doesn't fire why?’ is closed to new replies.
Skip to toolbar