Title: Undefined variable error
Last modified: May 11, 2026

---

# Undefined variable error

 *  [James Robinson](https://wordpress.org/support/users/imaginarymedia/)
 * (@imaginarymedia)
 * [1 week ago](https://wordpress.org/support/topic/undefined-variable-error-24/)
 * Hi Pierre,
 * For users who login to a site but have no role for the site, an undefined variable
   error occurs.
 * /wp-content/plugins/sessions/includes/system/class-session.php:812
 * An empty $roles array should be declared at the start of the function and unless
   you also insert an additional check here, get_privileges_for_roles() will need
   to deal with the possibility of receiving an empty array as a variable.
 * It’s probably an edge case but I have clients who set users to “No role for this
   site” in order to retain accounts and deny access to member content until subscriptions
   are renewed.
 * Cheers,
 * James

You must be [logged in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fundefined-variable-error-24%2F%3Foutput_format%3Dmd&locale=en_US)
to reply to this topic.

 * ![](https://ps.w.org/sessions/assets/icon-256x256.png?rev=2266516)
 * [Sessions](https://wordpress.org/plugins/sessions/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/sessions/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/sessions/)
 * [Active Topics](https://wordpress.org/support/plugin/sessions/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/sessions/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/sessions/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [James Robinson](https://wordpress.org/support/users/imaginarymedia/)
 * Last activity: [1 week ago](https://wordpress.org/support/topic/undefined-variable-error-24/)
 * Status: not resolved