×
Kunena 5.1 Released (13 May 2018)

The Kunena team is pleased to announce Kunena 5.1.0 [K 5.1.0].
Please read the blog post for information: www.kunena.org/blog/192-kunena-5-1-released

Question Bug: Configuration 'User Edits - Yes, except no replies' not working properly

More
5 months 14 hours ago #1 by WolfgangOWL
I'm on Kunena 5.0.12 and the configuration option 'User Edits - Yes, except no replies' does not work as expected.

It does only affect the delete-button. In my humble opinion this should also hide the edit-button when the option is set. At least I would expect this behaviour since the option suggests that. I'm pretty sure this worked correctly in the past. I don't know in which Kunena version the behaviour changed.

Do you have a patch for me?

I wish everyone a merry Christmas,
Wolfgang

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

More
5 months 9 hours ago #2 by rich
Yes you're right, it does not work anymore. But for me it was also a bug before. It makes no sense, to edit a previously message, when already a answer exist.

Please correct me if I'm wrong: The text "Yes, except no replies" means grammatically, the user can always edit, it's only forbidden, if still nobody has answered. And exactly so has worked this option in previously versions.

It should be:
User Edits - Yes, when no replies

Can you confirm this?

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

More
5 months 8 hours ago #3 by WolfgangOWL
Hi Rich,

yes, you are right. The option should be named 'Yes, when no replies' or 'Yes, except when replies'. I didn't think about this because it makes absolutely no sense the other way round.

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

More
5 months 8 hours ago #4 by rich
Thank you for the confirmation Wolfgang!

I will create a ticket on Git.
The following user(s) said Thank You: WolfgangOWL

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

More
4 months 3 weeks ago #5 by WolfgangOWL
Hello Rich,

I saw at Git that 810 added a commit for this bug. He made a change in line 1646 in libraries/kunena/forum/message/message.php.

Unfortunately, this change is not working correctly.
if (intval($config->useredit) == 2 && $this->getTopic()->getReplies())

This means if there is any reply within a topic a user can't edit his own post, even if the last post is his own.

The following change should fix it:
if (intval($config->useredit) == 2 && $this->getTopic()->getReplies() && $this->getTopic()->last_post_id > $this->id)

Could you possibly contact 810 to check.

Thank you,
Wolfgang
The following user(s) said Thank You: rich

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

More
4 months 3 weeks ago - 4 months 3 weeks ago #6 by rich
Hello Wolfgang,

Thanks for the hint! I've noticed this mistake before read this message and created a new ticket, because this problem now also exists at the Option "User can delete when no replies". github.com/Kunena/Kunena-Forum/issues/5688
But I've now 810 made aware of your contribution.
Last edit: 4 months 3 weeks ago by rich.
The following user(s) said Thank You: WolfgangOWL

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

More
4 months 3 weeks ago #7 by 810
ok should be fixed now on the nightly build on the download page.

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

More
4 months 3 weeks ago - 4 months 3 weeks ago #8 by WolfgangOWL
I installed the nightly build but it does not work as expected. As the code is it can't:

if (intval($config->useredit) == 0)
{
	return new KunenaExceptionAuthorise(JText::_('COM_KUNENA_POST_EDIT_NOT_ALLOWED'), 403);
}
 
if (intval($config->useredit) == 2 && $this->getTopic()->getReplies())
{
	return new KunenaExceptionAuthorise(JText::_('COM_KUNENA_POST_EDIT_NOT_ALLOWED'), 403);
}
 
if ($this->getTopic()->getReplies() && $this->getTopic()->last_post_id > $this->id)
{
	return new KunenaExceptionAuthorise(JText::_('COM_KUNENA_POST_EDIT_NOT_ALLOWED'), 403);
}

Is it possible that I may have fetched the wrong nightly build?
Last edit: 4 months 3 weeks ago by WolfgangOWL.

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

More
4 months 3 weeks ago #9 by 810
You can only edit the first topic message, when there are no replies.

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

More
4 months 3 weeks ago - 4 months 3 weeks ago #10 by WolfgangOWL
I'm sorry, but there is no option for 'only edit the first topic message when there are no replies' and I see no reason why it should.

It is really hard for me not to get sarcastic here, but I hold back myself.

To make clear how it should work see this code where the if-statements are based on the selected option:

if (intval($config->useredit) == 0)
{
    /* user is never allowed to edit own post */    
    return new KunenaExceptionAuthorise(JText::_('COM_KUNENA_POST_EDIT_NOT_ALLOWED'), 403);
}
elseif (intval($config->useredit) == 1)
{
    /* user is always allowed to edit own post */
    /* no action needed here */    
}
elseif (intval($config->useredit) == 2)
{
    /* user is only allowed to edit own post when no replies */  
    /* check if the post has any replies */
    if ($this->getTopic()->getReplies() && $this->getTopic()->last_post_id > $this->id)
    {
        return new KunenaExceptionAuthorise(JText::_('COM_KUNENA_POST_EDIT_NOT_ALLOWED'), 403);
    }
}
Last edit: 4 months 3 weeks ago by WolfgangOWL.

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

  • Not Allowed: to create new topic.
  • Not Allowed: to reply.
  • Not Allowed: to add attachements.
  • Not Allowed: to edit your message.
Time to create page: 0.124 seconds