×
Kunena 5.2.6 released and Blue eagle 1.6.6 released (25 Jul 2021)

The Kunena team has announce the arrival of Kunena 5.2.6 [K 5.2.6] which is now available for download as a native Joomla extension for J! 3.9.x. This version addresses most of the issues that were discovered in K 5.2 and issues discovered during the development stages of K 5.2.6

Question Duplicate warning when user is not authorised to view attachment

  • Pinkeltje
  • Pinkeltje's Avatar Topic Author
  • Offline
  • Senior Member
  • Trying to find an answer before asking here
More
5 years 11 months ago #1 by Pinkeltje
When applying this setting:


And same for files, a duplicate warning appears in topic when user is not logged in:


Blue Eagle and Crypis.
A search on language constante shows that
COM_KUNENA_SHOWIMGFORGUEST_HIDEIMG
is in following files:

/libraries/kunena/bbcode/bbcode.php
/libraries/kunena/attachment/attachment.php


Maybe this helps to track the problem.

To make sure it didn't have anything to do with settings or template, I made a fresh Kunena 4.0.6 install on localhost using Blue Eagle and default Protostar template.
Attachments:

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

More
5 years 10 months ago - 5 years 10 months ago #2 by juliank92
Hi Pinkeltje,

I don't know why the Kunena team has chosen to display multiple messages? If you would ask me, i should say it should be enough if there is only one notification. (Let's say the blue one, but hey that is my and probably a different kind of logic)

The red colored notifications, where generated when there should be a attached image displayed by the BB tags. So in this case you should be looking in the file /libraries/kunena/bbcode/bbcode.php, there is a method/function there called renderAttachment on line 2212, you could replace it with the following:
	protected function renderAttachment(KunenaAttachment $attachment, $bbcode, $displayImage = true)
	{
		$layout = KunenaLayout::factory('BBCode/Attachment')
			->set('attachment', $attachment)
			->set('canLink', $bbcode->autolink_disable == 0);
 
		$config = KunenaConfig::getInstance();
 
		if (!$attachment->exists() || !$attachment->getPath())
		{
			return (string) $layout->setLayout('deleted');
		}
		elseif (!$attachment->isAuthorised() && !$config->showimgforguest)
		{
			return null;
		}
		elseif (!$attachment->isAuthorised())
		{
			return (string) $layout->setLayout('unauthorised');
		}
 
		$bbcode->parent->inline_attachments[$attachment->id] = $attachment;
 
		if ($displayImage && $attachment->isImage())
		{
			$layout->setLayout('image');
		}
 
		return (string) $layout;
	}

Basically i just added a condition, you should get the same the same if you replace the return null within this condition:
		elseif (!$attachment->isAuthorised())
		{
			return (string) $layout->setLayout('unauthorised');
		}
(But just to be safe i added a additional condition, since i don't know when the isAutorised method is false ;) )
Last edit: 5 years 10 months ago by juliank92.
The following user(s) said Thank You: Pinkeltje

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

  • Pinkeltje
  • Pinkeltje's Avatar Topic Author
  • Offline
  • Senior Member
  • Trying to find an answer before asking here
More
5 years 10 months ago #3 by Pinkeltje

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

More
5 years 10 months ago #4 by 810
You have reverted the change.

Why we added it, if you have attacht the images inline, you will see the warning message, that a image is hidden. Now you removed the warning message. So the guests don't know that there is a image in the message.

The issue, is that the image is checked 1 by 1. because it can be also a file attachment. That's why we didn't fixed the duplicated messages.

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

More
5 years 10 months ago #5 by juliank92
Thanks for explaining why it is implemented, it could be logical to display the notifications, at the positions where a image should be displayed(to clarify gaps in a post). However sometimes it is not, and if you're looking as a guest at topic's it is just like the forum is tripping.

Yeah, pretty much reverted it. Because if you have forumusers who attach 5 or more images and insert them in the post(straight below each other), it's just looking weird to me(being notified 6 times). So i am assuming that that one notification would be enough for them.

Maybe an idea to create an option in the Kunena back-end where you'll could set to show this notifications?

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

  • Pinkeltje
  • Pinkeltje's Avatar Topic Author
  • Offline
  • Senior Member
  • Trying to find an answer before asking here
More
5 years 10 months ago - 5 years 10 months ago #6 by Pinkeltje
As already mentionned in my first post: showing a message is ok, but there is no need to show a duplicate message.
Old situation:


After applying changes made by Juliank92:

Display for logged-in users (in both situations):
Attachments:
Last edit: 5 years 10 months ago by Pinkeltje.

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

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