*/
function fetch_entries($limit=true) {
global $CFG, $USER;
-
+
+
if (!isset($USER->id)) {
$USER->id = 0; //hack, for guests
}
-
- if ($this->tag) {
- $tagtablesql = $CFG->prefix.'blog_tag_instance bt, ';
- $tagquerysql = ' AND bt.entryid = p.id AND bt.tagid = '.$this->tag.' ';
- } else {
- $tagtablesql = '';
- $tagquerysql = '';
- }
-
+
// if we have specified an ID
if ($this->postid) {
if ($post = get_record('post', 'id', $this->postid)) {
+
+ if ($user = get_record('user', 'id', $post->userid)) {
+ $post->email = $user->email;
+ $post->firstname = $user->firstname;
+ $post->lastname = $user->lastname;
+ }
+
$blogEntry = new BlogEntry($post);
$blogEntries[] = $blogEntry;
return $this->filtered_entries;
}
}
+
+
+ if ($this->tag) {
+ $tagtablesql = $CFG->prefix.'blog_tag_instance bt, ';
+ $tagquerysql = ' AND bt.entryid = p.id AND bt.tagid = '.$this->tag.' ';
+ } else {
+ $tagtablesql = '';
+ $tagquerysql = '';
+ }
+
/****************************************
* depending on the type, there are 4 *
*/
function blog_print_html_formatted_entries(&$blogFilter, $filtertype, $filterselect) {
global $CFG, $USER;
+
$blogpage = optional_param('blogpage', 0, PARAM_INT);
$bloglimit = get_user_preferences('blogpagesize',8); // expose as user pref when MyMoodle comes around
echo '<p />';
print_string('tags');
echo ': ';
- foreach ($blogtags as $blogtag) {
- echo '<a href="index.php?courseid='.$course->id.'&filtertype='.$filtertype.'&filterselect='.$filterselect.'&tagid='.$blogtag->id.'">'.$blogtag->text.'</a>, ';
+ foreach ($blogtags as $key => $blogtag) {
+ $taglist[] = '<a href="index.php?courseid='.$course->id.'&filtertype='.$filtertype.'&filterselect='.$filterselect.'&tagid='.$blogtag->id.'">'.$blogtag->text.'</a>';
}
+ echo implode(', ', $taglist);
}
/// Commands