Hi...
I want to Dispaly the groups which the user not member of the group..
is ti possible?
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.
Sure, get the latest groups (X) > get the groups the logged in user is a member of (y) and your answer is X-Y. Just look at the code of groups plugin and you will understad how to get values for X and Y.
To Dispaly the groups which the user member , iam using this code...
$groups = elgg_get_entities_from_relationship(array('relationship'=> 'member', 'relationship_guid'=> $owner->guid, 'inverse_relationship'=> FALSE, 'type'=> 'group', 'limit'=> 5));
hai....
To Dispaly the groups which the all members , iam using this code...
$allgroups = get_entities('group', '', 0, '', 25, 0, false, 0, null);
To Dispaly the groups which the user member , iam using this code...
$groups = elgg_get_entities_from_relationship(array('relationship'=> 'member', 'relationship_guid'=> $owner->guid, 'inverse_relationship'=> FALSE, 'type'=> 'group', 'limit'=> 5));
how can i getnot a member of a group?
I use
$result = array_values(array_diff($allgroups, $groups));
but it nothing shows becoz array contain multiple attributes.......
get all groups and then run check on if there is a relationship. If yes unset from array. What's left is all groups user is not a member of.
I PUT LIKE THIS
$groups = elgg_get_entities_from_relationship(array('relationship'=> 'member', 'relationship_guid'=> $vars['user']->guid, '', 'type'=> 'group', 'limit'=> 25))
$allgroups = get_entities('group',$groups, 0, '', 25, 0, false, 0, null);
unset($allgroups);
if($allgroups){
foreach($allgroups as $group){
echo $group->name ;
}}
BUT NOTHING SHOWING
$membergroups = elgg_get_entities_from_relationship(array('relationship'=> 'member', 'relationship_guid'=> $vars['user']->guid, '', 'type'=> 'group', 'limit'=> 25))
$allgroups = get_entities('group','', 0, '', 25, 0, false, 0, null);
Iam not familiar with unset() function....
so hw can i unset $allgroups- $membergroups
Have you done a Google for unset() ?.Trajan has given you the steps. Spent some time with Elgg group mod and you will get the solution.
FYI : http://php.net/manual/en/function.unset.php
----------------------------------
The above is a slightly different way of doing it where you search for all groups and for each one where you aren't a member you push it to an array and then list that array. It will show you the latest 25 groups (by time created) I imagine. You can play around with this to offer suggested groups to join by adding a
before the foreach loop or shuffle($not_my_groups); after it.
RESOURCES:
http://reference.elgg.org
http://docs.elgg.org
www.google.com/search for php functions here
www.stackoverflow.com
so try changing to this bit:
If it still shows all groups and doesn't remove the groups the user is a member of, then there is probably and issue with the check_entity_relationship running a check the wrong way. Depends who owns that relationship.
- Previous
- 1
- 2
- 3
- Next
You must log in to post replies.