Support » Plugin: WebLibrarian » Unable to create a user and assign a role

  • Helllo. I’m using a WP multisite installation. I installed the plugin but when I choose the add new user option I have only available the options Subscriber, Contributor, Author, Editor, Administrator, there isn’t a librarian role option. ¿What should I do? Is weblibrarian compatible with a multisite installation?
    Best regards

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Robert Heller

    (@robertpheller)

    >> Is weblibrarian compatible with a multisite installation?

    I don’t know. It has not be tested in a multisite installation.

    I have exactly this issue and it seems like the plugin isn’t quite compatible with a multi-site installation. There is some issue with the way database is handled because it is also preventing me from creating a new Patron from Add New Patron page. I am signed in as a super-user for the multi-site.

    How can I help in providing more debug info?

    After debugging a fair bit in the following two files, database_code.php and WEBLIB_Patrons_Admin.php, I found that database insert was constantly failing.

    However $wpdb->last_query and other class variables weren’t really that useful in telling me the nature of the error or failure to insert.

    Anyway, that made me look into the database itself. As it happens, the reason Add Patron was failing was because of the default(!) type and size of columns are rather too restrictive and small.

    For instance, here in Australia, we have three letter codes for states. Similarly, despite the fact that telephone numbers are being formatted by putting in extra dashes, the database column itself isn’t large enough to accommodate that.

    @robertpheller: Hey mate, try adjusting the lengths of these columns and perhaps use varchar() instead of char(). This way the backend data could still be optimised for storage. However, that won’t really help with existing installs. At least it would be helpful for new install. Though I guess you could update the tables at update time. Not very good with WP plugins.

    • This reply was modified 3 years, 7 months ago by darkfish.caver. Reason: Format corrections
    Plugin Author Robert Heller

    (@robertpheller)

    I have updated the plugin to be less restrictive for phone numbers, zip codes, and states, including allowing empty zip codes and states. I still don’t know what the issues are WRT “multi-site installations”, but otherwise the Add New Patron page is more forgiving, allowing non-USA addresses and phone numbers.

    Brilliant! Thanks mate.
    Will your changes update existing install?

    I haven’t found any other issues so far with a multisite install. However, do note that I have been testing with the base site.
    I could spawn another child site and test it with that.

    Nevertheless, I have partially gone through the code and couldn’t find anything substantial that wouldn’t allow it to work with a multisite install.

    Thanks again.

    Plugin Author Robert Heller

    (@robertpheller)

    Will your changes update existing install?

    I believe so.

    I *think* the only issue with a multisite install would be dealing with the user roles. There might be a permissions type issue (eg what sort of things an administrator of one of the sites under a multisite install might be allowed in terms of what roles he/she can give to his users).

    I *think* the only issue with a multisite install would be dealing with the user roles. There might be a permissions type issue (eg what sort of things an administrator of one of the sites under a multisite install might be allowed in terms of what roles he/she can give to his users).

    I suspected that too. I too have the Librarian role missing. The only roles corresponding to this plugin are: Volunteer and Senior Aid. Also, these roles only appear to me because I am logged in as the Super User.

    According to WP Codex, creating and editing users can only be done by Super Admin.

    So if someone is logged in as a site Admin and NOT Super Admin, then I suspect those roles will not display. It still doesn’t explain why Librarian is missing, but it is of course not limiting me from Adding Patrons and such.

    Checked wp_options table for values in wp_user_roles and only the following is there.
    s:9:"senioraid";a:2:{s:4:"name";s:10:"Senior Aid";s:12:"capabilities";a:4:{s:4:"read";b:1;s:20:"view_admin_dashboard";b:1;s:17:"manage_collection";b:1;s:18:"manage_circulation";b:1;}}s:9:"volunteer";a:2:{s:4:"name";s:9:"Volunteer";s:12:"capabilities";a:3:{s:4:"read";b:1;s:20:"view_admin_dashboard";b:1;s:18:"manage_circulation";b:1;}}

    I suspect adding roles in a Multisite install might be different. Also, I did not activate the plugin Network wide. I only activated it on the primary site.

    There are lots of variables in action here, so not certain why all but one of the roles will not get added.

    While I was writing this, I did some other tests. Created another Admin user for primary site.

    This user, does not get any of the capabilities from this plugin, nor does it get assigned other roles. Hence, all it is able to do is to Edit Patron Info from under Users menu, which allows it to effectively assign itself any of the available Patron IDs. Once it’s been assigned that, it is able to edit patron info, and other menu items appear, such as holds and checkouts.

    What I also found was that manage_patrons capability is missing from the database. As I understand, a role with such cap was never created. Which explains why Librarian role is missing.

    Is this helpful in debugging?

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Unable to create a user and assign a role’ is closed to new replies.