×

Notice

The forum is in read only mode.
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: Error when a comment is posted with no other comments published

Error when a comment is posted with no other comments published 14 years 9 months ago #5670

  • Jaime
  • Jaime's Avatar Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
  • Posts: 24
  • Thank you received: 0
Hello....

when the posts need to be approved by an administrator, no messages appear because published is 0. This fact causes posting to fail with this error appearing in the text area:
<br />
<b>Notice</b>:  Undefined index:  id in <b>F:Web SitesPHPHagaloUstedMismoWebcomponentscom_commentjoscommentcomment.class.php</b> on line <b>1205</b><br />
<?xml version="1.0" standalone="yes"?><post><id></id><published></published><noerror>1</noerror><debug></debug><captcha><![CDATA[<a title="clic para recargar una nueva imagen" href='javascript:JOSC_reloadCaptcha()'><img src="http://hagaloustedmismo//components/com_comment/joscomment/captcha.php?refid=7066633b2c8559175caa7758efa61049" alt="Security Image" />
<input type="hidden" name="security_refid" value="7066633b2c8559175caa7758efa61049" /></a>]]></captcha></post>

This is due to the following code:
if ($ajax) {
			$data = $this->getComments(true);
              $after = -1;
              /* look for the right place */
              foreach($data as $item) {
                  if ($item['id'] == $this->_comment_id) {
                  	  $item['after'] = $after;
                      $item['view'] = $published;
                      $item['debug'] = $debug;
                      $item['noerror'] = 1;
                      return $item;
                  }
                  $after = $item['id'];
              }
              $data[0]['view'] = $published;
              $data[0]['debug']	= $debug;
              $data[0]['noerror'] = 1;
              return $data[0];
        } else return $published;

Since there is no comment published, $data variable is empty, so that $data[0] doesn't contain the id index.

To solve it, I added an if sentence at line 1204 of comment.class.php:
            if (isset($item['id']))
            	$xml .= '<id>' . $item['id'] . '</id>';

I don't know if this is the right solution, but it works :)

Cheers

Error when a comment is posted with no other comments published 14 years 9 months ago #5673

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Away
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
Could you try this and tell me if it works too?
compojoom.com/forum/17-jocomment-40/4762...mit=10&start=10#4875

Error when a comment is posted with no other comments published 14 years 9 months ago #5684

  • Jaime
  • Jaime's Avatar Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
  • Posts: 24
  • Thank you received: 0
It works too! thanks!

Error when a comment is posted with no other comments published 14 years 9 months ago #5732

  • JonusC
  • JonusC's Avatar
  • Offline
  • Platinum Boarder
  • Platinum Boarder
  • Posts: 785
  • Thank you received: 48
Daniel,

This is already bugfixed for Beta 2 release?
  • Page:
  • 1
Time to create page: 0.117 seconds