mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 16:32:18 +02:00
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:
parent
a44de9c12f
commit
11c467d939
@ -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} ";
|
||||
|
||||
|
@ -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));
|
||||
}
|
||||
|
@ -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');
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user