• Resolved efquintana

    (@efquintana)


    One of my clients has been using your plugin for several years to show / hide menus according to the courses that each user has contracted.

    To do this, she uses various conditionals of the plugin, including wc_memberships_is_user_active_member ($ user_id, xxxx), where xxxx is the ID of the contracted plan (course).

    Everything has always worked correctly, but since some time (I detected it today but I don’t know since when it happens) it’s failing and for each occurrence of that function, in the front end it returns “Undefined variable: user_id”

    How can I fix this error and get the menu to display normally again?

    Thanks in advance.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author shazdeh

    (@shazdeh)

    Hi!

    If $user_id is a global variable, you can access it in the field using $GLOBALS array, so for example to get the current WP version you could do:

    
    $GLOBALS['wp_version']
    
    Thread Starter efquintana

    (@efquintana)

    I was just coming to comment that I could fix it (apparently) with get_current_user_id ()
    If I detect any more errors, I will try as you indicate.

    Thank you very much.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Woocommerce Memberships conditional issue’ is closed to new replies.