Kunena 6.2.6 released

The Kunena team has announce the arrival of Kunena 6.2.6 [K 6.2.6] which is now available for download as a native Joomla extension for J! 4.4.x/5.0.x. This version addresses most of the issues that were discovered in K 6.1 / K 6.2 and issues discovered during the last development stages of K 6.2

This category is for the plugin developed, endorsed, maintained and supported by the Kunena project team. The topics in this category only relate to the plugin developed for K 3.0 and later versions.

If you are having problems then, for your own benefit, it would save us all a lot of time if you would kindly post your configuration report when you ask for help from this forum. If you do not post your configuration report we will not ask you for it but you will probably not get your problem solved, either.

Question Kunena Discuss 3.0 Plugin does not allow guests to be the first to post article comments.

More
10 years 10 months ago #1 by nemmar
Hi,

The same bug from K2.0 Discuss plugin is still in K3.0 Discuss plugin. I just installed K3.0 updates to my site forum and tested this out. If Joomla cache is enabled a Guest cannot post a comment in the K Discuss plugin (or cannot be the FIRST to post a comment in an article).

You can see the support forum posts and details of the github.com bug report links below:

github.com/Kunena/Kunena-Addons/issues/120

www.kunena.org/forum/K-2-0-Kunena-Discus...es-to-make-a-comment

www.kunena.org/forum/K-2-0-Kunena-Discus...es-to-make-a-comment


Can anyone let me know how to notify the GitHub developer working on this?
I know the Kunena devs volunteer to work on Kunena but is there any way someone can take care of this bug since it's about a year old now from K2.0-3.0?

Let me know if you need my K3.0 Config Report with this post but I don't think it matters with this issue since it seems like a Joomla cache and K Discuss conflict.

Thanks!

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

More
10 years 10 months ago - 10 years 10 months ago #2 by gray
Found the reason and quick solution.

The error
Fatal error: Call to a member function newReply() on a non-object in ...\plugins\content\kunenadiscuss\kunenadiscuss.php
appears with disabled cache, but with enabled option "Require email".

Bug description:

1) function createTopic() in the kunenadiscuss.php tries to create first topic (aka created by robot) and it does not pass any email in params
Code:
$params = array( 'subject' => $subject, 'message' => $contents, );
If you check replyTopic() in the same file, you'll see that params already contain email.

2) Plugin should create 2 messages - one automatic (by robot) which has no email(!) and 2nd - with email entered by user.

3) When the code tries to save messages with the help of KunenaForumMessage class, it goes through check which cannot be passed by 1st message (robot).
Code:
// Check email address $this->email = trim($this->email); if ($this->email) { // Email address must be valid if (! JMailHelper::isEmailAddress ( $this->email )) { $this->setError ( JText::sprintf ( 'COM_KUNENA_LIB_MESSAGE_ERROR_EMAIL_INVALID' ) ); return false; } } else if (! KunenaUserHelper::getMyself()->exists() && KunenaFactory::getConfig()->askemail) { $this->setError ( JText::_ ( 'COM_KUNENA_LIB_MESSAGE_ERROR_EMAIL_EMPTY' ) ); return false; }

My quick solution:
in protected function createTopic($row, KunenaForumCategory $category, $subject) from kunenadiscuss.php find
Code:
$params = array( 'subject' => $subject, 'message' => $contents, ); $safefields = array( 'category_id' => intval($category->id) ); list ($topic, $message) = $category->newTopic($params, $this->params->get ( 'topic_owner', $row->created_by ), $safefields);
and replace with
Code:
// hack by Gray <www.justphp.net> $topic_owner = $this->params->get( 'topic_owner', $row->created_by ); // save the ID for later use $user = KunenaUserHelper::get( $topic_owner ); $email = $user->email; // get real email $params = array( 'email' => $email, // we need to pass email of the topic starter (robot) when 'Require E-mail' option is enabled 'subject' => $subject, 'message' => $contents, ); $safefields = array( 'category_id' => intval( $category->id ) ); list( $topic, $message ) = $category->newTopic( $params, $topic_owner, $safefields ); // end hack

Note:
That's the solution I could found in a limited time frame. More beautiful solution would be adding one more condition to the statement
Code:
} else if (! KunenaUserHelper::getMyself()->exists() && KunenaFactory::getConfig()->askemail) { $this->setError ( JText::_ ( 'COM_KUNENA_LIB_MESSAGE_ERROR_EMAIL_EMPTY' ) ); return false; }
which should check if it's a topic started by the plugin - and do not require the email at all. Can anyone propose such a check? Or a better solution?

www.justPHP.net - Custom coding for Joomla!
Last edit: 10 years 10 months ago by gray. Reason: corrected code
The following user(s) said Thank You: sozzled, GJSchaller, Jiminimonka

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

More
10 years 10 months ago #3 by nemmar
Does anyone know when the Discuss Plugin will have the bug fixed?

That would be a better solution than making code changes.

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

More
10 years 7 months ago #4 by nemmar
Hi,

I installed the Kunena Discuss 3.0.1 Plugin with the K3.0.2 forum update. However, it still does not allow guests to be the first to post article comments.

Can anyone tell me if this Discuss plugin will ever have this bug fixed, or is it a minor bug that the Kunena developers don't have time to fix? I've posted a number of times about this bug since the problem started in K2.0 Discuss plugin but it never seems to get fixed. Is no one else having problems with this bug on their sites?

Thanks for any info.

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

More
10 years 7 months ago #5 by awinkler
I have the same problem. The discuss part doesn't get displayed after the text, not even the header.

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

More
10 years 7 months ago #6 by gray
I've published the solution (see above). Not sure it's the best one, as I didn't get any feedback from the core team.

PS. Can add this hack to the newest release, but don't know how.

www.justPHP.net - Custom coding for Joomla!

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

More
10 years 7 months ago #7 by Jiminimonka
Thanks for patch above gray. Would you mind adding that to Kunena Discuss on GitHub as it will be more likley to get included in the next update to Kunena, plus you could get yourself added into the credits for Kunena :) - and it will really help the team out.

Please read the FAQ.
Only one question per topic.
Search before you ask a question.

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

More
10 years 7 months ago #8 by awinkler
I've patched the kunenadiscuss.php file as suggested above, but it made no difference. It didn't do any harm, but the form to enter the first comment is still not being displayed if the user is not logged in.

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

More
10 years 5 months ago #9 by gray
Tried my fix with pugin v. 3.0.1 and Kunena v. 3.0.3. It works for me.
Created pull request github.com/Kunena/Kunena-Addons/pull/159

www.justPHP.net - Custom coding for Joomla!
The following user(s) said Thank You: Jiminimonka

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

More
10 years 5 months ago #10 by Matias

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

Time to create page: 0.390 seconds