@@ -65,7 +65,6 @@ class provider implements
6565 * @return collection $collection The collection returned as a whole.
6666 */
6767 public static function get_metadata (collection $ collection ) : collection {
68-
6968 // Add items to collection.
7069 $ collection ->add_database_table (
7170 'block_advnotifications ' ,
@@ -91,7 +90,6 @@ public static function get_metadata(collection $collection) : collection {
9190 'privacy:metadata:block_advnotificationsdissed '
9291 );
9392
94-
9593 return $ collection ;
9694 }
9795
@@ -102,7 +100,6 @@ public static function get_metadata(collection $collection) : collection {
102100 * @return contextlist $contextlist List of contexts used by the plugin.
103101 */
104102 public static function get_contexts_for_userid (int $ userid ) : contextlist {
105-
106103 // User data only on system/block context.
107104 global $ DB ;
108105 $ contextlist = new \core_privacy \local \request \contextlist ();
@@ -136,7 +133,6 @@ public static function get_contexts_for_userid(int $userid) : contextlist {
136133 }
137134 }
138135
139-
140136 return $ contextlist ;
141137 }
142138
@@ -146,7 +142,6 @@ public static function get_contexts_for_userid(int $userid) : contextlist {
146142 * @param userlist $userlist The userlist containing the list of users who have data in this context/plugin combination.
147143 */
148144 public static function get_users_in_context (userlist $ userlist ) {
149-
150145 $ context = $ userlist ->get_context ();
151146
152147 // Check if contexts are one block or system-level (others not allowed).
@@ -175,7 +170,6 @@ public static function get_users_in_context(userlist $userlist) {
175170 array ('contextlevel ' => CONTEXT_BLOCK )
176171 );
177172 }
178-
179173 }
180174
181175 /**
@@ -184,7 +178,6 @@ public static function get_users_in_context(userlist $userlist) {
184178 * @param approved_contextlist $contextlist The approved contexts to export information for.
185179 */
186180 public static function export_user_data (approved_contextlist $ contextlist ) {
187-
188181 global $ DB ;
189182
190183 $ blockdata = [];
@@ -206,7 +199,6 @@ public static function export_user_data(approved_contextlist $contextlist) {
206199
207200 // Get and export user data.
208201 foreach ($ alluserdata as $ userdata ) {
209-
210202 if ($ userdata ->blockid !== SITE_NOTIFICATION ) {
211203 $ blockdata [] = (object )[
212204 'title ' => $ userdata ->title ,
@@ -253,7 +245,6 @@ public static function export_user_data(approved_contextlist $contextlist) {
253245 get_string ('pluginname ' , 'block_advnotifications ' )
254246 ], $ data );
255247 }
256-
257248 }
258249
259250 /**
@@ -262,7 +253,6 @@ public static function export_user_data(approved_contextlist $contextlist) {
262253 * @param \context $context The specific context to delete data for.
263254 */
264255 public static function delete_data_for_all_users_in_context (\context $ context ) {
265-
266256 global $ DB ;
267257
268258 // Check if approved context.
@@ -292,7 +282,6 @@ public static function delete_data_for_all_users_in_context(\context $context) {
292282 static ::adv_delete_record_data ($ delrecord ->id );
293283 }
294284 }
295-
296285 }
297286
298287 /**
@@ -301,13 +290,11 @@ public static function delete_data_for_all_users_in_context(\context $context) {
301290 * @param approved_contextlist $contextlist The approved contexts and user information to delete information for.
302291 */
303292 public static function delete_data_for_user (approved_contextlist $ contextlist ) {
304-
305293 // Get user id.
306294 $ userid = $ contextlist ->get_user ()->id ;
307295
308296 // Delete their data.
309297 static ::adv_delete_user_data ($ userid );
310-
311298 }
312299
313300 /**
@@ -316,7 +303,6 @@ public static function delete_data_for_user(approved_contextlist $contextlist) {
316303 * @param approved_userlist $userlist The approved context and user information to delete information for.
317304 */
318305 public static function delete_data_for_users (approved_userlist $ userlist ) {
319-
320306 // For each user, delete the user data.
321307 foreach ($ userlist ->get_userids () as $ userid ) {
322308 static ::adv_delete_user_data ($ userid );
@@ -330,8 +316,8 @@ public static function delete_data_for_users(approved_userlist $userlist) {
330316 * @param int $userid The userid of the user which data need to be deleted.
331317 */
332318 public static function adv_delete_user_data ($ userid ) {
333- global $ DB ;
334319 // We won't delete notification due to user data being deleted - just 'clear' user id.
320+ global $ DB ;
335321
336322 // If user created notification.
337323 $ DB ->set_field ('block_advnotifications ' , 'created_by ' , -1 , array ('created_by ' => $ userid ));
0 commit comments