WordPress.org

Forums

Nonprofit Board Management
[resolved] USER ID = 0 when Board Member user type set (7 posts)

  1. pmk
    Member
    Posted 1 year ago #

    Hi,

    When I set a user to a "Board Member" the user ID is set to 0 even though they've logged in. And when I make them a normal user their user ID is normal.

    this is only a recent occurrence.

    cheers
    pmk

    https://wordpress.org/plugins/nonprofit-board-management/

  2. wiredimpact
    Member
    Plugin Author

    Posted 1 year ago #

    Thanks for reaching out pmk and I'm sorry you're running into issues. Can you give me an idea of where you're seeing the user ID as 0? And when you talk about setting them to a "normal" user, are you referring to setting their role to administrator, editor, author, etc.?

  3. pmk
    Member
    Posted 1 year ago #

    I'm seeing the user ID = 0 when I enter the following code to test

    'wp_get_current_user();
    $cpdUserID = $current_user->ID;
    print "<P>cpdUserID: ".$cpdUserID; '

    I am using WP-filebase pro and set a category to Board Member. This was only visible to the user types of Board Member and it worked quite well. I'm not sure when it stopped but it has. When a user has a Board Member type, their userid=0. As such they don't have access to anything.

    When I change them to a subscriber or any other user type then their userid = their ID.

  4. wiredimpact
    Member
    Plugin Author

    Posted 1 year ago #

    Thanks for clarifying pmk. Unfortunately, what you're dealing with could be caused by a number of different things.

    First, I would try disabling all the plugins except for Nonprofit Board Management and switching to a default theme. Then see if you still get the error.

    Second, I would make sure that the code being run is only done in the WordPress admin, since most of our plugin's code does not run on the frontend of the website.

    Third, I would try a few different hooks in WordPress to see if this changes the result. If the rest of the plugin's code is working then it means the current user ID is being output, so this might indicate it's not available on the hook being used.

    Fourth, there is a bug in WordPress that has to do with user levels and custom roles. It seems unlikely to be the cause here, but it's worth looking into. You can find that at https://core.trac.wordpress.org/ticket/16841.

    Let me know how these steps work out and we can go from there.

    Good luck.

    Jonathan

  5. wiredimpact
    Member
    Plugin Author

    Posted 1 year ago #

    I'm going to go ahead and mark this as resolved. If you have any other questions don't hesitate to reach out. Thanks pmk.

    Jonathan

  6. pmk
    Member
    Posted 1 year ago #

    Hey Jonathan,

    My apologies for not getting back to you, but I've spent hours working on this and it points back to an issue with this plugin. I tried all the basic things like removal of plugins and themes before you suggested it and MANY other possible solutions. But it still comes back to the board member user type having a userid of 0.

    In light of the huge amount of time spent working on this we've decided to cut our losses and try another solution.

    cheers
    pmk

  7. wiredimpact
    Member
    Plugin Author

    Posted 1 year ago #

    Hi pmk, I'm sorry to hear you weren't able to figure out the specific cause. Can you give me an idea of how to replicate the issue so we can take a look?

    Jonathan

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Nonprofit Board Management
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.