• Resolved Begin

    (@bentalgad)


    When i use this code:

    $pro_paypal_box->add_group_field( $pro_paypal_kidum, array(
    'name' => 'place',
    'id' => 'place',
    'type' => 'select',
    'show_option_none' => true,
    'options' => $places_options,
    ) );
    $pro_paypal_box->add_group_field( $pro_paypal_kidum, array(
    'name' => 'kidum_state',
    'id' => 'state',
    'type' => 'select',
    'show_option_none' => true,
    'default' => 'active',
    'options' => array(
    'active' => 'active',
    'canceled' => 'canceled',
    ),
    ) );

    I get ‘canceled’ as default option.

Viewing 15 replies - 1 through 15 (of 35 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Can you provide your entire configuration? I’m not managing to recreate on my own.

    Also what version of CMB2 are you presently running?

    Thread Starter Begin

    (@bentalgad)

    Oh, i was using 2.2.4, and now i updated to 2.2.5 and it works. Thanks!

    Thread Starter Begin

    (@bentalgad)

    *For some reason now that i updated my “remove this group” button is disabled. weird bug ill open up another threat though…

    • This reply was modified 7 years, 3 months ago by Begin.
    Thread Starter Begin

    (@bentalgad)

    Ok, i had to reset the database after updating to get rid of this last problem. thanks.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Welcome.

    Plugin Author Justin Sternberg

    (@jtsternberg)

    There was a bug with 2.2.5, so I just released 2.2.5.1 to address it: https://github.com/CMB2/CMB2/releases/tag/v2.2.5.1. You may have to wait a day for the update to show in your WordPress dashboard.

    Thread Starter Begin

    (@bentalgad)

    Great! Thanks!

    Thread Starter Begin

    (@bentalgad)

    I updated to 2.2.5.1, Still has some buggy thing, sometimes when i remove and add new the new one has values from deleted one.

    Plugin Author Justin Sternberg

    (@jtsternberg)

    You’ll need to give a lot more details, including the stuff Michael requested above in order for us to debug further.

    Thread Starter Begin

    (@bentalgad)

    What details?

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    First part of my first reply. Your CMB2 configuration for this.

    Thread Starter Begin

    (@bentalgad)

    oh, ok here it is:

    // PayPal Box
    add_action( 'cmb2_init', 'add_pro_paypal_box' );
    function add_pro_paypal_box() {
    global $listmesettings_id;
    $pro_paypal_box = new_cmb2_box( array(
    'id'           => '_pro_paypal_box',
    'title'        => '???? ????? ????????',
    'object_types' => array( 'post_type_pros' ),
    'context'      => 'normal',
    'priority'     => 'high',
    ) );
    // Set places holder var (for Kidum group)
    foreach (get_categories('taxonomy=places_taxonomy&hide_empty=0') as $places_term ) { $places_options[$places_term->cat_ID] = $places_term->name;}
    // Kidum group
    $pro_paypal_kidum = $pro_paypal_box->add_field( array(
    'id'          => 'pro_paypal_kidum',
    'type'        => 'group',
    'options'     => array(
    'group_title'   => '??? ????? {#}',
    'add_button'    => '???? ??? ?????',
    'remove_button' => '??? ??? ?????',
    ),
    ) );
    $pro_paypal_box->add_group_field( $pro_paypal_kidum, array(
    'name' => '????',
    'id' => 'place',
    'type' => 'select',
    'show_option_none' => true,
    'options' => $places_options,
    ) );
    $pro_paypal_box->add_group_field( $pro_paypal_kidum, array(
    'name' => '??? ?????',
    'id' => 'state',
    'type' => 'select',
    'show_option_none' => true,
    'options' => array(
    'active' => '????',
    'canceled' => '?????',
    ),
    ) );
    $pro_paypal_box->add_group_field( $pro_paypal_kidum, array(
    'name' => '???? ?? ????? ????',
    'id' => 'payer_mail',
    'type' => 'text',
    'attributes'  => array(
    'readonly' => 'readonly',
    ),
    ) );
    $pro_paypal_box->add_group_field( $pro_paypal_kidum, array(
    'name' => '?????',
    'id' => 'start',
    'type' => 'text_small',
    'attributes'  => array(
    'readonly' => 'readonly',
    ),
    ) );
    $pro_paypal_box->add_group_field( $pro_paypal_kidum, array(
    'name' => '????',
    'id' => 'end',
    'type' => 'text_small',
    'attributes'  => array(
    'readonly' => 'readonly',
    ),
    ) );
    $pro_paypal_box->add_group_field( $pro_paypal_kidum, array(
    'name' => '???? ????? ????',
    'id' => 'subscr_id',
    'type' => 'text_small',
    'attributes'  => array(
    'readonly' => 'readonly',
    ),
    ) );
    $pro_paypal_box->add_group_field( $pro_paypal_kidum, array(
    'name' => '????',
    'id' => 'price',
    'type' => 'text_small',
    'attributes'  => array(
    'readonly' => 'readonly',
    ),
    ) );
    $pro_paypal_box->add_group_field( $pro_paypal_kidum, array(
    'name' => '????',
    'id' => 'fee',
    'type' => 'text_small',
    'attributes'  => array(
    'readonly' => 'readonly',
    ),
    ) );
    }
    Thread Starter Begin

    (@bentalgad)

    Just to make it clearer what happens is no matter how many times i add a new group they all added with the same values of that old (removed) one.

    Thread Starter Begin

    (@bentalgad)

    if i reset the database it’s ok.

    Thread Starter Begin

    (@bentalgad)

    Update: even after reseting the database it seem to come back if remove all fields. weird thing ??

Viewing 15 replies - 1 through 15 (of 35 total)
  • The topic ‘The default parameter don’t work in group fields’ is closed to new replies.