• Resolved garrett0

    (@garrett0)


    I want to add status for member in profile and it won’t show in registration form, this status can be voted(select Yes or No) by 5 different admin.
    In my Profile Form,I have 5 radios and 3 content blocks, each radio has 2 option Yes and No, the content of content blocks are “Pending”, “Pass”, “Not Pass” respectively.
    If None of radios get selected, the Pending Content block will show.
    If one of radio select No, the Not Pass Content block will show.
    If over 3 radio select Yes and none of radio select No, the Pass Content will show.
    How should I configure my conditional logic?
    My current configuration is:
    Pending Context Block
    show if radio_1 empty
    show if radio_2 empty
    show if radio_3 empty
    show if radio_4 empty
    show if radio_5 empty

    Not Pass Context Block
    show if radio_1 contains No
    show if radio_2 contains No
    show if radio_3 contains No
    show if radio_4 contains No
    show if radio_5 contains No

    Pass Context Block
    hide if radio_1 contains No
    hide if radio_2 contains No
    hide if radio_3 contains No
    hide if radio_4 contains No
    hide if radio_5 contains No

    With above configuration, the pending shows before I update the profile.
    If I select No on radio_1 and update the profile first, it shows Not Pass.
    But when I select another radio option with Yes,after updating the profile it shows Not Pass and Pass at the same time.
    Is there a better solution to build a status in member profile with custom condition(like make a custom shortcode)?
    Or should I connect with other third party plugins to build this status function? (I also try ACF checkbox but it doesn’t appear in UM profile)

    • This topic was modified 2 years, 7 months ago by garrett0.
    • This topic was modified 2 years, 7 months ago by garrett0.
Viewing 4 replies - 1 through 4 (of 4 total)
  • @garrett0

    You can try this shortcode [my_um_content_blocks]:

    add_shortcode( 'my_um_content_blocks', 'my_um_content_blocks_function' );
    
    function my_um_content_blocks_function( $atts ) {
    
        $pending_content = true;
        $count_no = 0;
        $count_yes = 0;
        for ( $x = 1; $x <= 5; $x++) {
            $radio = um_user( 'radio_' . $x );
            if( !empty( $radio[0] )) $pending_content = false;
            if( $radio[0] == 'No' )  $count_no++;
            if( $radio[0] == 'Yes' ) $count_yes++;
        }
        if( $pending_content ) return 'Pending Content';
        if( $count_no > 0 )    return 'Not Pass Content';
        if( $count_yes > 3 )   return 'Pass Content';
        else return 'Voting in progress';
    }

    Add the shortcode to your UM User Profile Form.

    Install by adding the code snippet to your child-theme’s functions.php file
    or use the “Code Snippets” Plugin

    https://www.ads-software.com/plugins/code-snippets/

    @garrett0

    Use this code snippet, PHP didn’t like my coding in the first code snippet:

    add_shortcode( 'my_um_content_blocks', 'my_um_content_blocks_function' );
    
    function my_um_content_blocks_function( $atts ) {
    
        $pending_content = true;
        $count_no = 0;
        $count_yes = 0;
        for ( $x = 1; $x <= 5; $x++) {
            $radio = um_user( 'radio_' . $x );
            if( !empty( $radio[0] )) {
                $pending_content = false;
                if( $radio[0] == 'No' )  $count_no++;
                if( $radio[0] == 'Yes' ) $count_yes++;
            }
        }
        if( $pending_content ) return 'Pending Content';
        if( $count_no > 0 )    return 'Not Pass Content';
        if( $count_yes > 3 )   return 'Pass Content';
        return 'Voting in progress';
    }
    Plugin Support Ultimate Member Support

    (@ultimatemembersupport)

    Hey there!

    This thread has been inactive for a while so we’re going to go ahead and mark it Resolved.

    Please feel free to re-open this thread by changing the Topic Status to ‘Not Resolved’ if any other questions come up and we’d be happy to help. ??

    Regards,

    Thread Starter garrett0

    (@garrett0)

    @missveronicatv
    I tried your shortcode in my UM User Profile Form and it works!
    I’m very appreciate it! Thank you very much!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘show content block by multiple conditional logic’ is closed to new replies.