Fórumok
Subscribing to a blog entry
Reza Vafatabar, módosítva 11 év-val korábban
Subscribing to a blog entry
New Member Bejegyzések: 4 Csatlakozás dátuma: 2012.09.21. Legújabb bejegyzések
Hi all,
I want to subscribe a user in to a specific blog.
I found this code from Liferay source:
ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
BlogsEntryLocalServiceUtil.subscribe(user.getUserId(), themeDisplay.getScopeGroupId());
but it doesn't solve my problem because it subscribe user to the current theme.
What I have is the blog Id and the User Id.
How can I get the scope group id of the blog by just having the blog Id or BlogEntry object?
I want to subscribe a user in to a specific blog.
I found this code from Liferay source:
ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
BlogsEntryLocalServiceUtil.subscribe(user.getUserId(), themeDisplay.getScopeGroupId());
but it doesn't solve my problem because it subscribe user to the current theme.
What I have is the blog Id and the User Id.
How can I get the scope group id of the blog by just having the blog Id or BlogEntry object?
Pavel Savinov, módosítva 11 év-val korábban
RE: Subscribing to a blog entry
Junior Member Bejegyzések: 94 Csatlakozás dátuma: 2012.09.24. Legújabb bejegyzések
Hi.
You can use getGroupId() of your BlogsEntry object.
You can use getGroupId() of your BlogsEntry object.
BlogsEntry blogsEntry; /* your blog entry object */
BlogsEntryLocalServiceUtil.subscribe(user.getUserId(), blogEntry.getGroupId());
Ketan Patel, módosítva 11 év-val korábban
RE: Subscribing to a blog entry
Junior Member Bejegyzések: 72 Csatlakozás dátuma: 2012.05.04. Legújabb bejegyzések
Hi!
As per my knowledge and understanding there is nothing like a Scope Group Id of blog.
you can get the blog group id through blogEntry.getGroupId();
themeDisplay.getScopeGroupId(); returns the id of the group the page you are viewing is in. it should be the same as themeDisplay.getLayout().getGroupId()
Thanks,
Ketan
As per my knowledge and understanding there is nothing like a Scope Group Id of blog.
you can get the blog group id through blogEntry.getGroupId();
themeDisplay.getScopeGroupId(); returns the id of the group the page you are viewing is in. it should be the same as themeDisplay.getLayout().getGroupId()
Thanks,
Ketan
Reza Vafatabar, módosítva 11 év-val korábban
RE: Subscribing to a blog entry
New Member Bejegyzések: 4 Csatlakozás dátuma: 2012.09.21. Legújabb bejegyzések
Thanks for the replies guys.
Ketan:
I tried this solution with no luck.
I think the problem is that I want to subscribe another user to the blog and not the current user.
I want to write a portlet which admin can use to subscribe other users to the blog.
So if I use ThemeDisplay, it will give me the scope of the admin and not other users.
Pavel:
I tried your solution as well and it works with no error but other users ( who has been subscribed to the blog using this portlet by admin ) haven't received a subscribe email and when they login the "Subscribe" link in the blog still there and didn't change to "Unsubscribe"
I really need to resolve this issue so please help!
Reza
Ketan:
I tried this solution with no luck.
I think the problem is that I want to subscribe another user to the blog and not the current user.
I want to write a portlet which admin can use to subscribe other users to the blog.
So if I use ThemeDisplay, it will give me the scope of the admin and not other users.
Pavel:
I tried your solution as well and it works with no error but other users ( who has been subscribed to the blog using this portlet by admin ) haven't received a subscribe email and when they login the "Subscribe" link in the blog still there and didn't change to "Unsubscribe"
I really need to resolve this issue so please help!
Reza
Pavel Savinov, módosítva 11 év-val korábban
RE: Subscribing to a blog entry
Junior Member Bejegyzések: 94 Csatlakozás dátuma: 2012.09.24. Legújabb bejegyzések
Do you mean that when you´ve invoked subscribe method for one user all other users were unsubscribed?
Reza Vafatabar, módosítva 11 év-val korábban
RE: Subscribing to a blog entry
New Member Bejegyzések: 4 Csatlakozás dátuma: 2012.09.21. Legújabb bejegyzések
No, I just mean that invoking this method doesn't subscribe the user to the blog.
Admin is invoking the portlet ( method ) in the control panel to subscribing another user ( user A not himself ) to a blog.
but it doesn't do the job.
Admin is invoking the portlet ( method ) in the control panel to subscribing another user ( user A not himself ) to a blog.
but it doesn't do the job.
Reza Vafatabar, módosítva 11 év-val korábban
RE: Subscribing to a blog entry
New Member Bejegyzések: 4 Csatlakozás dátuma: 2012.09.21. Legújabb bejegyzések
Please give me a solution on this?
Pawel Kruszewski, módosítva 9 év-val korábban
RE: Subscribing to a blog entry
New Member Bejegyzések: 3 Csatlakozás dátuma: 2009.04.09. Legújabb bejegyzések
Hi there,
for other users that were looking for a good solution like me:
groupId - is a groupId of a Site where you want your user to be subscribed to blogs.
Greets,
Pawel
for other users that were looking for a good solution like me:
SubscriptionLocalServiceUtil.addSubscription(
userId,
groupId,
BlogsEntry.class.getName(),
groupId);
groupId - is a groupId of a Site where you want your user to be subscribed to blogs.
Greets,
Pawel