【High Priority】封禁/解封日志
Original_Link
This discussion concerns the function "封禁/解封日志", for any discussion related to this, please follow up under this thread.
The whole discussion was written in English for developers convenience. For Chinese accessibility, please use Google translate.
中文描述:封禁和解封没有日志,需要添加封禁和解封公示。
Before starting:
TODO List (Database Table):
Add a table named aws_banlog, with columns uid, status, banned_by, reason, time.
TODO List (PHP Code):
[pincong-wecenter-master/models/account.php]
[pincong-wecenter-master/app/people/main.php]
TODO List (HTML/JS Code):
[pincong-wecenter-master/views/default/people/log.tpl.htm]
[pincong-wecenter-master/views/default/people/list_logs_template.tpl.htm]
Please post any question you may have. We probably will encouter more issues while editing. Don't hesitate to follow up your problems. Thanks and happy coding!
This discussion concerns the function "封禁/解封日志", for any discussion related to this, please follow up under this thread.
The whole discussion was written in English for developers convenience. For Chinese accessibility, please use Google translate.
中文描述:封禁和解封没有日志,需要添加封禁和解封公示。
Before starting:
- Read forbid_user_by_uid() function in "pincong-wecenter-master/models/account.php", understand how forbidding and unforbidding a user works. Note the $status argument: when
$status!=0
, the user is forbidden, and when$status=0
, the user is unforbidden. This corresponds to the status column in table aws_users. Current $status codes are:- 0: Normal
- 1: Permanently banned, but would not delete (can only be done by backend admin, example: @天神九頭鳥)
- 2: Banned due to low reputation (obsolete, example: @此生无悔入华夏)
- 3: Permanently banned, and will delete the account 7 days after banned (default when user's reputation is less than 5, with current setting).
- 4: Temporarily banned, and will unban after the days_unforbid_users days in aws_setting. The current setting is 1 day. This number can only be changed by backend admins for now. Banning those with reputation > 5 will go into this status. Note the banned_by and banned_reason keys.
- Read log_action() and list_logs_action() functions in"pincong-wecenter-master/app/content/main.php", see how logs for changing the content (e.g. 编辑、删除、变更分类 etc.) are listed.
- Read "pincong-wecenter-master/views/default/content/log.tpl.htm" and "pincong-wecenter-master/views/default/content/list_logs_template.tpl.htm", see how frontend displyas the changing logs for content. Note that log.tpl.htm is for the initial display and list_logs_template.tpl.htm is for "更多" option (listing more).
TODO List (Database Table):
Add a table named aws_banlog, with columns uid, status, banned_by, reason, time.
- uid: The uid of the user being banned.
- status: The status of banning. See above for a description.
- banned_by: The uid of the admin who banned the user.
- reason: Banned reason.
- time: The time of the operation.
TODO List (PHP Code):
[pincong-wecenter-master/models/account.php]
- Edit function forbid_user_by_uid() to include the banning and unbanning log by INSERT operation.
[pincong-wecenter-master/app/people/main.php]
- Add functions log_action() and list_logs_action(), similar to that for changing the content. But this is easier because we don't need any item_type or item_id. Don't forget to add the actions to get_access_rule(), and output the template for listing banning logs (see below).
TODO List (HTML/JS Code):
[pincong-wecenter-master/views/default/people/log.tpl.htm]
- Create a template for listing the banning and unbanning log, similar to that of changing logs. You need to list the banned user, status, reason and time (or unbanned user and time).
[pincong-wecenter-master/views/default/people/list_logs_template.tpl.htm]
- See above.
Please post any question you may have. We probably will encouter more issues while editing. Don't hesitate to follow up your problems. Thanks and happy coding!