Commit 25c428d9 authored by Clare Lenihan's avatar Clare Lenihan Committed by Clare Lenihan
Browse files

changing constructing a blog entry so it loads comments settings properly

parent 4361186d
......@@ -138,20 +138,17 @@ class ArtefactTypeBlog extends ArtefactType {
*/
public function __construct($id = 0, $data = null) {
parent::__construct($id, $data);
if (!$data) {
if ($this->id) {
if ($blogdata = get_record('artefact_blog_blog', 'blog', $this->id)) {
foreach($blogdata as $name => $value) {
if (property_exists($this, $name)) {
$this->$name = $value;
}
if ($this->id) {
if ($blogdata = get_record('artefact_blog_blog', 'blog', $this->id)) {
foreach($blogdata as $name => $value) {
if (property_exists($this, $name)) {
$this->$name = $value;
}
}
else {
// This should never happen unless the user is playing around with blog IDs in the location bar or similar
throw new ArtefactNotFoundException(get_string('blogdoesnotexist', 'artefact.blog'));
}
}
else {
// This should never happen unless the user is playing around with blog IDs in the location bar or similar
throw new ArtefactNotFoundException(get_string('blogdoesnotexist', 'artefact.blog'));
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment