Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
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
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
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
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
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
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
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
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
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