Reduce the number of options to choose from under notifications

Hi,
Is it in any way possible to reduce the number of options to choose from given to the registered readers when they go to Notifications under their profile. For instance I would like to remove the possibiblity of choosing the Submission Events. Hope its possible without doing any code work.
Best regards
Niels Erik

I do not know any other way than by editing this template: https://github.com/pkp/pkp-lib/blob/master/templates/user/notificationSettingsForm.tpl

Or you could do a plugin that hooks to the templatemanager, checks if that template is being processed and then maybe uses a smarty filter to disable the checkboxes.

Thank you. I really hope that the default settings will be changed in the near future. A lot of our users have wondered why they receive so many notifications

I think what we need is an easy unsubscribe function to the notification emails. This has been under discussion and now that @NateWr added the possibility to opt-out of those emails, I think an unsusbscribe link should be fairly easy to add for the next release of OJS.

We also had a lot of users asking about the notifications when we introduced OJS3. It seems that OJS3 sends a lot more of those compared to OJS2. But now that journals can choose if they want to send a notification it is a lot better and probably the users are getting accustomed to the notifications as well.

Changing the default of what the system does at the moment is a bit difficult, because probably it just checks if the user has opted out. If not, it sends the email. So for most users there is no actual selection in the database.

You could of course add an opt-out selection straight to the database for all users, but then those who actually want to see the notifications would not anymore. For new users it is not a problem because they opt in (or out) when they register.

Apart from that it doesn’t always seems to work. I’ve just enabled the submission event “A new article, “Title,” has been submitted.” I’m registered as Reader but I don’t receive any messages after an author uploaded an article to the journal. That must be an error.
Regards
Niels Erik

I think it is expected behaviour. Only editors and the authors themselves would see that notification when enabled.

Being a reader an enabling that option would not mean that you would see notifications for all submitted articles.

But why then show the option for Readers? At least some information should tell that a Reader can’t get access to that service.

yeah, I guess the options there could be filtered depending on the roles the user has. @NateWr?

Should be. Can you test to see if they’re not and file an issue if not?

The user that has the reader role, does the same user have other roles in other journals in the same installation?

I’ve just made a test with a user having only the reader role in one journal, and the person has the same options

so @NateWr thinking of changing this function here: https://github.com/pkp/pkp-lib/blob/master/classes/notification/form/PKPNotificationSettingsForm.inc.php#L79

So that the code adds notification.type.public category to the array if the user has some role in the context, and adds notification.type.submissions and notification.type.reviewing categories if that the user has other roles besides reader in the context. How does that sound?

So for users with not roles in the context, nothing is being listed there?

Edit: something like this:

	public function getNotificationSettingCategories() {
		$request = Application::getRequest();
		$context = $request->getContext();
		$contextId = $context ? $context->getId() : CONTEXT_ID_NONE;
		$user = $request->getUser();

		$notificationSettingCategories = array();

		if ($user->hasRole(array(ROLE_ID_MANAGER, ROLE_ID_SUB_EDITOR, ROLE_ID_ASSISTANT, ROLE_ID_REVIEWER, ROLE_ID_AUTHOR, ROLE_ID_READER), $contextId)){
			$notificationSettingCategories[] = array('categoryKey' => 'notification.type.public',
					'settings' => array(
						NOTIFICATION_TYPE_NEW_ANNOUNCEMENT,
					)
			);
		}

		if ($user->hasRole(array(ROLE_ID_MANAGER, ROLE_ID_SUB_EDITOR, ROLE_ID_ASSISTANT, ROLE_ID_REVIEWER, ROLE_ID_AUTHOR), $contextId)){
			$notificationSettingCategories[] = array('categoryKey' => 'notification.type.submissions',
					'settings' => array(
						NOTIFICATION_TYPE_SUBMISSION_SUBMITTED,
						NOTIFICATION_TYPE_METADATA_MODIFIED,
						NOTIFICATION_TYPE_NEW_QUERY,
						NOTIFICATION_TYPE_QUERY_ACTIVITY,
					)
			);
			$notificationSettingCategories[] = array('categoryKey' => 'notification.type.reviewing',
					'settings' => array(
						NOTIFICATION_TYPE_REVIEWER_COMMENT,
					)
			);
		}

		return $notificationSettingCategories;

	}
1 Like

I’d rather handle that logic in the template itself. Calling $user->hasRole() will result in an extra DB call, and it’s better if DB access is kept out of helper methods like that. It makes it more reusable if we ever want to call it elsewhere.

So I think you can do the user role checks and skip the appropriate categories in this template:

If you do this, can you file an issue first? It helps for the record if we have PRs that reference issue numbers.

sure, just checking if the logic described above is ok?

I would have to take a closer look at it. Off-hand:

  • I’m not sure we should send a new submission notification to anyone but journal manager (does it include details that can compromise blinding?).

  • New announcements probably shouldn’t require any role.

  • Metadata modified… I’d have to look at this more closely, to work out the logic around who receives this email? Who should? This intersects some with Selectively permit author metadata changes after submission · Issue #3758 · pkp/pkp-lib · GitHub and the question of who should edit and, if it’s locked down, then who actually needs an email?

Hi,
If you by the formulation “New announcements probably shouldn’t require any role” mean that all the options should be shown, I think that there, at least, should be some information about which options are available for who. And please don’t choose some as default, just keep the options open.
Best
Niels Erik

In this case, I was speaking about an email notification that goes out when a new announcement is made. Anyone should be able to subscribe or unsubscribe to this email notification, regardless of their role.

I can not see how that would work.

The option is “Do not send me an email for these types of notifications.”. If we have a user without any roles and having that unchecked means that the context will send her email notifications, it would mean that she has to disable that setting from every context in that installation, which does not make sense?

I think the way it works now is that if you have any role in a context and the option is disabled, you get the email?

I’m not suggesting we change the logic around who is sent the email. I’m just saying you can get rid of the conditional determining what settings to show a user:

		if ($user->hasRole(array(ROLE_ID_MANAGER, ROLE_ID_SUB_EDITOR, ROLE_ID_ASSISTANT, ROLE_ID_REVIEWER, ROLE_ID_AUTHOR, ROLE_ID_READER), $contextId)){
			$notificationSettingCategories[] = array('categoryKey' => 'notification.type.public',
					'settings' => array(
						NOTIFICATION_TYPE_NEW_ANNOUNCEMENT,
					)
			);
		}

If they are accessing the profile page in the context, we should be able to assume they have a role there.

Technically you can access your profile page from within any context in the site regardless if you have a role there, I think?

Edit: just checked, yes, you do not need a role to access a profile page from within a context. Because all of those notification emails are conditional to whether you have a role, it would make sense to hide all the selections if the user has no roles?