1. Add new options to admin moderate area.
Require moderator approval when {moderate_required}: (checkbox => activate feature)
Items {moderate_num_items} => User has posted less than ___ moderator approved items
Comments {moderate_num_comments} => User has posted less than ___ moderator approved comments
Register date {moderate_ignore_date} => Ignore moderation for users registered more than ___ days (leave blank to skip this feature)
* Note: when activated, all unregistered user posts and comments require moderation.
2. Requires new db table.
oc_t_user_moderate
=> pk_i_id (int 10)
=> i_num_items (int 10)
=> i_num_comments (int 10)
3. Requires new functions for helper.
oc-includes/osclass/model/hUsers.php
function osc_user_moderate_items()
function osc_user_moderate_comments()
The function returns true/false. On true, post immediately.
On false, require moderation. Hide activate links from user - do not send email,
do not show activate link in user's account page. Only the admin can activate.
If (moderate_ignore_date && (dt_reg_date + {moderate_ignore_date} >= today)) {
Ignore num_items, num_comments, and return true
}
4. Add increment functions.
When admin activates the posted item/comment, we need to increment the value
for that counter.
oc-includes/osclass/model/User.php
Add new table name:
public function getModerateTableName()
{
return DB_TABLE_PREFIX . 't_user_moderate';
}
Add increment functions:
function moderateItemIncrease($userId)
function moderateItemDecrease($userId)
function moderateCommentIncrease($userId)
function moderateCommentDecrease($userId)
Note: when user edits an active item, and the user has < moderate_num, the
item must go into moderation.
In this case, we must moderateItemDecrease(). An edit should be considered as
the same count. This way, when you approve the edit and activate the item,
the user earns only the one moderator count for the item.
5. Add table to sql database install.
/oc-includes/osclass/installer/struct.sql