Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-07-25 12:47:18

jayrope
Plugin Author
From: Berlin
Registered: 2006-07-06
Posts: 689
Website Mastodon

Default status of new article to pending

Is there any way in txp 4.4.1 to set the default article status of a newly created article to “pending” without having to use
upm_savenew?
The site i am working on has a lot of admin theme work going, and upm_savenew would probably cause trouble there.

Thanx for a hint.


A hole turned upside down is a dome, when there’s also gravity.

Offline

#2 2011-07-25 13:10:18

jayrope
Plugin Author
From: Berlin
Registered: 2006-07-06
Posts: 689
Website Mastodon

Re: Default status of new article to pending

Sorry, wrong forum section, please move to “how do i”… thank you!


A hole turned upside down is a dome, when there’s also gravity.

Offline

#3 2011-07-25 13:33:20

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

Re: Default status of new article to pending

$('input[id="status-3"]').attr('checked', true);


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

Offline

#4 2011-07-25 13:53:49

jayrope
Plugin Author
From: Berlin
Registered: 2006-07-06
Posts: 689
Website Mastodon

Re: Default status of new article to pending

Thanx, where would i use that?


A hole turned upside down is a dome, when there’s also gravity.

Offline

#5 2011-07-25 14:06:13

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

Re: Default status of new article to pending

You might put it inside rss_admin_show_adv_opts’ code.


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

Offline

#6 2011-07-25 14:15:25

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,819
Website GitHub

Re: Default status of new article to pending

uli wrote:

You might put it inside rss_admin_show_adv_opts’ code.

I wouldn’t put it there since that plugin interferes with Txp’s twisty remembering action in 4.2.0 and higher. I’d create a plugin like this:

if (@txpinterface=='admin') {
   register_callback ('jay_default_status', 'article_ui', 'status');
}

function jay_default_status($evt, $stp, $data, $rs) {
   return $data. <<<EOJS
<script type="text/javascript">
jQuery(function() {
   jQuery('input[id="status-3"]').prop('checked', true);
});
</script>
EOJS;
}

(untested, but something like that)

Last edited by Bloke (2011-07-25 14:16:20)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#7 2011-07-25 14:19:38

jayrope
Plugin Author
From: Berlin
Registered: 2006-07-06
Posts: 689
Website Mastodon

Re: Default status of new article to pending

Yes, rss_admin_show_adv_opts is orphaned.
Thanx Stef, will follow your suggestion right away.

EDIT: Works. (of course) Much appreciated, Stef!

Last edited by jayrope (2011-07-25 14:24:36)


A hole turned upside down is a dome, when there’s also gravity.

Offline

#8 2011-07-25 14:20:15

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

Re: Default status of new article to pending

Bloke wrote:

I wouldn’t put it there since that plugin interferes with Txp’s twisty remembering action in 4.2.0 and higher.

Yep, sorry. Mine doesn’t contain any original code anymore :)

If you’re using bot_wtc you could paste this in the javascript section:

<script type="text/javascript">
   $('input[id="status-3"]').attr('checked', true);
</script>

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

Offline

#9 2011-07-25 14:25:29

jayrope
Plugin Author
From: Berlin
Registered: 2006-07-06
Posts: 689
Website Mastodon

Re: Default status of new article to pending

Uli i followed Stefs suggestion. Just the least additional code. Thank you in any case!


A hole turned upside down is a dome, when there’s also gravity.

Offline

#10 2011-07-25 14:51:24

jayrope
Plugin Author
From: Berlin
Registered: 2006-07-06
Posts: 689
Website Mastodon

Re: Default status of new article to pending

Ha. It’s getting further. If i use your way, Stef, then any time i edit an already existing live article i will have to manually reset it’s status to live as well.
I guess i will have to get into database calls for the further use of that new plugin :)
Wish me luck.

Last edited by jayrope (2011-07-25 14:51:48)


A hole turned upside down is a dome, when there’s also gravity.

Offline

#11 2011-07-25 15:10:52

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,819
Website GitHub

Re: Default status of new article to pending

jayrope wrote:

any time i edit an already existing live article i will have to manually reset it’s status to live as well.

Ah yeah. Bit of cleverness required. Again untested:

if (@txpinterface=='admin') {
   register_callback ('jay_default_status', 'article_ui', 'status');
}

function jay_default_status($evt, $stp, $data, $rs) {
   global $step;

   $js = '';

   if (in_array($step, array('', 'create'))) {
      $js = <<<EOJS
<script type="text/javascript">
jQuery(function() {
   jQuery('input[id="status-3"]').prop('checked', true);
});
</script>
EOJS;
   }

   return $data.$js;
}

Essentially we’re just checking to see if there’s no step (clicked on Write tab) or if someone is creating a new article and only adding the JS in that sitution. Might have missed one or two steps so you can add to the array if you like as testing dictates.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#12 2011-07-25 16:53:50

jayrope
Plugin Author
From: Berlin
Registered: 2006-07-06
Posts: 689
Website Mastodon

Re: Default status of new article to pending

Awesome. Didn’t know of step “create”. Apparently it is not in the core callback list on the wiki and my own knowledge is pretty limited.


A hole turned upside down is a dome, when there’s also gravity.

Offline

Board footer

Powered by FluxBB