diff --git a/blocks/blog_tags/block_blog_tags.php b/blocks/blog_tags/block_blog_tags.php index 4ef68bf634b..78da2aa3bc7 100644 --- a/blocks/blog_tags/block_blog_tags.php +++ b/blocks/blog_tags/block_blog_tags.php @@ -71,13 +71,13 @@ class block_blog_tags extends block_base { $timewithin = $this->config->timewithin * 24 * 60 * 60; /// convert to seconds - $sql = 'SELECT t.*, COUNT(DISTINCT bt.id) as ct '; + $sql = 'SELECT t.id, t.type, t.text, COUNT(DISTINCT bt.id) as ct '; $sql .= "FROM {$CFG->prefix}tags as t, {$CFG->prefix}blog_tag_instance as bt, {$CFG->prefix}post as p "; $sql .= 'WHERE t.id = bt.tagid '; $sql .= 'AND p.id = bt.entryid '; $sql .= 'AND (p.publishstate = \'site\' or p.publishstate=\'public\') '; $sql .= "AND bt.timemodified > {$timewithin} "; - $sql .= 'GROUP BY bt.tagid '; + $sql .= 'GROUP BY t.id, t.type, t.text '; $sql .= 'ORDER BY ct DESC, t.text ASC '; $sql .= "LIMIT {$this->config->numberoftags} "; diff --git a/blog/lib.php b/blog/lib.php index eef1e5ff56f..29f2e7d7cec 100755 --- a/blog/lib.php +++ b/blog/lib.php @@ -289,14 +289,14 @@ /** * User can edit a blog entry if this is their own blog post and they have - * the capability moodle/blog:writeentry, or if they have the capability + * the capability moodle/blog:create, or if they have the capability * moodle/blog:manageentries. */ function blog_user_can_edit_post($blogEntry, $context) { global $CFG, $USER; - return ((has_capability('moodle/blog:writeentries', $context) && + return ((has_capability('moodle/blog:create', $context) && $blogEntry->userid == $USER->id) || has_capability('moodle/blog:manageentries', $context)); } diff --git a/blog/tags.php b/blog/tags.php index 14f93e4b794..cf0f80475f5 100755 --- a/blog/tags.php +++ b/blog/tags.php @@ -39,7 +39,7 @@ switch ($mode) { case 'addpersonal': /// Everyone can add personal tags as long as they can write blog entries. if (!confirm_sesskey() || - !has_capability('moodle/blog:writeentries', $context) || + !has_capability('moodle/blog:create', $context) || empty($USER->id)) { error ('you can not add tags'); }