When someone makes a new submission, the user data is cloned to the authors table and a new row is added to the stage_assigments table. However, that does not happen with the other contributors (I understand the need for separate user/authors tables).
But if a contributor is already registered as an user in OJS, it would be possible to check that information (by e-mail or ORICD, perhaps…) and automatically create a new entry in the stage_assigment table, making that contributor “officially” an author.
One of the benefits of this feature would be a better screening for reviewers that have conflict in the current submission (as I understood, the $warnonassignment uses the information on the stage_assigment table to identify which reviewers put the double-blind review at risk; this happened to us last week, we enroled a submission contributor as a reviewer without realizing it…)
I’m new to php (thank you @NateWr for the help in my other posts), and I’m willing to try to accomplish what I suggest, if someone please leeds me in the right path…
I recommend writing a plugin to do this for you. You can learn about plugins in our Plugin Guide. You’ll want to use a Generic Plugin and register a hook to fire when the author form is submitted.
The hook you will want for this form is authorform::execute.
So, I’ve already set up the plugin folder and main files, using the Tutorial example. Is “working” (No problem when I set to active in the plugin management).
Then I tried to figure out what I needed to do to set up the hook (sorry if I’m not using the right terms…).
As I understand, I need to set an action of filling the authorform if a given contributor variable (e-mail, for example) matches an existing e-mail in the users table. Is this correct?
If this is correct, how can I get it to work (I apologize for my ignorance, I’m really giving my first steps in this…)
Now it’s working as I wanted: if a contributor is a user, it makes a new entry in stage_assignments table as a author (role 14).
The code is very unpolished (it makes a translator contributor also an author, and the author remains when the contributor is deleted), but I’ll try to get it better in the next few days.
So, two questions:
1 - what’s yout opinion on the code?
2 - how can I get it to work as a plugin? (i’m still struggling to understand how hooks work…)
You’ve set the user group ID manually, so it will only work for this one journal. And if the role configurations are ever changed it will break for that too.
You can get the default author user group with the following:
You might want to test what happens when an editor makes a submission. This is common for editorials or issue introductions, and in this case they may not want to be assigned as an author.
how can I get it to work as a plugin?
You can use the code you’ve written almost as-is inside of a plugin. You’ll need to read the docs to learn how to create a generic plugin and use hooks (see my previous post), but the hook itself just wraps your code:
HookRegistry::register('authorform::execute', function($hookName, $args) {
$form = $args[0];
// Your code, using `$form` instead of `$this`, eg:
// $user = $userDao->getUserByEmail($form->getData('email'));
});
Sorry for my ignorance, I thought 14 would always represent the author role…
I’ll use all your valuable advices and I’ll give another go at the plugin.
I’ll try to go a little deeper and get it to identify if the contributor is an editor or an translator (either case, it shouldn´t create the author role).
I’m really having a blast learning all this stuff!!!