Fixing a small css issue in the user class.
[elgg.git] / units / communities / communities_edit.php
blob55d9f5d61eb54cd0fe0ffa2e7d6e829d5ac5f848
1 <?php
2 global $CFG;
3 // Given a user ID as a parameter, will display a list of communities
5 if (isset($parameter[0])) {
7 $user_id = (int) $parameter[0];
9 $result = get_records_sql('SELECT u.*, f.ident AS friendident FROM '.$CFG->prefix.'friends f
10 JOIN '.$CFG->prefix.'users u ON u.ident = f.friend
11 WHERE f.owner = ? AND u.user_type = ?', array($user_id,'community'));
13 $body = <<< END
14 <div class="networktable">
15 <table>
16 <tr>
17 END;
18 $i = 1;
19 if (!empty($result)) {
20 $w = 100;
21 if (sizeof($result) > 4) {
22 $w = 50;
24 foreach($result as $key => $info) {
25 $friends_name = run("profile:display:name",$info->ident);
26 $info->icon = run("icons:get",$info->ident);
27 $friends_menu = run("users:infobox:menu",array($info->ident));
28 $body .= <<< END
29 <td>
30 <p>
31 <a href="{$CFG->wwwroot}{$info->username}/">
32 <img src="{$CFG->wwwroot}_icon/user/{$info->icon}/w/{$w}" alt="{$friends_name}" border="0" /></a><br />
33 <span class="userdetails">
34 <a href="{$CFG->wwwroot}{$info->username}/">{$friends_name}</a>
35 {$friends_menu}
36 </span>
37 </p>
38 </td>
39 END;
40 if ($i % 5 == 0) {
41 $body .= "</tr><tr>";
43 $i++;
45 } else {
46 if ($user_id == $_SESSION['userid']) {
47 $body .= "<td><p>". __gettext("You don't have any communities listed! To join a community, click the 'join' button underneath a community's icon. You can find communities you're interested in by using the search function.") ."</p></td>";
48 } else {
49 $body .= "<td><p>". __gettext("This user is not currently a member of any communities.") ."</p></td>";
52 $body .= <<< END
53 </tr>
54 </table>
55 </div>
56 END;
59 $run_result = $body;