I'm developing a plugin that shows a facebook share button in content pages.
I just need to show the share button only when the current content has public access level. I think that isn't useful to share content that hasn't public access level.
Can I know if the current page has public access level? How?
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by RaĆ¼l Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.
- Trajan@Trajan
Trajan - 0 likes
- DhrupDeScoop@Dhrup2000
DhrupDeScoop - 0 likes
- Trajan@Trajan
Trajan - 0 likes
- adayth@felfo
adayth - 0 likes
- adayth@felfo
adayth - 0 likes
You must log in to post replies.if the current page is an object of some kind such blog,poll,page etc. you can call
which will show you the access of the entity/object you are looking at. So you could do the following:
that should work for you.
@T: access == 0 is private.. r u @ typo ? ;-)
oh yeah, my bad. should be a 2 not a 0.
Thank you for your responses, but this doesn't work, so I will explain my problem more.
I'm using elgg 1.8.0.1 and I'm extending sidebar view with:
elgg_extend_view('page/elements/sidebar', 'myplugin/extend', 500);
And I call in my view:
print_r(array_keys($vars));
So I always get this when some content is rendered:
Array ( [0] => content [1] => sidebar [2] => user [3] => config [4] => url )
But $vars['content'] is html code and no $vars['entity'] is avalaible.
¿Maybe can we get the entity through a hook?
I noticed a similar "fail" about the always present sidebar RSS feed button. For example, if I link the RSS feed to blog posts of foo user and these posts doesn't have public access level, elgg shows an access error when triying to use this link in a RSS feed reader.
Is not useless trying to link a RSS feed that doesn't have public content?