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.
- PLai@plai
PLai - 0 likes
- Alex Shu@oxigen
Alex Shu - 0 likes
- Trajan@Trajan
Trajan - 0 likes
- Alex Shu@oxigen
Alex Shu - 0 likes
- PLai@plai
PLai - 0 likes
- gushbellino@gushbellino
gushbellino - 0 likes
- gushbellino@gushbellino
gushbellino - 0 likes
- Alex Shu@oxigen
Alex Shu - 0 likes
You must log in to post replies.Some of my comments to "Delaying the system loading of widgets???" may be applicable. Basically you need to undo the effect of an add_widget_type() call.
PLai, thank you for your answer.
Unfortunately, the discussion your give me link for is inapplicable for me. I try to determine what the profile user request to view, and if it's someone's else profile - do not to call the add_widget_type() while 'init', 'system' event handler of the plugin that define this widget is executing, but widget is shown anyway. Also I trying to use the remove_widget_type() function, but there's no results too.
If someone have any ideas of how to completely hide the widget if it's undesirable - I'll be very grateful.
I'm not sure how possible this is. I have played around with widgets and have managed to restrict their access to certain usertypes on my site. Here is what I'm using:
If the user is not a teacher on my site then when they try to add widgets to their profile this widget doesn't appear. This code goes in the start.php of the plugin where the widget comes from. But I get the feeling this won't solve your problem, because what you want is to display a widget on everyone's profile, but only allow non-profile-owner users to see it. I have no idea how to actually do that. What's more you need to be aware that the profile-owner can remove the widget from their profile when going to the 'edit page' link if they wanted to.
Trajan, thank you, but this is not in my case. Every user must have this widget when he looking on his profile, however I need to hide the target widget when another user is viewing the profile of someone else.
Alex, you are right. Avoiding add_widget_type() does not hide a widget. My reading of the code was not complete.
The solution may actually be much simpler. You can just override the "widgets/wrapper" which is used to display a widget. Just put a views/default/widgets/wrapper.php to a plugin of your own. The following would hide the the blog widget:
Hope this helps.
Hi,
I have tested it and it works. I guess if this is what Alex Shu wants then it will help. Maybe it is a nice idea to make a plugin.
Regards.
Alex Shu Just a small issue, remember to disable and enable the plugin where you put the new view.
Regards.
Thank you all who give me an answers!
PLai - it's really great idea, this is the solution I'll use.
gushbellino - do you mean that I should toggle the plugin OFF and then ON? but what exactly should happen by these actions? If you mean the troubles with simplecache - it's not a problem because the site is in DEV mode and simplecache now disabled. If there's some else - please describe in more detail, so I better understand the mechanism used for this.