Foren

Guest comments on blogs etc.

Nico Eshuis, geändert vor 13 Jahren.

Guest comments on blogs etc.

New Member Beiträge: 10 Beitrittsdatum: 04.01.11 Neueste Beiträge
Hello,

I've found several threads regarding the possiblity for guests to place comments. With guests i mean visitors without an account. These threads were mostly from 2007 or before so i was wondering, is this possible nowadays? I can't seem to find an answer online.

Many thanks in advance.

Nico Eshuis
Nico Eshuis, geändert vor 13 Jahren.

RE: Guest comments on blogs etc.

New Member Beiträge: 10 Beitrittsdatum: 04.01.11 Neueste Beiträge
Anyone?
thumbnail
Gustavo Fernández Gómez, geändert vor 13 Jahren.

RE: Guest comments on blogs etc.

Regular Member Beiträge: 191 Beitrittsdatum: 26.10.07 Neueste Beiträge
i think it will be posible in liferay 6.1.
thumbnail
Vishal Mehta, geändert vor 13 Jahren.

RE: Guest comments on blogs etc.

Junior Member Beiträge: 42 Beitrittsdatum: 08.03.11 Neueste Beiträge
Yes it is definitely possible. You need to give appropriate permission to guest role using control panel.
Nico Eshuis, geändert vor 13 Jahren.

RE: Guest comments on blogs etc.

New Member Beiträge: 10 Beitrittsdatum: 04.01.11 Neueste Beiträge
Hi Vishal,

Could you tell me how i can enable this functionality? I can't find it.

When i go to roles > guest > define permissions, i see three types of blog permissions i can set.

1. For the blog content
2. For the blog application
3. For the blog module in the control panel

Neither of them allowed me to place comments as an unauthorized user.
Correct me if i'm wrong of course.

Many thanks!
Nico Eshuis, geändert vor 13 Jahren.

RE: Guest comments on blogs etc.

New Member Beiträge: 10 Beitrittsdatum: 04.01.11 Neueste Beiträge
Finally found it when i was at the point of switching to WordPress: http://www.liferay.com/web/guest/community/forums/-/message_boards/message/1097421

Open portal-impl.jar, open classes\resource-actions\blogs.xml remove the guest-unsupported children elements related to discussion.
thumbnail
Maarten van Heiningen, geändert vor 13 Jahren.

RE: Guest comments on blogs etc.

Regular Member Beiträge: 174 Beitrittsdatum: 05.02.09 Neueste Beiträge
Hello,

Indeed the way to solve this is like this:

	<model-resource>
		<model-name>com.liferay.portlet.blogs.model.BlogsEntry</model-name>
		<portlet-ref>
			<portlet-name>33</portlet-name>
		</portlet-ref>
		<permissions>
			<supports>
				<action-key>ADD_DISCUSSION</action-key>
				<action-key>DELETE</action-key>
				<action-key>DELETE_DISCUSSION</action-key>
				<action-key>PERMISSIONS</action-key>
				<action-key>UPDATE</action-key>
				<action-key>UPDATE_DISCUSSION</action-key>
				<action-key>VIEW</action-key>
			</supports>
			<community-defaults>
				<action-key>ADD_DISCUSSION</action-key>
				<action-key>VIEW</action-key>
			</community-defaults>
			<guest-defaults>
				<action-key>VIEW</action-key>
			</guest-defaults>
			<guest-unsupported>
				<action-key>DELETE</action-key>
				<action-key>DELETE_DISCUSSION</action-key>
				<action-key>PERMISSIONS</action-key>
				<action-key>UPDATE</action-key>
				<action-key>UPDATE_DISCUSSION</action-key>
			</guest-unsupported>
		</permissions>
</model-resource>


You have to make a copy from the file blogs.xml which you can find inside the portal-impl.jar. Inside you have a directory /resource-actions/ here you will find the file blogs.xml

Now you create in your /ROOT/WEB-INF/classes/ directory a new folder /resource-actions/ and you copy this blogs.xml file into it.

