Hey everyone!
I'm trying to customize Groups but i have some problems. What I'm trying to do is that only moderators can create or edit groups. So i added a new profile field which only admins can change and now i try to check this field at the current user. Similar to the elgg_is_Admin_logged_in()-Method i wrote something. But the last check won't work:
return $user->attributes['moderator'] == 'Yes';
'moderator' is the name of the field. After i looked into the references i think the profile fields are not saved as "attributes" in the user instant so i tried to check it via a SQL-Statment. This is a hardcoded but i would work:
SELECT COUNT(*) FROM elgg_metadata WHERE name_id = 229 AND entity_guid = $user_guid
name_id is the id of the moderator field! If this returns a 1, the user is a moderator but how can i recieve the return value in "elggisch"? I only know how to get lists of users/entities with a SQL Statement.
I saw this plugin: http://community.elgg.org/plugins/847281/1.0.0/moderators-for-roles but i didn't see anything changed on my page :-/.
=> This problem should now be solved! I now get what the moderators_for_roles plugin does! <- my fault!
Second Question: Is it possible to distinguish selfmade roles with the Profile Manager 7.3 plugin and change the background color depending on the role of the user. As an example: We have two roles (customer and seller) and a normal entry like mine now. Now the customers give some comments but if a seller write a comment the background of this comment (and only this one) is red or what ever. Now everyone can see due to the background that this post is from a seller.
Thanks in advance!
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.