Metabox 4.15.4 (switch)

Support General Metabox 4.15.4 (switch)Resolved

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #11186
    HazmiHazmi
    Participant

    I don't know, if there is somebody, who read tasks, that are marked as "resolved". So i create new topic.

    In your latest plugin upgrade this "Saved value 0 for switch field when it's off." didn't work. I have reported this probably a month ago.

    Your support is very poorly :/

    #11188
    Anh TranAnh Tran
    Keymaster

    Hi Hazmi,

    Sorry for the late reply. In the previous topic, I marked it as "resolved" when I pushed the commit that I thought it fixed the bug.

    Let me check it again and will reply you soon.

    #11189
    Anh TranAnh Tran
    Keymaster

    I've just fixed it on Github. Can you please try it?

    Thanks
    Anh

    #11190
    HazmiHazmi
    Participant

    Hi,

    fix is ok. (i must resave every post (thousands of posts)) to work with this.

    One more question: if i would like to have default value in "datetime" filed, what can i do? If i set "std => ' '" (white space string), i get "0" ind DB - it's ok?

    #11191
    Anh TranAnh Tran
    Keymaster

    I'm sorry for the "re-save". You can write a script to help you doing this.

    Regarding the datetime field, if you set 'std' => ' ', then when saving the post without specifying the datetime, it will save exactly as ' ' in the database. Actually, the plugin treats datetime field like a text field, unless you set 'timestamp' => true, which converts datetime into integer. And then in that case, the value is kind of unexpected, cause ' ' is converted to incorrect value.

    #11192
    HazmiHazmi
    Participant

    I have this:

    array(
                    'name'  => __( 'Show until', TEXTDOMAIN ),
                    'id'    => $prefix . 'show_until',
                    'type'  => 'datetime',
                    'size'  => 20,
                    'js_options' => array(
                        'regional'        => 'cz',
                        'appendText'      => '',
                        'dateFormat'      => 'yy-mm-dd',
                        'changeMonth'     => true,
                        'changeYear'      => true,
                        'showButtonPanel' => false
                    )
                ),

    What i have to do, if i would like default (empty?) record in DB (like 0 in switch)? The reason is, that i must query posts with conditional test EXISTS on this field - this is performance issue on larges sites..

    #11201
    Anh TranAnh Tran
    Keymaster

    Hi Hazmi,

    I've tried your code and it's working correctly. There is no '0' saved in the DB. Please see my video:

    http://recordit.co/z87n4n1I5i

    #11219
    HazmiHazmi
    Participant

    Hi,

    i don't know, how i get 0 in DB with 'std' => ' ', but now it's really empty.. :/ Nevermind. Back to my last question. Is there a way to have default value for field "datetime"?

    There is basic setting for fields 'std' .. but how it works? For example i have this:

    array(
    'name' => __( 'URL', TEXTDOMAIN ),
    'id' => $prefix . 'url',
    'type' => 'text',
    'std' => 'test'
    ),

    If i don't fill this field and save the post, than this field doesn't exists in DB. I forgot something?

    Is there a way to have 'std' setting work with datetime field? If so how?

    #11226
    Anh TranAnh Tran
    Keymaster

    Hi,

    The std is what you want. But it's applied (e.g. show) only when the meta box hasn't saved. So, if you have saved the meta box once, the field won't show the std value. You can check that with new post, where the meta box hasn't been saved and you'll see the std value is showing.

    #11227
    HazmiHazmi
    Participant

    OK, thank you for your support.

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.