You have to delete the lines (row 68) where the guest-unsupported define "ADD_DISCUSSION".

You have to clear your servers work directory and restart your server in order for this to work.

If you also delete the line for UPDATE_DISCUSSION be aware of the fact that all guests get the edit comment icon of all comment, so also the comments of others. The function will return a no permission message after they use the publish button.

Maarten
thumbnail
Maarten van Heiningen, geändert vor 13 Jahren.

RE: Guest comments on blogs etc.

Regular Member Beiträge: 174 Beitrittsdatum: 05.02.09 Neueste Beiträge
Hi Guys,

As this is NOT the standard way to edit Liferay (this is an EXT solution) I will discribe the ext-plugin solution for you as well.

What you need to do:
1)
  • Create an new ext-plugin project
  • Delete if it is there the portal-ext.properties file in the project sub folder /docroot/WEB-INF/ext-impl/src (otherwise it will overwrite your portal-ext which is already there on the server.
  • in the /docroot/WEB-INF/ext-web/docroot/WEB-INF/ folder create a subfolder called /classes/
  • in the /docroot/WEB-INF/ext-web/docroot/WEB-INF/classes folder create a subfolder called /resource-actions/
  • Copy the blogs.xml file into it and delete the line 68 where it says that the guest role has no permission to create "ADD_DISCUSSION"
  • Deploy or connect the project to you development server and test it.


Extra info:
When you make changes you need to manually replublish the server each time in order for the changes to be used by the server.

Maarten
sandeep tripathi, geändert vor 12 Jahren.

RE: Guest comments on blogs etc.

Regular Member Beiträge: 100 Beitrittsdatum: 19.10.11 Neueste Beiträge
Hi Maarten ,

i am trying to give my guest user to comment on the blog and i had follow your step to do it but it is not working for me .
do i need to do any other step after this i am using liferay 6.0.5 .
what i had done is i had created a war file and then deploy it on my tomcat .

Regards
Sandeep
thumbnail
Maarten van Heiningen, geändert vor 12 Jahren.

RE: Guest comments on blogs etc.

Regular Member Beiträge: 174 Beitrittsdatum: 05.02.09 Neueste Beiträge
Hi Sandeep,

Are you using the Liferay IDE & what is the content of your war?

Is the war file deployed correctly on the system?
sandeep tripathi, geändert vor 12 Jahren.

RE: Guest comments on blogs etc.

Regular Member Beiträge: 100 Beitrittsdatum: 19.10.11 Neueste Beiträge
Maarten van Heiningen:
Hi Sandeep,

Are you using the Liferay IDE & what is the content of your war?

Is the war file deployed correctly on the system?


i am using eclipse i had attach my war file pls have a look
sandeep tripathi, geändert vor 12 Jahren.

RE: Guest comments on blogs etc.

Regular Member Beiträge: 100 Beitrittsdatum: 19.10.11 Neueste Beiträge
Hi Maarten,

did you find mistake in my war file that i had send you ?
thumbnail
Maarten van Heiningen, geändert vor 12 Jahren.

RE: Guest comments on blogs etc.

Regular Member Beiträge: 174 Beitrittsdatum: 05.02.09 Neueste Beiträge
Hi Sandeep,

I just tested your file on a 6.0.5 and a 6.0.6.

On 6.0.6 it's working like it should so you did nothing wrong. (always good to know right.... emoticon

On 6.0.5 how ever the ext-plugin isn't loaded correctly this has nothing to do with your code or war file. I created a completely new one my self and this also isn't loaded correctly.
So this seems to be an other issue to do with ext-pluggins on 6.0.5.

How to continue and fix this.

You can and this is a dirty solution! create the folder structure on the server yourself. You do this by creating the following folder.
/ROOT/WEB-INF/classes/resource-actions/ (this folder resource-actions is the new one)

in this /resource-actions folder you copy the blogs.xml file

Restart would be best to do also after this.

Now you log in as an Omni Admin and go to the control panel
  • select "Roles" in Portal setting section
  • select "Guest" role and under "actions" select "Define permissions"
  • In the Drop down select "Blogs"
  • seledt the checkboxes for "Add Discussions" and "View"
  • Log out of the portal, so you are a guest
  • click "add comment" under a blog post


This should be it.

Let me know if this isn't working. It's a dirty solution but in 6.0.5 the only one for now.
Other suggestion.... upgrade to 6.0.6 or even better 6.1 as it is fully configurable in the 6.1

Best,
Maarten
sandeep tripathi, geändert vor 12 Jahren.

RE: Guest comments on blogs etc.

Regular Member Beiträge: 100 Beitrittsdatum: 19.10.11 Neueste Beiträge
Hi marteen ,

thanks so much for the information but i do not know about Omni Admin user id and password for Liferay Portal Community Edition 6.0.5 CE
i use test@liferay.com to do my admin related work can u please shareOmni Admin details also

thanks in advance .
Sandeep
sandeep tripathi, geändert vor 12 Jahren.

RE: Guest comments on blogs etc.

Regular Member Beiträge: 100 Beitrittsdatum: 19.10.11 Neueste Beiträge
Hi marteen ,

after reading article about user creation i think that test@liferay.com is a Omni user first i will have to create the folder structured that you said in my server and then try
the step that you told for control panel of adding discussion hope it is right .

Sandeep
sandeep tripathi, geändert vor 12 Jahren.

RE: Guest comments on blogs etc.

Regular Member Beiträge: 100 Beitrittsdatum: 19.10.11 Neueste Beiträge
hi marteen ,

i do not have check box for add discussion under define permission for guest for login test@liferay.com
thumbnail
Maarten van Heiningen, geändert vor 12 Jahren.

RE: Guest comments on blogs etc.

Regular Member Beiträge: 174 Beitrittsdatum: 05.02.09 Neueste Beiträge
Hi Sandeep,

Is the blog xml file correctly loaded? Also It might be usefull to restart the server and delete everything inside the folder /work/Catalina/localhost.

If all done then inside the control panel where you can define roles for the guest role you should select in the drop down box under the section "Content" -> "Blog".

You should now see the extra checkboxes for VIEW and ADD DISCUSSION

Best,
Maarten
sandeep tripathi, geändert vor 12 Jahren.

RE: Guest comments on blogs etc.

Regular Member Beiträge: 100 Beitrittsdatum: 19.10.11 Neueste Beiträge
Hi mareteen ,

thanks for ur information it is working for me now it is working with the same id test@liferay.com ...

sandeep
sandeep tripathi, geändert vor 12 Jahren.

RE: Guest comments on blogs etc.

Regular Member Beiträge: 100 Beitrittsdatum: 19.10.11 Neueste Beiträge
Hi

with the help of marteen i was able to view my guest user to post comment on the blog but my client need now to add the name of user who had commented ,
we were already capturing the log in name in custom.jsp with the help of session in my themes i had tried to use that value to display the name of user
in taglib discussion i had modify the page.jsp to check the value of login name
but in both the condition i am not getting the value of login name

String loginname = (String)request.getAttribute("loginname");

<c:choose>
<c:when test="<%= loginname != null %>">

<c:choose>
<c:when test="<%= messagesCount == 1 %>">
<liferay-ui:message key="no-comments-yet" /> <a href="<%= taglibPostReplyURL %>"> <liferay-ui:message key="be-the-first" /></a>
</c:when>
<c:otherwise>
<liferay-ui:icon
image="reply"
label="<%= true %>"
message="add-comment"
url="<%= taglibPostReplyURL %>"
/>
</c:otherwise>
</c:choose>
</c:when>
<c:otherwise>
<liferay-ui:message key="sign-in to vote" /> <a href="<%= link to login page %>">
</c:otherwise>
</c:choose>

do any body have any suggestion or idea .

Regards
Sandeep