Advertisement:

Author Topic: [SOLVED] Cleanup old users with no ads and not logged in for xxx period  (Read 4120 times)

Aficionado

  • Guest
Re: [SOLVED] Cleanup old users with no ads and not logged in for xxx period
« Reply #15 on: September 13, 2016, 09:52:23 pm »
Actually just now i realized that is a bug of Osclass.

Easy to replicate:

Mark FIRST a post as SPAM and then delete it. The count of the user items doesn't change.
« Last Edit: September 15, 2016, 10:11:37 am by Aficionado »

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: [SOLVED] Cleanup old users with no ads and not logged in for xxx period
« Reply #16 on: September 13, 2016, 10:00:52 pm »
When you mark an ad as spam, the total count decreases already, so no difference later when you delete it.

Regards


Aficionado

  • Guest
Re: [SOLVED] Cleanup old users with no ads and not logged in for xxx period
« Reply #17 on: September 13, 2016, 10:15:48 pm »
hm .....
« Last Edit: September 13, 2016, 10:18:00 pm by Aficionado »

Aficionado

  • Guest
Re: [SOLVED] Cleanup old users with no ads and not logged in for xxx period
« Reply #18 on: September 13, 2016, 10:22:00 pm »
yeap.

This is the code from some spam plugin, marks as spam but doesn't update the count i guess.

Code: [Select]
function after_item_posted($item) {
if( getEnableOn() == 1 || getEnableOn() == 2 ){
  $arrstopword= getStopWords();
  $exparrstopword= explode(",", $arrstopword);
  foreach ($exparrstopword as $expstopword) {
    if (preg_match("/" . $expstopword. "/i", $item['s_title']) || preg_match("/" . $expstopword. "/i", $item['s_description'])) {
ModelSpamKiller::newInstance()->blockItem($item['pk_i_id']);
}
  }
  }
}

and

Code: [Select]

function blockItem($id){
            $this->dao->from($this->getItemTable()) ;
            $this->dao->set(array(
                'b_spam' => 1
            )) ;
            $this->dao->where(array(
                'pk_i_id' => $id
            )) ;
$this->dao->update() ;
        }
« Last Edit: September 13, 2016, 10:34:57 pm by Aficionado »

teseo

  • Hero Member
  • *****
  • Posts: 6169
Re: [SOLVED] Cleanup old users with no ads and not logged in for xxx period
« Reply #19 on: September 13, 2016, 10:50:25 pm »
That's why vanilla methods should be used if they exist, they are supposed to take care of everything:

Code: [Select]
if (preg_match("/" . $expstopword. "/i", $item['s_title']) || preg_match("/" . $expstopword. "/i", $item['s_description'])) {
// ModelSpamKiller::newInstance()->blockItem();
            $action = new ItemActions();
            $action->spam($item['pk_i_id']);
}

Regards