some blog problems fixed - non existing capabilitites, pg incompatibilities;

in anycase the blog is still broken :-(
working on some more fixes now...
This commit is contained in:
skodak 2006-10-02 20:50:49 +00:00
parent a44de9c12f
commit 11c467d939
3 changed files with 5 additions and 5 deletions

View 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} ";

View File

@ -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));
}

View File

@ -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');
}