root/elgg/trunk/mod/community/lib/community_memberships.php

Revision 218, 1.7 kB (checked in by cedenoj, 9 months ago)

refs #2828 added a link to create a new community as well as to list all communities in the right sidebar
Submitting this changeset again since I had committed into a branch instead of trunk before

Line 
1 <?php
2 global $CFG;
3 global $page_owner;
4
5 if ($page_owner != -1) {
6     if (user_type($page_owner) == "person" || user_type($page_owner) == "external") {
7         $body .= "<ul>";
8         if ($result = run('community:membership:data',array($page_owner))) {
9             foreach($result as $row) {
10                 $row->name = run("profile:display:name",$row->ident);
11                 $body .= "<li><a href=\"" . url . $row->username . "/\">" . $row->name . "</a></li>";
12             }
13         }
14         $body .= "</ul>";
15         $body .= "<p><a href=\"" . url . "mod/browser/index.php?display=communities\">[View all Communities]</a></p>";
16         $run_result .= "<li id=\"community_membership\">";
17         $run_result .= templates_draw(array(
18             'context' => 'sidebarholder',
19             'title' => __gettext("Community memberships"),
20             'body' => $body
21             )
22         );
23         $run_result .= "</li>";
24     } else if (user_type($page_owner) == "community") {
25         $friends = array();
26         if ($result = run('community:members:data',array($page_owner,8))) {
27             foreach($result as $row) {
28                 $friends[] = (int)$row->ident;
29             }
30         }
31         //$CFG->wwwroot.$info->username."/community/members
32         $run_result .= "<li id=\"community_membership\">";
33         $run_result .= run("users:infobox",
34                            array(
35                                  __gettext("Members"),
36                                  $friends,
37                                  "<a href=\"".$CFG->wwwroot.user_info('username',$page_owner)."/community/members\">[" . __gettext("View all members") . "]</a>"
38                                  )
39                            );
40         $run_result .= "</li>";
41     }
42 }
43
44
45 ?>
46
Note: See TracBrowser for help on using the browser.