Skip to content

Conversation

@agscs
Copy link
Contributor

@agscs agscs commented Mar 21, 2024

This new update have two new hooks that expand this module to make it easy for owner/dev to add more input to be edited on the players and another hook to remove players entry when player is removed

#1 editUserInput:

This hook will add new input to the edit user form
example:

new Hook('editUserInput', function ($profile) {
	global $db;
	return array(
		'id' => 'name',
		'label' => 'User Name',
		'sort' => 1,
		'width_md' => 6,
		'width_lg' => 6,
		'width_xl' => 6,
		'type' => 'text',
		'value' => $profile->info->U_name,
		'validate' => function ($value) {
			return true;
		},
		'value_type' => 'string',
		'update' => function ($value) use ($profile) {
			$profile->set('U_name', $value);
		}
	);
});

value_type can be two types string for texts or integer for numbers

#2 deleteUserEntries:

This hook will be triggred when a user is removed

example of removing user inventory items:

new Hook('deleteUserEntries', function ($userId) {
    global $db;
    $db->delete("DELETE FROM `userInventory` WHERE `UI_user` = :id;", [":id" => $userId]);
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant