Advertisement:

Author Topic: Skip 'awaiting moderation' when user has more than...  (Read 2283 times)

code monkey

  • Full Member
  • ***
  • Posts: 204
Skip 'awaiting moderation' when user has more than...
« on: March 17, 2011, 09:01:09 pm »
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:
Code: [Select]
   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
« Last Edit: March 17, 2011, 09:03:00 pm by code monkey »

_CONEJO

  • Administrator
  • Hero Member
  • *****
  • Posts: 4689
Re: Skip 'awaiting moderation' when user has more than...
« Reply #1 on: March 18, 2011, 12:22:21 pm »
Hi,

Great ideas, that will take a little time to be implemented (since we're in a pre-release status, no new features will be added), but we're going to do that for sure :

Check the developmente here : http://issues.osclass.org/browse/OSCLASS-399