Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-03-24 22:02:32

macinchik
Member
Registered: 2007-02-08
Posts: 17

make default status draft instead of live?

A request from a client. Is this possible?

Thanks,
Jenn

Offline

#2 2009-03-24 23:05:43

the_ghost
Plugin Author
From: Minsk, The Republic of Belarus
Registered: 2007-07-26
Posts: 907
Website

Re: make default status draft instead of live?

Sure. With jQuery you can make radio buttom be selected on page load. Use jmd_admin_js to easily insert js into admin


Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?

Offline

#3 2010-06-26 16:53:06

Kimberly
New Member
Registered: 2010-06-26
Posts: 3

Re: make default status draft instead of live?

Actually, you can do this very easily if you edit the txp.articles.php script. I am new to Textpattern, as in just started new, and before I can even start to use the programme I find I am having to edit the php scripts. I did a lot of searching for where you go to change the default status for articles and finally came to the conclusion that you can not. Therefore, off to edit the scripts for something that could be stored in the db. And it is easier to edit the php script than to write a plugin; especially when I don’t know how to write plugins for Textpattern.

Most users don’t write articles off line, they use the on line editor and save unfinished articles just as one would in off line applications in case of a computer or internet crash. Therefore, to keep from accidentally publishing an unfinished article, the default status should always be draft.

Now to the fix,

Go to the /textpattern/include/ and open the txp.articles.php file into a text editor of your choice (you want a pure text editor)

Scroll down to line 1025 (or close)

you will find the following line:
$Status = (!$Status) ? 4 : $Status;

Change the 4 to a 1 (if you look at the status list, you will see the numbers correspond to the listing)

Save the file and then upload the changed file overwriting the old one on the server. If you think you might break something, you can first rename the current txp.articles.php to txp.articles.php.old and if it does go bad then just delete the file you uploaded and remove the .old from the file name and you are back where you started.

Once you have uploaded the changed articles file reload the content tab/form and you will see the default status is set to draft (1).

Sometimes the best way to work with these programmes is to hack. It is one of the nice things about Open Source software.

-Kimberly.

Offline

#4 2010-06-26 17:30:20

Kimberly
New Member
Registered: 2010-06-26
Posts: 3

Re: make default status draft instead of live?

One more thing:

In the same file, go down to line 844 (or close) and find the following code:

fInput(‘submit’,‘publish’,gTxt(‘publish’),“publish”, ‘’, ‘’, ‘’, 4) :

Change it to:
fInput(‘submit’,‘publish’,gTxt(‘Save / Publish’),“publish”, ‘’, ‘’, ‘’, 4) :

This will change the text on the publish button to read Save / Publish. Since changing the radio button does not trigger a change in the text, having the button to read “Save / Publish” will be less confusing to nubies.

Offline

#5 2010-06-26 17:48:35

Kimberly
New Member
Registered: 2010-06-26
Posts: 3

Re: make default status draft instead of live?

Actually, as I examine this more closely, the whole publish button thing does not really apply. The button probably should just read save as one can not publish if the radio button is on draft. Perhaps a separate “Publish Now” button that ignores the setting of the status button and saves the article out and sets the status as “Live”. I have seen the “Publish Now” button on some other CMSes.

Probably the best way to handle this is through javascript that checks the status of the radio button and changes the text of the submit button accordingly. If ($Status >=4) (set submit button text = “Publish”). Has anyone done this already?

-Kimberly.

Offline

#6 2010-06-26 19:04:46

artagesw
Member
From: Seattle, WA
Registered: 2007-04-29
Posts: 227
Website

Re: make default status draft instead of live?

Kimberly,

Welcome to the community! Of course, you are free to hack away at the Txp core as you wish. But in general, the “Textpattern Way” is to create plugins whenever possible to perform such customizations. It is much cleaner and your site will be far less fragile (i.e. less likely to break when an update to the core code is released).

Offline

#7 2010-06-26 19:47:26

renobird
Member
From: Gainesville, Florida
Registered: 2005-03-02
Posts: 786
Website

Re: make default status draft instead of live?

The JS way works for this – I’ve done it before – I’ll see if I can dig up the code.

Offline

#8 2011-08-06 14:20:08

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,909
Website

Re: make default status draft instead of live?

I’m so used to this by now I don’t even think about it when using my own site.

But every time I’ve built a site that is to be used by more than one person, the client always asks why the Draft is not the default, and I’m alway reminded of how illogical it is. I always say, I don’t know, and admit it doesn’t make much sense. I then remind them that users with “freelancer” status can’t publish live anyway, etc. And the issue always fades before getting around to making a change on the default.

So, what is the best way these days?

Offline

#9 2011-08-06 15:50:41

merz1
Member
From: Hamburg
Registered: 2006-05-04
Posts: 994
Website

Re: make default status draft instead of live?

Can’t be to difficult to have an option in admin for the default status.
Yes, and ‘draft’ should be default. This way the article is saved and the preview is available.
One step further would be a user option, so that every user can choose his default status.

And thanks to Kimberly. That’s what fresh TXP users are really good for :)#

Edit: Can somebody check the Feature Request forum? I have to leave my keyboard alone for a while :)

Last edited by merz1 (2011-08-06 15:52:10)


Get all online mentions of Textpattern via OPML subscription: TXP Info Sources: Textpattern RSS feeds as dynamic OPML

Offline

#10 2011-08-06 17:02:06

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,304

Re: make default status draft instead of live?

jayrope wanted a pending status default, so all you’d need to do is change the number from 3 to 1 in Stefs micro plugin, Destry.


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#11 2011-08-06 17:38:14

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,909
Website

Re: make default status draft instead of live?

Thanks, Uli.

In that thread, post 6, when Stef says “I’d create a plugin…”, does that mean I need to create a plugin to use his code?

If so, there’s got to be better people than me messing about with plugin code. Somebody who could do it in their sleep instead of me taking a week just to figure out if I could even fumble through it.

I’ll see if Jayrope put one together.

Ed. Actually, his original request doesn’t look like the same scenario. I don’t want drafts to be auto-changed to pending.

Last edited by Destry (2011-08-06 17:41:01)

Offline

#12 2011-08-06 17:50:42

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: make default status draft instead of live?

Destry wrote:

In that thread, post 6, when Stef says “I’d create a plugin…”, does that mean I need to create a plugin to use his code?

Yes, or just insert the code to txp_plugins table. You could for example use ied_plugin_composer. Just copy the code to a plugin code field, change the type to admin-only and hit save.

Ed. Actually, his original request doesn’t look like the same scenario. I don’t want drafts to be auto-changed to pending.

The code should do exactly what you are after.

Offline

Board footer

Powered by FluxBB