-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add delete user hook Fix permissions not being respected in widgets Fix user account resources tabs
- Loading branch information
Showing
6 changed files
with
83 additions
and
10 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
upload/modules/Resources/hooks/DeleteUserResourcesHook.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
/* | ||
* Made by Samerton | ||
* https://github.com/NamelessMC/Nameless/ | ||
* NamelessMC version 2.0.0-pr13 | ||
* | ||
* Delete user event listener for Resources module | ||
*/ | ||
|
||
class DeleteUserResourcesHook { | ||
public static function execute(array $params = []): void { | ||
if (isset($params['user_id']) && $params['user_id'] > 1) { | ||
$db = DB::getInstance(); | ||
|
||
// Delete the user's resources | ||
$db->delete('resources', ['creator_id', $params['user_id']]); | ||
|
||
// Delete the user's resource comments | ||
$db->delete('resources_comments', ['author_id', $params['user_id']]); | ||
|
||
// Resource payments | ||
$db->delete('resources_payments', ['user_id', $params['user_id']]); | ||
|
||
// Resource premium details | ||
$db->delete('resources_users_premium_details', ['user_id', $params['user_id']]); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters