Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ protected function sendNotificationEmails($messages, $username, $context)
$query = $db->getQuery(true);

$query
->select($db->quoteName(['u.email', 'u.username', 'l.extensions', 'l.exclude_self']))
->select($db->quoteName(['u.email', 'u.username', 'l.extensions']))
->from($db->quoteName('#__users', 'u'))
->where($db->quoteName('u.block') . ' = 0')
->join(
Expand All @@ -142,7 +142,7 @@ protected function sendNotificationEmails($messages, $username, $context)
$recipients = [];

foreach ($users as $user) {
if ($user->username === $this->getCurrentUser()->username && $user->exclude_self) {
if ($user->username === $this->getCurrentUser()->username) {
continue;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
ALTER TABLE `#__action_logs_users` ADD COLUMN `exclude_self` tinyint NOT NULL DEFAULT 0;
-- --------------------------------------------------------
-- The following statement which was introduced with 5.3.0-alpha3
-- has been disabled as it was reverted with 5.3.0-beta1.
-- See https://github.com/joomla/joomla-cms/pull/44846 for details.
--
-- ALTER TABLE `#__action_logs_users` ADD COLUMN `exclude_self` tinyint NOT NULL DEFAULT 0;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE `#__action_logs_users` DROP COLUMN `exclude_self` /** CAN FAIL **/;
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
ALTER TABLE "#__action_logs_users" ADD COLUMN "exclude_self" integer DEFAULT 0 NOT NULL;
-- --------------------------------------------------------
-- The following statement which was introduced with 5.3.0-alpha3
-- has been disabled as it was reverted with 5.3.0-beta1.
-- See https://github.com/joomla/joomla-cms/pull/44846 for details.
--
-- ALTER TABLE "#__action_logs_users" ADD COLUMN "exclude_self" integer DEFAULT 0 NOT NULL;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE "#__action_logs_users" DROP COLUMN "exclude_self" /** CAN FAIL **/;
1 change: 0 additions & 1 deletion administrator/language/en-GB/plg_system_actionlogs.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ PLG_SYSTEM_ACTIONLOGS_INFO_LABEL="Information"
PLG_SYSTEM_ACTIONLOGS_JOOMLA_ACTIONLOG_DISABLED="Action Log - Joomla"
PLG_SYSTEM_ACTIONLOGS_JOOMLA_ACTIONLOG_DISABLED_REDIRECT="The %s plugin is disabled."
PLG_SYSTEM_ACTIONLOGS_NOTIFICATIONS="Email Notifications"
PLG_SYSTEM_ACTIONLOGS_NOTIFICATIONS_EXCLUDE="Exclude Self"
PLG_SYSTEM_ACTIONLOGS_OPTIONS="User Actions Log Options"
PLG_SYSTEM_ACTIONLOGS_XML_DESCRIPTION="Records the actions of users on the site so they can be reviewed if required."
; Common content type log messages
Expand Down
1 change: 0 additions & 1 deletion installation/sql/mysql/extensions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -887,7 +887,6 @@ CREATE TABLE IF NOT EXISTS `#__action_logs_users` (
`user_id` int UNSIGNED NOT NULL,
`notify` tinyint UNSIGNED NOT NULL,
`extensions` text NOT NULL,
`exclude_self` tinyint UNSIGNED NOT NULL DEFAULT 0,
PRIMARY KEY (`user_id`),
KEY `idx_notify` (`notify`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;
Expand Down
1 change: 0 additions & 1 deletion installation/sql/postgresql/extensions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -848,7 +848,6 @@ CREATE TABLE "#__action_logs_users" (
"user_id" integer NOT NULL,
"notify" integer NOT NULL,
"extensions" text NOT NULL,
"exclude_self" integer NOT NULL DEFAULT 0,
PRIMARY KEY ("user_id")
);

Expand Down
12 changes: 0 additions & 12 deletions plugins/system/actionlogs/forms/actionlogs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,6 @@
showon="actionlogsNotify:1"
default="com_content"
/>
<field
name="actionlogsExcludeSelf"
type="radio"
label="PLG_SYSTEM_ACTIONLOGS_NOTIFICATIONS_EXCLUDE"
layout="joomla.form.field.radio.switcher"
showon="actionlogsNotify:1"
default="0"
filter="integer"
>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
</fields>
</fieldset>
</form>
41 changes: 8 additions & 33 deletions plugins/system/actionlogs/src/Extension/ActionLogs.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public function onContentPrepareData(Model\PrepareDataEvent $event): void
$id = (int) $data->id;

$query = $db->getQuery(true)
->select($db->quoteName(['notify', 'extensions', 'exclude_self']))
->select($db->quoteName(['notify', 'extensions']))
->from($db->quoteName('#__action_logs_users'))
->where($db->quoteName('user_id') . ' = :userid')
->bind(':userid', $id, ParameterType::INTEGER);
Expand All @@ -193,10 +193,9 @@ public function onContentPrepareData(Model\PrepareDataEvent $event): void
// Load plugin language files.
$this->loadLanguage();

$data->actionlogs = new \stdClass();
$data->actionlogs->actionlogsNotify = $values->notify;
$data->actionlogs->actionlogsExtensions = $values->extensions;
$data->actionlogs->actionlogsExcludeSelf = $values->exclude_self;
$data->actionlogs = new \stdClass();
$data->actionlogs->actionlogsNotify = $values->notify;
$data->actionlogs->actionlogsExtensions = $values->extensions;

if (!HTMLHelper::isRegistered('users.actionlogsNotify')) {
HTMLHelper::register('users.actionlogsNotify', [__CLASS__, 'renderActionlogsNotify']);
Expand All @@ -205,10 +204,6 @@ public function onContentPrepareData(Model\PrepareDataEvent $event): void
if (!HTMLHelper::isRegistered('users.actionlogsExtensions')) {
HTMLHelper::register('users.actionlogsExtensions', [__CLASS__, 'renderActionlogsExtensions']);
}

if (!HTMLHelper::isRegistered('users.actionlogsExcludeSelf')) {
HTMLHelper::register('users.actionlogsExcludeSelf', [__CLASS__, 'renderActionlogsExcludeSelf']);
}
}

/**
Expand Down Expand Up @@ -253,10 +248,9 @@ public function onUserAfterSave(User\AfterSaveEvent $event): void
// If preferences don't exist, insert.
if (!$exists && $authorised && isset($user['actionlogs'])) {
$notify = (int) $user['actionlogs']['actionlogsNotify'];
$exclude = (int) $user['actionlogs']['actionlogsExcludeSelf'];
$values = [':userid', ':notify', ':exclude'];
$bind = [$userid, $notify, $exclude];
$columns = ['user_id', 'notify', 'exclude_self'];
$values = [':userid', ':notify'];
$bind = [$userid, $notify];
$columns = ['user_id', 'notify'];

$query->bind($values, $bind, ParameterType::INTEGER);

Expand All @@ -277,11 +271,6 @@ public function onUserAfterSave(User\AfterSaveEvent $event): void

$query->bind(':notify', $notify, ParameterType::INTEGER);

$exclude = (int) $user['actionlogs']['actionlogsExcludeSelf'];
$values[] = $db->quoteName('exclude_self') . ' = :exclude';

$query->bind(':exclude', $exclude, ParameterType::INTEGER);

if (isset($user['actionlogs']['actionlogsExtensions'])) {
$values[] = $db->quoteName('extensions') . ' = :extension';
$extension = json_encode($user['actionlogs']['actionlogsExtensions']);
Expand Down Expand Up @@ -355,20 +344,6 @@ public static function renderActionlogsNotify($value)
return Text::_($value ? 'JYES' : 'JNO');
}

/**
* Method to render a value.
*
* @param integer|string $value The value (0 or 1).
*
* @return string The rendered value.
*
* @since 5.3.0
*/
public static function renderActionlogsExcludeSelf($value)
{
return Text::_($value ? 'JYES' : 'JNO');
}

/**
* Method to render a list of extensions.
*
Expand Down Expand Up @@ -419,7 +394,7 @@ public function onExtensionAfterSave(Model\AfterSaveEvent $event): void
$db = $this->getDatabase();

$query = $db->getQuery(true)
->select($db->quoteName(['user_id', 'notify', 'extensions', 'exclude_self']))
->select($db->quoteName(['user_id', 'notify', 'extensions']))
->from($db->quoteName('#__action_logs_users'));

try {
Expand Down