blob: 0f0f27cf84a113699e8c35e9da37076810c36ba7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
<?php
/**
* Extended class to override the time_created
*/
class ElggBlog extends ElggObject {
/**
* Set subtype to blog.
*/
protected function initializeAttributes() {
parent::initializeAttributes();
$this->attributes['subtype'] = "blog";
}
/**
* @todo this won't work until we have date l10n working.
* Rewrite the time created to be publish time.
* This is a bit dirty, but required for proper sorting.
*/
// public function save() {
// if (parent::save()) {
// global $CONFIG;
//
// // try to grab the publish date, but default to now.
// foreach (array('publish_date', 'time_created') as $field) {
// if (isset($this->$field) && $this->field) {
// $published = $this->field;
// break;
// }
// }
// if (!$published) {
// $published = time();
// }
//
// $sql = "UPDATE {$CONFIG->dbprefix}entities SET time_created = '$published', time_updated = '$published' WHERE guid = '{$this->getGUID()}'";
// return update_data($sql);
// }
//
// return FALSE;
// }
/**
* Can a user comment on this blog?
*
* @see ElggObject::canComment()
*
* @param int $user_guid User guid (default is logged in user)
* @return bool
* @since 1.8.0
*/
public function canComment($user_guid = 0) {
$result = parent::canComment($user_guid);
if ($result == false) {
return $result;
}
if ($this->comments_on == 'Off') {
return false;
}
return true;
}
}
|