think tank forum

ttf development » admin_ban.php

maple's avatar
18 years ago
link
maple
i like large datasets
i was hacking through admin_user and admin_ban to see how everything worked and thought of something.

what if you got rid of admin_ban and made two functions - userban() and userunban() and place them in include_common. php - then in admin_user just add a column at the end of the users with 'ban' or 'unban' depending on their status. all it would do is link back to itself with ?banuser=$user_id or ?unban=$user_id then call the appropriate function. this was you get alot less code, 2 functions for easy reuse and it would be very easy to use the new message() array to output xhtml/css instead of the current tables.

pretty big change to a few files though. thoughts?
lucas's avatar
18 years ago
link
lucas
i ❤ demo
i'll think about it and post later. i'm off for some beer!
maple's avatar
18 years ago
link
maple
i like large datasets
sounds good. beers for me too. good work on the deleteAvatar(); we'll have to chat, i don't understand your comment about the headers though. two variables are being set and the setcookie() can be done and time (or so i thought). worked for me, but i only have a small test environment, i could have missed a case or something.

friday!
maple's avatar
18 years ago
link
maple
i like large datasets
i implemented this completely. made 2 functions (mostly the code from admin_ban) - banuser() and unbanuser() and put them inside admin_common.php. both make use of the modified messages().

then added a column to the admin_user.php so it has a 'ban' or 'unban' depending on status. works really well. may need a bit of tweaking. even if you decide not to use the column for the admin_user page, i think having the functions will be very useful.
lucas's avatar
18 years ago
link
lucas
i ❤ demo
okay, cool.

we desperately need to decide on function naming rules for our userland.

http://www.php.net/manual/en/userlandnaming.rules.php

Function names use underscores between words, while class names use the camel case rule (there are some exceptions for older classes and functions).



http://www.php.net/manual/en/userlandnaming.tips.php

In order to write future-proof code, it is recommended that you prefix (or suffix) anything that goes into the global namespace with an uncommon 3-4 letter prefix (or suffix) separated with an underscore. It is recommended that in order to prevent namespace clashes with other userland code that projects research existing prefixes (or suffixes) used in other projects and advertise their chosen prefix (or suffix) appropriately.



so i vote that at some point in the future, we prefix everything with "ttf_". i personally hate camel humps, but we could phase them in. so we'd have stuff like ttf_deleteAvatar().

thoughts?