Ok, I was wrong... it was a permissions issue, sort of. The function addDataset in projectmanager/admin/admin.php was testing the capabilities of the current user to decide whether or not it would create a new dataset. Problem is, when user_register is run by a new user registering themselves on the site, there is no current user.
I've gotten around this by adding a simple if statement around the sections of code (lines 671-683) that test the current user's capabilities. The first and final lines are what I added:
if ( is_user_logged_in() ) {
// Negative check on capability: user can't edit datasets
if ( !current_user_can('edit_datasets') && !current_user_can('projectmanager_user') && !current_user_can('import_datasets') ) {
$this->setMessage( __("You don't have permission to perform this task", 'projectmanager'), true );
return;
}
// user has only cap 'projectmanager_user' but not 'edit_other_datasets' and 'edit_datasets'
if ( current_user_can('projectmanager_user') && !current_user_can('edit_other_datasets') && !current_user_can('edit_datasets') && !current_user_can('import_datasets') ) {
// and dataset with this user ID already exists
if ( $this->datasetExists($project_id, $user_id) ) {
$this->setMessage( __("You don't have permission to perform this task", 'projectmanager'), true );
return;
}
}
}
As is probably apparent at this point, I am not very good at this... I don't claim much knowledge of php or coding wordpress plugins. I don't know if this is the best way to fix the problem, or if it will introduce any other problems, including possible security issues. This was just the best way I could see of allowing new users to register themselves and have datasets created for them with this plugin. I've tested it a bit more thoroughly this time (a larger test size), and currently new datasets are being created 100% of the time. And you do not need the changes to projectmanager.php I previously recommended to make this work, it all happens through the user_register function already being called.
Sorry for the earlier confusion, I really thought I had it fixed and I'm still not sure why it worked intermittently. Hopefully my trial and error on this (and my solution, if inelegant) will be useful to someone else.