We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

How to make a widget disappear when user signed-in? | Forum

Richard Carr
Richard Carr Mar 2 '13
I am trying to make a custom html widget disappear on the home page when a user signs in - Is this possible?
Unique
Unique Mar 2 '13
http://www.oxwall.org/roadmap
Allow to control permissions for index/dashboard widgets
Purusothaman Ramanujam
It is possible.

In the php file of that particular widget (in controller/components folder)

Check

if(OW::getUser()->isAuthenticated()){
  return;
}
Alberto MC
Alberto MC Mar 3 '13
I have three custom text/HTML on my index page and I want to make visible the three widgets for guests and visible only two widgets for logged in users. I found "return self::ACCESS_ALL;" in /ow_system_plugins/base/components/custom_html_widget.php line 96, but this permission affects to all the widgets, so I want to know if there is a way to keep the widgets visibles and non visibles.
Purusothaman Ramanujam

Quote from Purusothaman Ramanujam if(OW::getUser()->isAuthenticated()){ return; }

You can use this as you want.. using "return" will make the widget invisible.
Richard Carr
Richard Carr Mar 3 '13
What i am actually trying to do is to make an image [its my JOIN button] on the index page in the sidebar disappear when users signed in. Image code is in a 'custom html box' - Is this possible?
Alberto MC
Alberto MC Mar 3 '13
Purus: I did not know where to put the code. I put it in differents places into the file /ow_system_plugins/base/components/custom_html_widget.php without success.


Richard: That's exactly that I want. If you are using only one widget of the kind "custom text/HTML" you just need edit the file /ow_system_plugins/base/components/custom_html_widget.php and change line 96 to return self::ACCESS_GUEST. I repeat, this will work only if you have one widget, because if you have more widgets of the same kind, will be invisibles too (that's my case).

Alberto MC
Alberto MC Mar 3 '13
Richard: This is not elegant but you can put the code inside the join widget, instead the text put <img src="image" />. 
Purusothaman Ramanujam

Quote from Pablo Alberto Purus: I did not know where to put the code. I put it in differents places into the file /ow_system_plugins/base/components/custom_html_widget.php without success.

You should put that in the widget file that you want.

For example if you want this done for the groups widget..
ow_plugins/group/component is the place
Alberto MC
Alberto MC Mar 4 '13
Thanks Purus for your support, but I think I'll wait for the next update :(
Richard Carr
Richard Carr Mar 5 '13
I tried this pablo - it worked but i cant change it back now for some reason or alter it at all, any ideas... I tried going into languages but when i try to save changes it leads me to 'Page not found'
Alberto MC
Alberto MC Mar 7 '13
Richard: You can go to language file in ../ow_pluginfiles/base/lang_x.php and edit it.
The Forum post is edited by Alberto MC Mar 7 '13
Manoj Chettry
Manoj Chettry Mar 7 '13
hii puru do you have idea about this matter!

in news feed '"puru joined our site" i want to make it puru joined(sitename)
how to do that??
Purusothaman Ramanujam
edit the language string.. add {$site_name} to the string.
Alberto MC
Alberto MC Apr 19 '13
Solved with 1.5.2