MyBB Community Forums

Full Version: users.php
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Does anyone knows how the function makeinputcode() works ??

I was using a mod call inventory shop that allows user to purchase item. Thus, i wanted to put a column in admin panel -> Edit User Account where i can edit his money value.

Therefore, under users.php,

I put the following line :

makeinputcode("$lang->post_count", "postnum", $user['postnum'], 4);
makeinputcode("Money", "money", $user['money'],4);

The interesting thing is when i test it in admin panel, everytime i update the user money value, it changed all the user in the database to the same money value also. Anybody knows why ???
It think it isn't a problem with that part of the code, rather, the part in the "do_edit" action which actually updates the users.
But i never even code under that part, how does it able to update by the sql fields automatically ??
It shouldn't update if you haven't changed code (or added a plugin) to the "do_edit" action Confused The makeinputcode function only generates the HTML to show the box, it doesn't control how the data is inserted/updated in the database.
omg, after a series of tracing to 5++ php files, i reached the point of code where it affects the updating of database :

$plugins->run_hooks("admin_users_do_edit");

Does anybody have an idea of how run_hooks works ?? It is kinda messy with the huge amount of class files used and it is hard to trace all the functions.

Does anybody have the exact portion of the code where the data is edited into the database ? The do_edit part links to many different functions of various class files......
You should check inc/plugins/hello.php - It was included to show as an example of how the plugin system works.
Tianzhui Wrote:omg, after a series of tracing to 5++ php files, i reached the point of code where it affects the updating of database :

$plugins->run_hooks("admin_users_do_edit");

Does anybody have an idea of how run_hooks works ?? It is kinda messy with the huge amount of class files used and it is hard to trace all the functions.

Does anybody have the exact portion of the code where the data is edited into the database ? The do_edit part links to many different functions of various class files......

That's not exactly correct. The run_hooks is part of the plugin system which finds and calls functions from plugins which may have opted to run additional code at this "hook" location. It doesn't actually update the database; the part that does is probably several lines down where it's similar to:
$db->update_query(TABLE_PREFIX."users", ...);

However, any plugins using this "hook" may affect the data which is updated in the line I pointed above.