Keyword

Comments not loading after posting

More
8 years 10 months ago #149050 by Sam
Hi there!

After a long night and several attempts to find a solution by myself I just decided to post my problem here:
Iam using K2 (newest) in combination with CB and URL rewriting for different languages. Everything works fine as long as I do not use the comments function. Even when the comments function is enabled I can see the comments form and can use it without any problems but after posting the first comment, Joomla stops loading the article correctly - it breaks up on loading the "CommentsList" and does not include the cms template as the sourcecode shows.

Here you can see an example:


I tried to disable URL Rewriting, tried to transfer all Users from Joomla to K2 Groups etc. but nothing works.
Anyone an idea?

Thanks!

Please Log in or Create an account to join the conversation.

More
8 years 10 months ago #149051 by Sam
Replied by Sam on topic Comments not loading after posting
Ooops, here's the URL again:
http : // likn.de/P4l

Please Log in or Create an account to join the conversation.

More
8 years 10 months ago #149066 by Lefteris
Replied by Lefteris on topic Comments not loading after posting
Hi,

The page is broken which means that probably there is a PHP fatal error. Set error reporting to "Maximum" under global configuration so you can see the error.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

More
8 years 10 months ago #149097 by Sam
Replied by Sam on topic Comments not loading after posting
Alright, thank you very much Lefteris! After enabling error reporting I got at the very end of the page this error:
Notice: Undefined property: stdClass::$comments in /mnt/webb/c0/85/53913885/htdocs/de/templates/jf_taman/html/com_k2/default/item.php on line 538 Warning: Invalid argument supplied for foreach() in /mnt/webb/c0/85/53913885/htdocs/de/templates/jf_taman/html/com_k2/default/item.php on line 538
Fatal error: Call to a member function getPagesLinks() on a non-object in /mnt/webb/c0/85/53913885/htdocs/de/templates/jf_taman/html/com_k2/default/item.php on line 595

