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

Role based custom text/HTML on Dashboard | Forum

Arie Odendaal
Arie Odendaal Sep 15 '14
Is there a way to display a custom text/HTML on the Dashboard based on the user role?

I want to display a short HTML guide to the user explaining how the site works. This will differ between "free" users and "Experts" because the free users aren't allowed to post everywhere or to create groups.

If this cannot be done on the Dashboard, is there any plugin that can do this for me?
ross Team
ross Sep 15 '14
Unfortunately you cannot show different content of custom html/text widget to different user roles, in the default software you can restrict to show it to some user role. 

What you want to achieve is considered as a custom code modification. 

Arie Odendaal
Arie Odendaal Sep 16 '14
Thank you for the feedback, I will look at having this developed.
ross Team
ross Sep 16 '14
Topic was moved from General Questions.
Daisy Team
Daisy Oct 15 '14
Arie Odendaal, you can create two widgets with the different content: one for the 'Free' and one for the 'Experts' membership type.  The only thing is that every user on the site has the 'Free' role assigned by default and there is no possibility to uncheck this role.  

All I can suggest you in this situation is to remove the 'disabled' status from the default role checkbox, so you could uncheck if for the 'Experts' users. But, before giving you the solution, be noticed that a user must have at least one role - so if you uncheck the free, this assumes that you check the 'Experts' role and vise versa. If you uncheck both roles - this may lead to negative consequences. Here is the solution:

Open the /ow_system_plugins/base/components/give_user_role.php file. Search for the following string:

if (in_array($role->getId(), $userRolesIdList) && $role->getSortOrder() == 1)

and simply comment the whole clause:

if (in_array($role->getId(), $userRolesIdList) && $role->getSortOrder() == 1)
                $field->addAttribute('disabled', 'disabled');