• Resolved hnbraymund

    (@hnbraymund)


    Hi. what if I do something like this is the backend

    <?php
    $enc_user = wp_get_current_user();
    $user_role = json_encode($enc_user->roles);
    echo gettype($user_role);
    echo $user_role;

    if ($user_role == ‘[“subscriber”]’ || $user_role == null){
    echo “saadsa”;
    [[ultimatemember form_id=”79″]] /* what syntax should I place here so it will actually display on my frontend? */
    } else {
    echo “saaaa”;
    }
    ?>

    thank you so much for your response.

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

    (@champsupertramp)

    Hi @hnbraymund

    It’s not clear what do you want to achieve with the code. Do you want to create a custom shortcode to add it to pages and display the shortcode [ultimatemember form_id=”79″] ?

    Regards,

    Thread Starter hnbraymund

    (@hnbraymund)

    Hi. @champsupertramp I want to do something like this. I want to display the form when a certain condition is meet. but I don’t know the syntax on how can I call the form itself. Please see the link. this is a screenshot on the code and as you can see there, it was marked as syntax error. https://drive.google.com/file/d/1Sfts3qf9Sc_Gkj_YrE0y3jIk_5HoftEW/view?usp=sharing

    thank you so much!

    • This reply was modified 4 years, 5 months ago by hnbraymund.
    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @hnbraymund

    Please try this code snippet:

    <?php
    $enc_user = wp_get_current_user();
    $user_role = json_encode($enc_user->roles);
    echo gettype($user_role);
    echo $user_role;
    
    if ($user_role == ‘[“subscriber”]’ || $user_role == null){
    echo “saadsa”;
    
      $value = "[ultimatemember form_id='79']";
      if ( version_compare( get_bloginfo('version'),'5.4', '<' ) ) {
       echo do_shortcode( $value );
      } else {
       echo apply_shortcodes( $value );
      }
    } else {
    echo “saaaa”;
    }
    ?>

    Regards,

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @hnbraymund

    …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,

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘call out shortcode on wp backend’ is closed to new replies.