Custom Fields
Re-Envisioned
Support MB Frontend Submission Group "std" doesn't work on frontend ?

  • Creator
    Topic
  • #16467
    Resolved Kevin
    Participant

    Hi,

    is the “std” paramters of group filedtype is working with front end submission/edition, i can see it works on backend but i need it to work on front end, and it doesn’t seems to do so :/

    I’ve already tested rwmb_frontend_field_{attributes} (both query and hook), unsuccessfully.

    Hope you can help on this

    have a nice day,
    Kevin

Viewing 9 replies - 1 through 9 (of 9 total)
  • Author
    Replies
  • #16479
    Anh Tran
    Keymaster

    Hi Kevin, the std param should work on both back end and front end. I added some docs on setting std for groups a couple of days ago, please take a look.

    #16482
    Kevin
    Participant

    Hi Anh,

    i did, here’s my code (set in fields, as i say, everything works fine on backend) :

    https://pastebin.com/heLuGZgS

    thanks for your help

    #16483
    Kevin
    Participant

    just to be sure i’m not missing anything, here’s a pastebin

    https://pastebin.com/YRzuC38S

    #16484
    Kevin
    Participant

    Sorry i wasn’ t clear enough in my previous answer, it sill not working on front end, even with the code set up in the previous pastebin

    #16495
    Anh Tran
    Keymaster

    Hi Kevin, I see the problem. Let me check and fix it.

    #16549
    Kevin
    Participant

    Hi Anh, as far as i can get from now, by editing group-field.php child_field_std() function, i successfully show the array in the field, but i don’t understand how to show them in two separate clone. any clue ?

    protected static function child_field_std( $parent, $child, $meta ) {
            // Respect 'std' value set in child field.
            if ( ! empty( $child['std'] ) ) {
                return $child['std'];
            }
    
                $meta = $parent['std'];
    
                foreach($meta as $k => $v):
                   $std[$k] = $meta[$k][$child['id']] = $v[$child['id']];
                endforeach;
    
                // $meta contains $parent['std'] or clone's std.
                //$std = isset( $meta[$child['id']] ) ? $meta[$child['id']] : '';
                return $std;
    
        }

    thanks for your help,
    K

    #16550
    Kevin
    Participant

    ok, i finally get it,

    in group-field.php, under the html() function, you have to check if $field[‘std’] isset or not

    line 108 :

    // Remove filter to child field meta value and reset class's parent field's meta.
            if(!isset($field['std']))://ADD THIS
            if ( empty( self::$meta_queue ) ) {
                remove_filter( 'rwmb_field_meta', array( __CLASS__, 'child_field_meta' ) );
            }
            endif;//AND THIS

    and all works fine now.

    Hope these helps
    Thanks
    K

    #16581
    Anh Tran
    Keymaster

    Hi Kevin,

    Thanks a lot for your help. I was able to fix this issue another way and just released the version 1.3.6 of the plugin. Meta Box AIO and MB Core will be released later today.

    #16594
    Kevin
    Participant

    Thanks Anh

    have a nice day
    K

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