• Resolved mkstebbins

    (@mkstebbins)


    While conditional logic works perfectly for most fields, it seems to not work based on a TextArea “Contains” or “Empty” conditions.

    Specifically, I’m trying to show a checkbox (review my profile) only when a TextArea field (Exam_Scores) contains any character, say, a letter “A”.

    I’m thinking of writing an external php script, triggered every 30 minutes or so, that looks for the letter “A” in the TextArea for each member, and if it’s present, sets the value of hidden checkbox (say ‘hidden_review_checkbox’)in Ultimate Member. I could then set conditional logic based on that hidden checkbox.

    Or, even better, I could write this as a function triggered off of UM Profile update.

    add_action(‘um_before_submit_form_post’, ‘user_updated_profile’, 10, 1 );

    I’m off to write this, but am posting here to see if it triggers (heh, see what I did there?) any warnings or ideas from the community.

    THanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @mkstebbins

    I would do the same approach with the um_before_submit_form_post action hook.

    add_action(‘um_before_submit_form_post’, ‘user_updated_profile’, 10, 1 );
    function user_updated_profile(){
      
        if( isset( $_POST['mymetakey'] ) ){
            if (strpos( $_POST['mymetakey'] , 'A') !== false) {
                 $_POST['hidden_review_checkbox'] = "test 123"; 
            }
        }  
    }
    

    Regards,

    Thread Starter mkstebbins

    (@mkstebbins)

    Thanks @champsupertramp for the affirmation and for the example as well. I’ll implement over the weekend.

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @mkstebbins

    Thanks for letting us know.

    Regards,

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘A hack to get conditional logic to work based on a text area’ is closed to new replies.