root/elgg/trunk/mod/forum/forum_user_info_menu.php

Revision 176, 3.8 kB (checked in by cedenoj, 10 months ago)

refs #2827 Adding forum plugin for elgg

Line 
1 <?php
2
3 global $page_owner;
4 global $CFG;
5 $profile_id = $page_owner;
6 $sitename = sitename;
7 //include(dirname(__FILE__) . '/config.php');
8
9 require_once($CFG->dirroot . 'mod/forum/config.php');
10
11
12 if (logged_on && $page_owner == $_SESSION['userid']) {
13     
14     $title = __gettext("Recent Activity");
15     $body = "<ul><li>";
16     $body .= "<a href=\"".url."_activity/\">".__gettext("View your activity") . "</a></li></ul>";
17
18             $run_result .= "<li id=\"recent_activity\">";
19     $run_result .= templates_draw(array(
20                                         'context' => 'sidebarholder',
21                                         'title' => $title,
22                                         'body' => $body,
23                                         )
24                                   );
25             $run_result .= "</li>";
26
27 } else {
28
29     //$posts = count_records_select('weblog_posts','('.run("users:access_level_sql_where",$profile_id).") and owner = $profile_id");
30     
31     if (logged_on || (isset($page_owner) && $page_owner != -1)) {
32         
33         $title = __gettext("Forum & Blogs");
34         
35         $weblog_username = user_info('username', $profile_id);
36         $body = <<< END
37             <ul>
38 END;
39         if (user_type($page_owner) == "person") {
40             $personalWeblog = __gettext("Personal blog");
41             $body .= <<< END
42                 <li><a href="{$CFG->wwwroot}{$weblog_username}/weblog/">$personalWeblog</a> (<a href="{$CFG->wwwroot}{$weblog_username}/weblog/rss">RSS</a>)</li>
43 END;
44         } else if (user_type($page_owner) == "community") {
45         
46         
47         
48                 $forum_flag = user_flag_get('forum', $profile_id);
49                 //echo $forum_flag;
50                 //echo $forum_default;       
51         
52                 if ((!$forum_flag) && ($forum_default == 0))
53                 {
54                     $use_forum= "yes";
55                 }
56                 else if ((!$forum_flag) && ($forum_default == 1))
57                 {
58                     $use_forum= "no";
59                 }
60                 else
61                 {
62                     $use_forum= $forum_flag;
63                 }
64         
65         if ($use_forum=="yes"){   
66         
67             $communityWeblog = __gettext("Community Forum");
68             $body .= <<< END
69                 <li>
70                 <a href="{$CFG->wwwroot}mod/forum/forum.php?weblog=$weblog_username">$communityWeblog</a>
71                  <a href="{$CFG->wwwroot}{$weblog_username}/weblog/rss"> <img src="{$CFG->wwwroot}mod/template/icons/rss.png" alt="RSS" border="0" /></a></li>
72 END;
73         
74         $blogArchive = __gettext("Archive");
75         $membersWeblog = __gettext("Members blog");
76         $body .= <<< END
77                 <li><a href="{$CFG->wwwroot}{$weblog_username}/weblog/archive/">$blogArchive</a></li>
78                 <li><a href="{$CFG->wwwroot}{$weblog_username}/weblog/friends/">$membersWeblog</a></li>
79 END;
80         } else {
81
82             $communityWeblog = __gettext("Community Blog");
83             $body .= <<< END
84                 <li>
85                 <a href="{$CFG->wwwroot}{$weblog_username}/weblog">$communityWeblog</a>
86                  (<a href="{$CFG->wwwroot}{$weblog_username}/weblog/rss"><img src="{$CFG->wwwroot}mod/template/icons/rss.png" alt="RSS" border="0" /></a>)</li>
87 END;
88         
89         $blogArchive = __gettext("Archive");
90         $membersWeblog = __gettext("Friends blog");
91         $body .= <<< END
92                 <li><a href="{$CFG->wwwroot}{$weblog_username}/weblog/archive/">$blogArchive</a></li>
93                 <li><a href="{$CFG->wwwroot}{$weblog_username}/weblog/friends/">$membersWeblog</a></li>
94 END;
95
96         }
97
98
99
100 }   
101         $run_result .= "<li id=\"sidebar_weblog\">";
102         $run_result .= templates_draw(array(
103                                             'context' => 'sidebarholder',
104                                             'title' => $title,
105                                             'body' => $body,
106                                             )
107                                       );
108         $run_result .= "</ul></li>";
109     }
110 }
111
112 ?>
Note: See TracBrowser for help on using the browser.