Example #1
0
 /**
  * Initialize relations for restrict and cascade deletion.
  * Spammer user's deletion will cascade more items.
  *
  * @param boolean Is this user spammer
  */
 function init_relations($is_spammer = false)
 {
     if (!is_null($this->delete_cascades) || !is_null($this->delete_restrictions)) {
         // Initialize the relations only once
         return;
     }
     parent::init_relations();
     if ($is_spammer) {
         $this->delete_cascades[] = array('table' => 'T_messaging__message', 'fk' => 'msg_author_user_ID', 'msg' => T_('%d messages from this user'), 'class' => 'Message', 'class_path' => 'messaging/model/_message.class.php');
         $this->delete_cascades[] = array('table' => 'T_messaging__threadstatus', 'fk' => 'tsta_user_ID', 'msg' => T_('%d message read statuses from this user'));
         $this->delete_cascades[] = array('table' => 'T_comments', 'fk' => 'comment_author_user_ID', 'msg' => T_('%d comments by this user'), 'class' => 'Comment', 'class_path' => 'comments/model/_comment.class.php');
         $this->delete_cascades[] = array('table' => 'T_links', 'fk' => 'link_creator_user_ID', 'msg' => T_('%d links created by this user'), 'class' => 'Link', 'class_path' => 'links/model/_link.class.php');
     }
 }