Custom Fields
Re-Envisioned
Support General Metabox 4.15.4 (switch)

This topic contains 9 replies, has 2 voices, and was last updated by  Hazmi 5 months, 2 weeks ago.

  • Creator
    Topic
  • #11186
    Resolved
    Hazmi
    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 :/

Viewing 9 replies - 1 through 9 (of 9 total)
  • Author
    Replies
  • #11188

    Anh 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 Tran
    Keymaster

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

    Thanks
    Anh

    #11190

    Hazmi
    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 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

    Hazmi
    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 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

    Hazmi
    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 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

    Hazmi
    Participant

    OK, thank you for your support.

Viewing 9 replies - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.