Blogs: Changing the Publish to Default Setting

Blogs: Changing the Publish to Default Setting

by Jackie Rygg -
Number of replies: 4
We are using a course with teachers for teacher training purposes. The teachers are asking us to change the default setting in the Publish To dialog box on the Blog Add a New Entry page from "Anyone on this site" to "Yourself draft." They don't want to have to make that change every time they use the blog.

I can not find any setting in the Admin where I can change the default. Can anyone help?


Average of ratings: -
In reply to Jackie Rygg

Re: Blogs: Changing the Publish to Default Setting

by NN NN -
Hi Jackie,

I also wanted to know how to do this, and after about a week of trial and error I managed to achieve it. It's quite a shame that nobody "in the know" could offer any assistance, as this turned out to be pretty straight forward, and I'm sure that anyone that is familiar with the blog code could have pointed this out straight away. (My problem is that I don't really do PHP, but I find that if I stare at it for long enough it starts to make some sense to me, lol)

I'm using Moodle 1.9.3

in the Blog/edit.php file there is a bit of code that looks like this:

case 'add':
// prepare new empty form
$post->publishstate = 'site';
$strformheading = get_string('addnewentry', 'blog');
$post->action = $action;
break;

I changed the "publishstate" to "public", as I wanted my blog to default to "anyone in the world". For your purposes I would change "site" to "draft"
Average of ratings: Useful (2)
In reply to NN NN

Re: Blogs: Changing the Publish to Default Setting

by Helen Foster -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Jackie, thanks for your question, and Julian, thanks for your helpful reply. approve

I've added a link to this discussion from the Blogs FAQ, as most likely there are other people wanting to know how to change the publish to default setting.
In reply to NN NN

Re: Blogs: Changing the Publish to Default Setting

by ces moce -

I tried on moodle 2.11 but it doesn't work

In reply to ces moce

Re: Blogs: Changing the Publish to Default Setting

by ces moce -

I found a solution on moodle 2.11

 

file : blog/edit_form.php

line 63:

change publishstate to 1

        $mform->addElement('select', 'publishstate', get_string('publishto', 'blog'), $publishstates);
        $mform->addHelpButton('publishstate', 'publishto', 'blog');
        $mform->setDefault('publishstate', 1);