]> git.mjollnir.org Git - moodle.git/commitdiff
some blog problems fixed - non existing capabilitites, pg incompatibilities;
authorskodak <skodak>
Mon, 2 Oct 2006 20:50:49 +0000 (20:50 +0000)
committerskodak <skodak>
Mon, 2 Oct 2006 20:50:49 +0000 (20:50 +0000)
in anycase the blog is still broken :-(
working on some more fixes now...

blocks/blog_tags/block_blog_tags.php
blog/lib.php
blog/tags.php

index 4ef68bf634b61b07f832144491575c3cec4d2fa1..78da2aa3bc772a829ed70c7c7af76cee2d4afa14 100644 (file)
@@ -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} ";
 
index eef1e5ff56f3570a9dba82e3609b8c7d0a439990..29f2e7d7cece06a65f10bf6626ed86fd09c985f1 100755 (executable)
 
     /**
      * 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));
     }
index 14f93e4b794abb0402c7f5977120131ce287f2a1..cf0f80475f56e70a95b2aa7d8ae7870cbd7c5e09 100755 (executable)
@@ -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');
         }