item.php tells me this (as I assumed, it is something wrong with my templates' itemcomments - lines:522 - 598:
<div class="itemComments">

	  <?php if($this->item->params->get('commentsFormPosition')=='above' && $this->item->params->get('itemComments') && !JRequest::getInt('print') && ($this->item->params->get('comments') == '1' || ($this->item->params->get('comments') == '2' && K2HelperPermissions::canAddComment($this->item->catid)))): ?>
	  <!-- Item comments form -->
	  <div class="itemCommentsForm">
	  	<?php echo $this->loadTemplate('comments_form'); ?>
	  </div>
	  <?php endif; ?>

	  <?php if($this->item->numOfComments>0 && $this->item->params->get('itemComments') && ($this->item->params->get('comments') == '1' || ($this->item->params->get('comments') == '2'))): ?>
	  <!-- Item user comments -->
	  <h3 class="itemCommentsCounter">
	  	<span><?php echo $this->item->numOfComments; ?></span> <?php echo ($this->item->numOfComments>1) ? JText::_('K2_COMMENTS') : JText::_('K2_COMMENT'); ?>
	  </h3>

	  <ul class="itemCommentsList">
	    <?php foreach ($this->item->comments as $key=>$comment): ?>
	    <li class="<?php echo ($key%2) ? "odd" : "even"; echo (!$this->item->created_by_alias && $comment->userID==$this->item->created_by) ? " authorResponse" : ""; echo($comment->published) ? '':' unpublishedComment'; ?>">

	    	<span class="commentLink">
		    	<a href="<?php echo $this->item->link; ?>#comment<?php echo $comment->id; ?>" name="comment<?php echo $comment->id; ?>" id="comment<?php echo $comment->id; ?>">
		    		<?php echo JText::_('K2_COMMENT_LINK'); ?>
		    	</a>
		    </span>

				<?php if($comment->userImage): ?>
				<img src="<?php echo $comment->userImage; ?>" alt="<?php echo JFilterOutput::cleanText($comment->userName); ?>" width="<?php echo $this->item->params->get('commenterImgWidth'); ?>" />
				<?php endif; ?>

				<span class="commentDate">
		    	<?php echo JHTML::_('date', $comment->commentDate, JText::_('K2_DATE_FORMAT_LC2')); ?>
		    </span>

		    <span class="commentAuthorName">
			    <?php echo JText::_('K2_POSTED_BY'); ?>
			    <?php if(!empty($comment->userLink)): ?>
			    <a href="<?php echo JFilterOutput::cleanText($comment->userLink); ?>" title="<?php echo JFilterOutput::cleanText($comment->userName); ?>" target="_blank" rel="nofollow">
			    	<?php echo $comment->userName; ?>
			    </a>
			    <?php else: ?>
			    <?php echo $comment->userName; ?>
			    <?php endif; ?>
		    </span>

		    <p><?php echo $comment->commentText; ?></p>

				<?php if($this->inlineCommentsModeration || ($comment->published && ($this->params->get('commentsReporting')=='1' || ($this->params->get('commentsReporting')=='2' && !$this->user->guest)))): ?>
				<span class="commentToolbar">
					<?php if($this->inlineCommentsModeration): ?>
					<?php if(!$comment->published): ?>
					<a class="commentApproveLink" href="<?php echo JRoute::_('index.php?option=com_k2&view=comments&task=publish&commentID='.$comment->id.'&format=raw')?>"><?php echo JText::_('K2_APPROVE')?></a>
					<?php endif; ?>

					<a class="commentRemoveLink" href="<?php echo JRoute::_('index.php?option=com_k2&view=comments&task=remove&commentID='.$comment->id.'&format=raw')?>"><?php echo JText::_('K2_REMOVE')?></a>
					<?php endif; ?>

					<?php if($comment->published && ($this->params->get('commentsReporting')=='1' || ($this->params->get('commentsReporting')=='2' && !$this->user->guest))): ?>
					<a class="modal" rel="{handler:'iframe',size:{x:560,y:480}}" href="<?php echo JRoute::_('index.php?option=com_k2&view=comments&task=report&commentID='.$comment->id)?>"><?php echo JText::_('K2_REPORT')?></a>
					<?php endif; ?>

					<?php if($comment->reportUserLink): ?>
					<a class="k2ReportUserButton" href="<?php echo $comment->reportUserLink; ?>"><?php echo JText::_('K2_FLAG_AS_SPAMMER'); ?></a>
					<?php endif; ?>

				</span>
				<?php endif; ?>

				<div class="clr"></div>
	    </li>
	    <?php endforeach; ?>
	  </ul>

	  <div class="itemCommentsPagination">
	  	<?php echo $this->pagination->getPagesLinks(); ?>
	  	<div class="clr"></div>
	  </div>
		<?php endif; ?>

Any idea?

Please Log in or Create an account to join the conversation.

More
8 years 10 months ago - 8 years 10 months ago #149099 by Sam
Replied by Sam on topic Comments not loading after posting
Aw and to shorten it up:

Line 538 is:
<?php foreach ($this->item->comments as $key=>$comment): ?>

and Line 595:
<?php echo $this->pagination->getPagesLinks(); ?>

This template was working well with an older K2 version but since I have updated K2 everything works fine in exception of comments. Do I have to update these two lines or something? It seems that something is not getting found. Or maybe a routing problem?
Last edit: 8 years 10 months ago by Sam.

Please Log in or Create an account to join the conversation.

More
8 years 10 months ago - 8 years 10 months ago #149107 by Sam
Replied by Sam on topic Comments not loading after posting
Alright, in the meantime I checked if this issue comes up with another template and it does. I also tried to replace the k2 item.php comments section with my templates' item.php and it did not work, just the same thing. So i guess it is not a template issue right? Additionally I tried to disable all possible plugins as well as several global configuration settings but all without luck. Anyone else an idea?

UPDATE:
I could solve it by myself - just uploaded a fresh copy of com_k2 and for some reason it works now!
Thanks anyway!
Last edit: 8 years 10 months ago by Sam.

Please Log in or Create an account to join the conversation.

More
8 years 10 months ago #149127 by Lefteris
Replied by Lefteris on topic Comments not loading after posting
You are welcome.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

More
8 years 3 months ago #155509 by daniel roberts
Replied by daniel roberts on topic Comments not loading after posting
Good Morning, this is an old post, but I had the same problem, whilst I have no idea what the underlying issue is, I just followed the :

I could solve it by myself - just uploaded a fresh copy of com_k2 and for some reason it works now!


And the issue was resolved.

So thanks,

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 3 months ago #155526 by Krikor Boghossian
Replied by Krikor Boghossian on topic Comments not loading after posting
Hello Daniel, can you post a link to your site?

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum