[solved] ListIt2 - set new items inactive by default?

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
Cerulean
Forum Members
Forum Members
Posts: 172
Joined: Mon Nov 01, 2010 8:56 am

[solved] ListIt2 - set new items inactive by default?

Post by Cerulean »

I'm considering using ListIt2 together with FormBuilder to allow ListIt2 items to be created from a form on the frontend. (Thanks goes out to the tutorial: http://www.i-do-this.com/blog/FormBuild ... xtended/57)

I'll need these items submitted from the frontend to be moderated by an administrator before they appear on the live site, and it seems that the active/inactive setting that is built into every ListIt2 item would be ideal for hiding items awaiting moderation. The only thing is that new items seem to be set active by default. Is there a way to have new items set inactive by default?
Last edited by Cerulean on Wed Feb 12, 2014 8:19 am, edited 1 time in total.
uniqu3

Re: ListIt2 - set new items inactive by default?

Post by uniqu3 »

How about adding following to UDT:

Code: Select all

$obj->title = $params['email'];
$obj->alias = $alias;
$obj->active = 0; // <- add this, item disabled by default
Cerulean
Forum Members
Forum Members
Posts: 172
Joined: Mon Nov 01, 2010 8:56 am

Re: ListIt2 - set new items inactive by default?

Post by Cerulean »

Obvious now that you mention it :-)
Thanks.
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: ListIt2 - set new items inactive by default?

Post by velden »

You could have a look at the events in Event Manager.

It has e.g.: PreItemSave "Sent before item save process begins. Possible to manipulate item object data."

It would probably need some debugging to find the proper properties that need to be set. And a way to prevent it from being set inactive on every save (which would make the item unusable of course).


EDIT: never mind, better listen to uniqu3
Cerulean
Forum Members
Forum Members
Posts: 172
Joined: Mon Nov 01, 2010 8:56 am

Re: [solved] ListIt2 - set new items inactive by default?

Post by Cerulean »

@velden
Thanks for the suggestion, but I think uniqu3 has hit upon the easiest way.

The ListIt2 field values are copied over from the FormBuilder fields by the UDT (see the tutorial I linked to above if you're curious), so it's easy to set the "active" value to 0 at the same time. Overwriting the active/inactive state of an already moderated item isn't an issue because every form submission creates a new ListIt2 item (and in my case I don't need to allow frontend users to edit their previously submitted forms).
nikkio
Forum Members
Forum Members
Posts: 63
Joined: Sun Jun 08, 2008 12:34 pm

Re: [solved] ListIt2 - set new items inactive by default?

Post by nikkio »

Just a little trick...

with the latest version of FormBuilder, you can populate a Listit2 instance ad set the active/inactive status of the item.

You can do it by choosing "*Store Results for ListItExtended" as field type and defining the instance you want to populate. ;)
uniqu3

Re: [solved] ListIt2 - set new items inactive by default?

Post by uniqu3 »

Latest Version 0.7.4 has bugs and should not be used, see http://forum.cmsmadesimple.org/viewtopi ... =7&t=67867.
Post Reply

Return to “Modules/Add-Ons”