WeStandWithUkraine

9 years ago
8
Topic

Good day everybody!

I'm using SEBLOD about two years and can't stop to wonder it! Thank to all who makes it for us!
Now I have a task which looks interesting, and I'm sure that somebody have this solution.
I need a show by search unpublished articles:
1) Really unpublished articles - which state=0
2) Overdue articles - which state-1 but publish_down less than NOW.
So, my problem is in OR condition - my query should be like this:
SELECT ...blablabla... when state=0 OR publish_down<NOW...
Anybody knows how I can solve this task?
Thanks for advance!


Get a Book for SEBLOD
46 Posts
Castor
9 years ago
7
Level 1

Hi ComeOn,
create please one field multiple with storage:  standard | Artikel | state in your search-form with 4 options:

Unpublished=0
Published=1
Archived=2
Trashed=-2
With Button 3 (Match + Stage) in your form (SearchForm) you have to choose Words | Any Words Exact
Thats all!
Rest regards
Castor




9 years ago
6
Level 2

Hi Castor. Thanks for your answer. But...

Excuse me, but why? I don't need results with any state. I need results with state=0 OR publish_down<NOW. In one list. That is problem.

46 Posts
Castor
9 years ago
5
Level 3

Hi ComeOn,

I use a great plugin for this problem from mediahof in germany - is it free - and works fine.

You can find this under http://extensions.mediahof.de/downloads/autoarchive.html   

Dont forget to activate this plugin and to specify your categories in the basic options from this plugin autoArchiv.

After that you can search your articles under Archived

Thats all

Best regards

Castor

9 years ago
4
Level 4

Thanks, but it not very nice... But it can be used, you are right.

46 Posts
Castor
9 years ago
3
Level 5
Hi ComeOn,
If you want to solve everything with seblod:

1. create one calendar-field in your SearchForm  storage: standard | article | publish_down
With Button 3 (Match + Stage) in your form (SearchForm) you have to choose Date & Time| Past ( < or = )
you can set as default-value now

2. create one text-field in your SearchForm  storage: standard | article | publish_down
With Button 3 (Match + Stage) in your form (SearchForm) you have to choose Exclusion| Not Equal
you have to set as default-value 0000-00-00 00:00:00

3. in your multiple-field you can set as default 0,1

4. If it works fine you can hidden all the fields not necessary (e.g. text-field default: 0000-00-00 00:00:00)

best regards
Castor


9 years ago
2
Level 6

Hi, Castor. 

Thank that you don't stop to try help me :)

In this case we'll have AND condition - publish_down<NOW AND (state=0 OR state=1)

46 Posts
Castor
9 years ago
1
Level 7
Hi ComeOn,
Try this in phpMyAdmin (XXXX = your suffix in your Database):
SELECT * FROM `XXXX_content` WHERE state = 0 OR publish_down <= '2013-11-07 18:29:57'
This is equivalent to SELECT ...blablabla... when state=0 OR publish_down<NOW...

The result is all your entries from your content-table, because all articles (published or unpublished) have publish_down = '0000-00-00 00:00:00' when this field is not set.

Conclusion: OR is not a good solution (mysql takes either state or publish_down for comparison)

If you only want to have entries with state = 0 (Really unpublished articles)- you have to change the value in the filed multiple-select to Unpublished


With my suggestion you can find unpublished expired articles and / or published expired articles 


best regards
Castor


9 years ago
0
Level 8

Carsten, I think, I understood you.

In this case I have such debug:

...t1.publish_down < '2013-11-13 07:39:00' AND ((t1.state = '0') OR (t1.state = '1') OR (t1.state = '2')) AND t1.created_by = '126' GROUP BY t0.pk ORDER BY t1.catid ASC

e.g. I haven't  articles which publish_down >NOW but state=0. But I need them also...

Get a VIP membership