-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHideDiscussionEmailBodyPlugin.php
More file actions
45 lines (39 loc) · 1.4 KB
/
HideDiscussionEmailBodyPlugin.php
File metadata and controls
45 lines (39 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
namespace APP\plugins\generic\hideDiscussionEmailBody;
use PKP\plugins\GenericPlugin;
use PKP\plugins\Hook;
class HideDiscussionEmailBodyPlugin extends GenericPlugin
{
public function register($category, $path, $mainContextId = null): bool
{
if (parent::register($category, $path, $mainContextId)) {
if ($this->getEnabled()) {
Hook::add('Mailable::build', [$this, 'handleMailableBuild']);
}
return true;
}
return false;
}
public function handleMailableBuild(string $hookName, array $args): bool
{
$mailable = $args['mailable'];
$class = get_class($mailable);
if (
str_contains($class, 'DiscussionCopyediting') ||
str_contains($class, 'DiscussionProduction') ||
str_contains($class, 'DiscussionReview') ||
str_contains($class, 'DiscussionSubmission')
) {
$mailable->body(__("plugins.generic.hideDiscussionEmailBody.discussion.updated"));
}
return Hook::CONTINUE;
}
public function getDisplayName(): string
{
return 'Hide discussion messages from emails';
}
public function getDescription(): string
{
return 'Hides the discussion message from the email notification send to users and forces the user to login and answer to the discussion message using the discussion tool.';
}
}