Index: /elgg/trunk/mod/forum/userdetails_edit.php =================================================================== --- /elgg/trunk/mod/forum/userdetails_edit.php (revision 176) +++ /elgg/trunk/mod/forum/userdetails_edit.php (revision 176) @@ -0,0 +1,63 @@ +dirroot . 'mod/forum/config.php'); + + + if ((logged_on) && run("users:type:get", $page_owner) == "community") + { + $forum_title = __gettext("Blog/Forum View:"); + $forumRules = __gettext("Set this to 'yes' if you would like to default this user/community blog to a 'forum' view."); + + $body = <<< END + +
+ $forumRules +
+ +END; + $forum=""; + $forum = user_flag_get('forum', $page_owner); + //echo $forum . '" . __gettext("This widget displays the last couple of forum posts from a community forum. To begin, select the community from your connections below:") . "
"; + + $body .= "\n"; + + $body .= "" . __gettext("Then enter the number of forum posts you'd like to display:") . "
"; + + $body .= ""; + + return $body; + +} + +?> Index: /elgg/trunk/mod/forum/forum_view_thread.php =================================================================== --- /elgg/trunk/mod/forum/forum_view_thread.php (revision 176) +++ /elgg/trunk/mod/forum/forum_view_thread.php (revision 176) @@ -0,0 +1,156 @@ +"; +$metatags .= str_replace('{{url}}', $CFG->wwwroot, file_get_contents($CFG->dirroot . "mod/forum/css")); +$metatags .= ""; + +define("context", "forum"); + +$individual = 1; + +$post = $_GET["post"]; +if (!empty($post)) { + + $where = run("users:access_level_sql_where",$_SESSION['userid']); + + if (!$post = get_record_select('weblog_posts','('.$where.') AND ident = '.$post)) { + $post = new StdClass; + $post->weblog = -1; + $post->owner = -1; + $post->title = __gettext("Access denied or post not found"); + $post->posted = time(); + $post->ident = -1; + $post->body = __gettext("Either this blog post doesn't exist or you don't currently have access privileges to view it."); + } + + global $page_owner; + global $profile_id; + $profile_id = $post->weblog; + $page_owner = $post->weblog; + $weblog = user_info('username', $post->weblog); + + $_SESSION['redirect_url'] = $CFG->wwwroot . 'mod/forum/forum.php?weblog=' . $weblog; + + if ((context == "forum") && run("users:type:get", $profile_id) == "community") + { + // Add to the submenu + + $num = count($PAGE->menu_sub) + 1; + + $PAGE->menu_sub[$num]['name'] = "forum:blogview"; + $PAGE->menu_sub[$num]['html'] = '' . __gettext("Return to Forum") . ''; + + $num = count($PAGE->menu_sub) + 1; + $PAGE->menu_sub[$num]['name'] = "forum:blogview"; + $PAGE->menu_sub[$num]['html'] = "wwwroot . $weblog . "/weblog/" . $post->ident . ".html#new_weblog_comment\" title=\"" . __gettext("Add a comment...") . "\">" . __gettext("Add new comment") . ""; + } + + + templates_page_setup(); + + $time = gmstrftime("%b %d, %y",$post->posted); + $body = " +| " . __gettext("From") . " | +" . $post->title . " | +
|---|---|
| + | " . run("weblogs:text:process", $post->body) . ""; + + if (run("permissions:check",array("weblog:edit",$post->owner))) + { + $Edit = __gettext("Edit"); + $returnConfirm = __gettext("Are you sure you want to permanently delete this forum post?"); + $Delete = __gettext("Delete"); + $body .=" | +
| " . run("weblogs:text:process", $comment->body); + + if (logged_on && ($comment->owner == $_SESSION['userid'] || run("permissions:check",array("weblog:edit",$post->owner)))) + { + $returnConfirm = __gettext("Are you sure you want to permanently delete this forum comment?"); + $Delete = __gettext("Delete"); + $body .=" + "; + } + + + + $body .= " |
| " . __gettext("From") . " | +" . $post->title . " | +
|---|---|
| + | " . run("weblogs:text:process", $post->body) . ""; + + if (run("permissions:check",array("weblog:edit",$post->owner))) + { + $Edit = __gettext("Edit"); + $returnConfirm = __gettext("Are you sure you want to permanently delete this forum post?"); + $Delete = __gettext("Delete"); + $body .=" | +
| " . run("weblogs:text:process", $comment->body); + + if (logged_on && ($comment->owner == $_SESSION['userid'] || run("permissions:check",array("weblog:edit",$post->owner)))) + { + $returnConfirm = __gettext("Are you sure you want to permanently delete this forum comment?"); + $Delete = __gettext("Delete"); + $body .=" + "; + } + + + + $body .= " |
+ $forumRules +
+ +END; + $forum=""; + $forum = user_flag_get('forum', $page_owner); + //echo $forum . '" . __gettext("This widget displays the last couple of forum posts from a community forum. To begin, select the community from your connections below:") . "
"; + + $body .= "\n"; + + $body .= "" . __gettext("Then enter the number of forum posts you'd like to display:") . "
"; + + $body .= ""; + + return $body; + +} + +?> Index: /elgg/trunk/mod/forum/trunk/forum.php =================================================================== --- /elgg/trunk/mod/forum/trunk/forum.php (revision 176) +++ /elgg/trunk/mod/forum/trunk/forum.php (revision 176) @@ -0,0 +1,243 @@ +"; + $metatags .= str_replace('{{url}}', $CFG->wwwroot, file_get_contents($CFG->dirroot . "mod/forum/css")); + $metatags .= ""; + + $profile_id = optional_param('owner', 0, PARAM_INT); + + if (empty($profile_id)) { + // try to get weblog name and then id + $weblog = optional_param('weblog'); + + if (!empty($weblog)) { + $profile_id = get_field('users', 'ident', 'username', $weblog); + } + } else { + // get weblog from id + $weblog = user_info('username', $profile_id); + } + + $page_owner = $profile_id; + + define("context", "forum"); + + if ((context == "forum") && run("users:type:get", $page_owner) == "community") + { + // Add to the submenu + $num = count($PAGE->menu_sub) + 1; + $PAGE->menu_sub[$num]['name'] = "forum:rssfeed"; + $PAGE->menu_sub[$num]['html'] = '| " . __gettext("Discussion Topic") . " | +" . __gettext("Started by") . " | +" . __gettext("Comments") . " | +" . __gettext("Latest Comment") . " | +wwwroot . user_info("username",$page_owner) . "/weblog/" . $post->ident . ".html\" title=\"View full discussion...\">" . $post->title . " | + + // handle empty titles + if(empty($post->title)){ + $words = 6; // 5 words, really + $cut_body = preg_replace("/<[^<>]>/","",$post->body); + $cut_body = explode(" ",$cut_body,$words); + array_pop($cut_body); + $post->title = "".implode(" ",$cut_body)." ..."; + } + + + + + $body .= " + +
|---|---|---|---|
| wwwroot . "mod/forum/" . $post->ident . ".html\" title=\"" . __gettext("View full discussion...") . "\">" . $post->title . " | +wwwroot . user_info("username",$post->owner) . "/" . "\" title=\"" . __gettext("View profile...") . "\">" . user_info("name",$post->owner) . " | +ident . "\" title=\"" . __gettext("View comments...") . "\">" . $numberofcomments . " | +" . $lastcommenter . " " . $lastcommenttime . " |
+
| " . __gettext("Discussion Topic") . " | +" . __gettext("Started by") . " | +" . __gettext("Comments") . " | +" . __gettext("Latest Comment") . " | +wwwroot . user_info("username",$page_owner) . "/weblog/" . $post->ident . ".html\" title=\"View full discussion...\">" . $post->title . " | + + // handle empty titles + if(empty($post->title)){ + $words = 6; // 5 words, really + $cut_body = preg_replace("/<[^<>]>/","",$post->body); + $cut_body = explode(" ",$cut_body,$words); + array_pop($cut_body); + $post->title = "".implode(" ",$cut_body)." ..."; + } + + + + + $body .= " + +
|---|---|---|---|
| wwwroot . "mod/forum/" . $post->ident . ".html\" title=\"" . __gettext("View full discussion...") . "\">" . $post->title . " | +wwwroot . user_info("username",$post->owner) . "/" . "\" title=\"" . __gettext("View profile...") . "\">" . user_info("name",$post->owner) . " | +ident . "\" title=\"" . __gettext("View comments...") . "\">" . $numberofcomments . " | +" . $lastcommenter . " " . $lastcommenttime . " |
+