@@ -151,7 +151,7 @@ public function onContentPrepareData($context, $data)
151151 $ id = (int ) $ data ->id ;
152152
153153 $ query = $ db ->getQuery (true )
154- ->select ($ db ->quoteName (['notify ' , 'extensions ' ]))
154+ ->select ($ db ->quoteName (['notify ' , 'extensions ' , ' exclude_self ' ]))
155155 ->from ($ db ->quoteName ('#__action_logs_users ' ))
156156 ->where ($ db ->quoteName ('user_id ' ) . ' = :userid ' )
157157 ->bind (':userid ' , $ id , ParameterType::INTEGER );
@@ -169,9 +169,10 @@ public function onContentPrepareData($context, $data)
169169 // Load plugin language files.
170170 $ this ->loadLanguage ();
171171
172- $ data ->actionlogs = new \stdClass ();
173- $ data ->actionlogs ->actionlogsNotify = $ values ->notify ;
174- $ data ->actionlogs ->actionlogsExtensions = $ values ->extensions ;
172+ $ data ->actionlogs = new \stdClass ();
173+ $ data ->actionlogs ->actionlogsNotify = $ values ->notify ;
174+ $ data ->actionlogs ->actionlogsExtensions = $ values ->extensions ;
175+ $ data ->actionlogs ->actionlogsExcludeSelf = $ values ->exclude_self ;
175176
176177 if (!HTMLHelper::isRegistered ('users.actionlogsNotify ' )) {
177178 HTMLHelper::register ('users.actionlogsNotify ' , [__CLASS__ , 'renderActionlogsNotify ' ]);
@@ -181,6 +182,10 @@ public function onContentPrepareData($context, $data)
181182 HTMLHelper::register ('users.actionlogsExtensions ' , [__CLASS__ , 'renderActionlogsExtensions ' ]);
182183 }
183184
185+ if (!HTMLHelper::isRegistered ('users.actionlogsExcludeSelf ' )) {
186+ HTMLHelper::register ('users.actionlogsExcludeSelf ' , [__CLASS__ , 'renderActionlogsExcludeSelf ' ]);
187+ }
188+
184189 return true ;
185190 }
186191
@@ -227,9 +232,10 @@ public function onUserAfterSave($user, $isNew, $success, $msg): void
227232 // If preferences don't exist, insert.
228233 if (!$ exists && $ authorised && isset ($ user ['actionlogs ' ])) {
229234 $ notify = (int ) $ user ['actionlogs ' ]['actionlogsNotify ' ];
230- $ values = [':userid ' , ':notify ' ];
231- $ bind = [$ userid , $ notify ];
232- $ columns = ['user_id ' , 'notify ' ];
235+ $ exclude = (int ) $ user ['actionlogs ' ]['actionlogsExcludeSelf ' ];
236+ $ values = [':userid ' , ':notify ' , ':exclude ' ];
237+ $ bind = [$ userid , $ notify , $ exclude ];
238+ $ columns = ['user_id ' , 'notify ' , 'exclude_self ' ];
233239
234240 $ query ->bind ($ values , $ bind , ParameterType::INTEGER );
235241
@@ -250,6 +256,11 @@ public function onUserAfterSave($user, $isNew, $success, $msg): void
250256
251257 $ query ->bind (':notify ' , $ notify , ParameterType::INTEGER );
252258
259+ $ exclude = (int ) $ user ['actionlogs ' ]['actionlogsExcludeSelf ' ];
260+ $ values [] = $ db ->quoteName ('exclude_self ' ) . ' = :exclude ' ;
261+
262+ $ query ->bind (':exclude ' , $ exclude , ParameterType::INTEGER );
263+
253264 if (isset ($ user ['actionlogs ' ]['actionlogsExtensions ' ])) {
254265 $ values [] = $ db ->quoteName ('extensions ' ) . ' = :extension ' ;
255266 $ extension = json_encode ($ user ['actionlogs ' ]['actionlogsExtensions ' ]);
@@ -324,6 +335,20 @@ public static function renderActionlogsNotify($value)
324335 return Text::_ ($ value ? 'JYES ' : 'JNO ' );
325336 }
326337
338+ /**
339+ * Method to render a value.
340+ *
341+ * @param integer|string $value The value (0 or 1).
342+ *
343+ * @return string The rendered value.
344+ *
345+ * @since __DEPLOY_VERSION_
346+ */
347+ public static function renderActionlogsExcludeSelf ($ value )
348+ {
349+ return Text::_ ($ value ? 'JYES ' : 'JNO ' );
350+ }
351+
327352 /**
328353 * Method to render a list of extensions.
329354 *
@@ -373,7 +398,7 @@ public function onExtensionAfterSave($context, $table, $isNew): void
373398 $ db = $ this ->getDatabase ();
374399
375400 $ query = $ db ->getQuery (true )
376- ->select ($ db ->quoteName (['user_id ' , 'notify ' , 'extensions ' ]))
401+ ->select ($ db ->quoteName (['user_id ' , 'notify ' , 'extensions ' , ' exclude_self ' ]))
377402 ->from ($ db ->quoteName ('#__action_logs_users ' ));
378403
379404 try {
0 commit comments