Notify users on user import through Users XML Plugin import

On the “Import and export users” section of the Data Import and Export page of the documentation, it says this:

  • If you allow the system to generate passwords for the users you are uploading, you can optionally allow the system to email the users with their account credentials. This option can be found on the Users XML Plugin Page (“Send a notification email to each imported user containing the user’s username and password.”).

This seems inaccurate. Even on the latest version of OJS 3.1.2.1, there is no option in the Users XML Plugin page to notify users on import. Also, it does not seem possible to allow the plugin to generate a password on import. You can’t even import anybody unless you include the password element and a value. If I don’t include the password element in the XML, it says that it’s required and errors. If I just include <password/>, it requires children elements (Element '{http://pkp.sfu.ca}password': Missing child element(s). Expected is ( {http://pkp.sfu.ca}value ).). If I include <password><value/></password> it imports successfully, but what does it set the password to? Also, it doesn’t send any notification to the imported user. According to https://github.com/pkp/pkp-lib/issues/2166 notifications have been implemented as of 3.1.2.

What is the proper way to format the XML file so that it auto-generates a password, and sends the user a notification on import like the documentation suggests?

Thanks!

Thanks for posting this @dalemoore. I am running into the exact same issue. Is there an answer to this question?

I am running a new installation of OJS 3.1.2-1 from the OJS downloads page.

When I import a user using the XML below (but with a real email address), I get a message that says a notification was sent to the email address. However, no email is received. I am using Gmail SMTP to send emails, and no email is present in the email account’s Sent box. The user is imported into OJS, and when I send a test email from the Users page, it is successfully delivered.

        <user>
            <givenname locale="en_US">Test</givenname>
            <familyname locale="en_US">User</familyname>
            <country>US</country>
            <email>xxxxxx@gmail.com</email>
            <username>test-user-gmail</username>
            <password encryption="plaintext" is_disabled="false" must_change="true">
                <value>TestPassword987</value>
            </password>
            <date_registered>2018-01-05 07:23:37</date_registered>
            <date_last_login>2019-08-04 18:46:17</date_last_login>
            <inline_help>true</inline_help>
            <user_group_ref>Reader</user_group_ref>
        </user>
  • Import/Export errors:
    The imported user “test-user-gmail” password could not be imported as is. A new password is been send to the user email. The user has been imported.

Hi @douglas_bruey,

I added a response to your duplicate post in the git issue: https://github.com/pkp/pkp-lib/issues/2166#issuecomment-521001799

This forum is the best place to post questions like this, and please just keep to a single venue rather than posting duplicates – otherwise it’s hard to keep things organized.

Thanks!
Alec Smecher
Public Knowledge Project Team

Hi @asmecher,

Thank you for the reply, and sorry for the double post.

I think I have figured out the issue. I had imported my test user with an older version of OJS (without notifications) and then removed the user from the Users page. Appropriately, my test user was removed from all roles, but persisted in the database. The code you pointed me UserXmlPKPUserFilter.inc.php only sends a notification if the user being imported does not already exist in the database. However, the error produced by the call to importUserPasswordValidation says that an email was sent, regardless.

Repro steps are:

  1. Import a brand new user
  2. Verify that the error message is displayed and the registration email is sent to the new user
  3. Find the user in the list on the Users page, and select Remove
  4. Verify that the user was removed from the list of Users
  5. Import the user again
  6. Verify that the password error message is displayed, the user returns to the list of Users, but no registration email is sent

If the user was removed from all roles at some point, and they are being added again, and their password is being reset automatically, it seems appropriate that they would receive an email notification (like the error message suggests). However, I’m sure you know the right answer based on your knowledge use cases for the Users XML Import Plugin. Maybe the error message just needs an update to not mention emails, if importUserPasswordValidation does not have the ability to trigger an email.

Thanks!
Doug

Hi @asmecher,

Looking a little closer at the code, the output of the password validation is only used if the user is brand new and being imported. It may be most appropriate to simply move the password validation into the condition that uses the password.

Thanks,
Doug

Hi all,

I have just reopened the issue https://github.com/pkp/pkp-lib/issues/3462 to check for possible additions to the functionality.