Viewing 15 replies - 1 through 15 (of 15 total)
  • Thread Starter miharix

    (@miharix)

    To be more clear what Im trying to do.
    Filter the display of values to be like this SQL:
    SELECT * FROMwp_wct5WHERE datum>=NOW()

    but can’t find the example how to do this in this plugin.

    Plugin Author Stefan M.

    (@stefan-m-1)

    Hi

    Use time()

    SELECT * FROM wp_wct5 WHERE datum >= 'time()'

    Plugin Author Stefan M.

    (@stefan-m-1)

    But:

    SELECT * FROM wp_wct5 WHERE datum >= 'time()'

    can return some dates not, because of the time within the date when its been stored. Therefor its possible that you need to use

    SELECT * FROM wp_wct5 WHERE datum >= 'time()-1d'

    that the correct entries are displayed. Try it.

    Thread Starter miharix

    (@miharix)

    I’m probably doing something really stupid…

    I’m putting this in my page:
    [wctable id="5" filter="SELECT * FROM wp_wct5 WHERE datum >= 'time()-1d'"]

    result none (WP3.3)

    Plugin Author Stefan M.

    (@stefan-m-1)

    This one will work:
    [wctable id="5" filter="datum >= 'time()-1d'"]

    Plugin Author Stefan M.

    (@stefan-m-1)

    2.6.0 will have cronjob functionality (Premium Feature), where you can automatically set all entries to passive which are older then last day…

    Thread Starter miharix

    (@miharix)

    great info & it’s working many thanks

    just one more tiny question.
    wctselect isn’t supporting filters?

    [wctselect id="5" field="razred" maintext="Razred" filter="datum >= 'time()-1d'"]

    Plugin Author Stefan M.

    (@stefan-m-1)

    no and yes.

    You DONT need to add filter=”” and no, this is not supported.

    BUT, if you have a filter on the table, the filter is automatically set by the wctselect (Bugfix in v2.6.0 added).

    So, add the filter on the table and dont care about, will added automatically in the select.

    Thread Starter miharix

    (@miharix)

    it’s some how not working in my case:

    [wctselect id="5" field="razred" maintext="Razred"] [wctselect id="5" field="nadomesca" maintext="Nadome??a" ]
    
    [wctable id="5" filter="datum >= 'time()-1d'"]

    Im Using WrodPress V3.3 and custom tables V2.6.0
    I thing the WP3.3 is the problem because when I do
    custom tables -> table name -> view setup -> table setup
    it seems that those red and blue buttons (table,link,kategory…) are gone :/

    Plugin Author Stefan M.

    (@stefan-m-1)

    confirmed v3.3 bug ??

    They have changed the impelemtation of the Visual editor, need to change that.

    Plugin Author Stefan M.

    (@stefan-m-1)

    I did a fix for it, hope it runs well. Please report back!!

    Thread Starter miharix

    (@miharix)

    Yes & No

    The custom tables -> table name -> view setup -> table setup those red and blue buttons (table,link,kategory…) are back and working ??

    but the [wctselec … isn’t

    it shows all values & (counts) but the table is today empty (all dates are older)

    Plugin Author Stefan M.

    (@stefan-m-1)

    hm.. error in the filter?

    If the filter has an error, no items will be displayed and no wntries are in wctselect. Thats normal.

    Can you send me the shortcode including the filter which you have added?

    Or there are no entries within the db which are newer.
    Please check.

    Thread Starter miharix

    (@miharix)

    In the page I have only

    [wctselect id="5" field="razred" maintext="Razred"] [wctselect id="5" field="nadomesca" maintext="Nadome??a" ]
    
    [wctable id="5" filter="datum >= 'time()-1d'"]

    the fields “razred” and “nadomesca” are type varchar(32)
    the field datum is type date

    the filter on table works so in this moment the table displays empty. this is correct because all entry in field “datum” are older than today.

    but both the wctselect drop downs contain all the values of the table (if the filter would apply they shouldn’t display anything like the wctable)

    Plugin Author Stefan M.

    (@stefan-m-1)

    Yes, thats correct.

    If you add the wctselects to the headerline, you will not need to add a filter. If you add them directly on the page (as you do) there is no way right now to filter.

    I will add there the filter also for the next version.

    Otherwise if you have premium, you can enable the cronjob for the date as
    UPDATE wp_wct5 SET status=’passive’ WHERE date <= ‘time()’;

    and you dont need the filter on the table or wctselect.
    Or as sad, wait on next version (I added it already on the development version right now).

    Regards

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘[Plugin: custom tables] Filter by date field’ is closed to new replies.