0

i write follow code in a class_post.php :

$this->post_message = stripslashes($obj->message);
$this->post_date        = intval($obj->date);
$this->comments_disabled = intval($obj->dis_comment);
$this->post_mentioned   = array();
$this->post_attached    = array();
$this->post_posttags    = array();
$this->post_comments    = array();
$this->post_commentsnum = 0;
$this->post_commentsnum = 0;

and this function in class_post.php :

  public function disable_comment($num)
    {

        if( $this->error ) {
            return FALSE;
        }
        if( $this->is_system_post ) {
            return FALSE;
        }

        if( ! $this->user->is_logged ) {
            return FALSE;
        }
                    if( $this->user->id != $this->post_user->id && $this->user->info->is_network_admin != 1) {
            return FALSE;
        }
                    $n = intval($num);
        $this->db2->query('UPDATE posts SET dis_comment="'.$n.'" WHERE id="'.$this->post_id.'" LIMIT 1');

        return TRUE;
    }

and when i go to comment page i see this error :

Notice: Undefined property: stdClass::$dis_comment in \classes\class_post.php on line 154

154 = $this->comments_disabled = intval($obj->dis_comment);

please help me if you can.

Community
  • 1
  • 1
iman aletaha
  • 31
  • 1
  • 8
  • 1
    `var_dump($obj)` and see what properties are actually defined. If you don't see it but should (meaning not just a typo), then it's a problem with how you're setting up the object. – jprofitt Jun 04 '12 at 12:46

1 Answers1

0

You haven't provided Details of what $obj actually is here but it looks as if the problem is simply you $obj doesn't have that property defined.

Luc
  • 985
  • 7
  • 10