• Resolved jkendallglei

    (@jkendallglei)


    I am using this code with your plugin to show Divi modules based on this criteria and it’s working well:

    $user_id = wp_get_current_user()->ID; is_subscribed_to_any_memberful_plan( $user_id )

    However, when I try to use the “negative” version to show content to a user who does NOT have a plan it doesn’t work:

    $user_id = wp_get_current_user()->ID; !is_subscribed_to_any_memberful_plan( $user_id )

    Any thoughts on why the second example with the exclamation point would not be working, when the one without exclamation works fine?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Jonathan Horowitz

    (@jhorowitz)

    Hi @jkendallglei,

    I have not tried to place multiple php statements in the expression; usually I recommend calling a single function, and if you need multiple lines of php, defining them as a function in your theme’s functions.php and calling the function in the expression field.

    Could you try instead using a single statement, like this?

    !is_subscribed_to_any_memberful_plan( wp_get_current_user()->ID )
    Thread Starter jkendallglei

    (@jkendallglei)

    That works! Thank you so much, Jonathan!! : D

    Plugin Author Jonathan Horowitz

    (@jhorowitz)

    Glad I could help! ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Negative PHP code not working’ is closed to new replies.