Title: Negative PHP code not working
Last modified: September 6, 2023

---

# Negative PHP code not working

 *  Resolved [jkendallglei](https://wordpress.org/support/users/jkendallglei/)
 * (@jkendallglei)
 * [2 years, 8 months ago](https://wordpress.org/support/topic/negative-php-code-not-working/)
 * 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](https://wordpress.org/support/users/jhorowitz/)
 * (@jhorowitz)
 * [2 years, 8 months ago](https://wordpress.org/support/topic/negative-php-code-not-working/#post-17031325)
 * Hi [@jkendallglei](https://wordpress.org/support/users/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?
 *     ```wp-block-code
       !is_subscribed_to_any_memberful_plan( wp_get_current_user()->ID )
       ```
   
    -  This reply was modified 2 years, 8 months ago by [Jonathan Horowitz](https://wordpress.org/support/users/jhorowitz/).
      Reason: Clarity
 *  Thread Starter [jkendallglei](https://wordpress.org/support/users/jkendallglei/)
 * (@jkendallglei)
 * [2 years, 8 months ago](https://wordpress.org/support/topic/negative-php-code-not-working/#post-17034210)
 * That works! Thank you so much, Jonathan!! : D
 *  Plugin Author [Jonathan Horowitz](https://wordpress.org/support/users/jhorowitz/)
 * (@jhorowitz)
 * [2 years, 8 months ago](https://wordpress.org/support/topic/negative-php-code-not-working/#post-17034232)
 * 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.

 * ![](https://ps.w.org/content-visibility-for-divi-builder/assets/icon-256x256.
   png?rev=1359961)
 * [Content Visibility for Divi Builder](https://wordpress.org/plugins/content-visibility-for-divi-builder/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/content-visibility-for-divi-builder/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/content-visibility-for-divi-builder/)
 * [Active Topics](https://wordpress.org/support/plugin/content-visibility-for-divi-builder/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/content-visibility-for-divi-builder/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/content-visibility-for-divi-builder/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Jonathan Horowitz](https://wordpress.org/support/users/jhorowitz/)
 * Last activity: [2 years, 8 months ago](https://wordpress.org/support/topic/negative-php-code-not-working/#post-17034232)
 * Status: resolved