Custom-Meta-Boxes icon indicating copy to clipboard operation
Custom-Meta-Boxes copied to clipboard

i cant get metaboxees

Open srextasagar32 opened this issue 7 years ago • 8 comments

Fatal error: Uncaught Error: Cannot unset string offsets in D:\xampp\htdocs\seperate\wp-content\plugins\Custom-Meta-Boxes-1.1.0\class-cmb-meta-box.php:78

srextasagar32 avatar Feb 20 '18 10:02 srextasagar32

@srextasagar32 can you please provide some context to this?

What are the metaboxes you're using that is causing this? What data do you have saved to those metaboxes? What environment (PHP version, WP version, etc) are you using?

mikeselander avatar Feb 20 '18 16:02 mikeselander

I have used this plugin since last couple of years. but there was an uncaught error. Metaboxes means the meta values this plugin generates. I am using php 7.1 and wordpress 4.9.4

srextasagar32 avatar Feb 26 '18 08:02 srextasagar32

@srextasagar32 I understand that there was an uncaught error, but I need more information from you to debug this.

  1. What metaboxes are triggering this? By this, I need to see the code creating the metaboxes you are using.
  2. What data is saved to those metaboxes? By this, I need to see what data is coming from the database for the metaboxes triggering this error.

mikeselander avatar Feb 27 '18 21:02 mikeselander

@mikeselander I ran into this issue as well. Just to share, it appears related to the group field. Here's the code I was using. It could be incorrect, but when I do remove the group field, the meta box renders correctly.

$metaboxes[] = [
            'title'      => 'Edit Team Member',
            'fields'     => [
                'id'     => 'member-fields',
                'name'   => 'Member Data',
                'type'   => 'group',
                'fields' => self::$fields,
            ],
            'pages'      => 'Teams Members',
            'context'    => 'advanced',
            'priority'   => 'high',
        ];

I hope this helps.

fishstix81 avatar Mar 30 '18 03:03 fishstix81

@squibbleFish that does help!

Could you please also past the source of self::$fields so that I can see what kind of fields are being passed into the group?

mikeselander avatar Mar 30 '18 16:03 mikeselander

@mikeselander no problem. It's just a simple array of fields with the appropriate values.

static $fields = [
  [
    'id' => 'field-id-1',
    'name' => 'Name-1'
    'type' .  => 'text'
  ],
  [
    'id' => 'field-id-2',
    'name' => 'Name-2'
    'type' .  => 'text'
  ],
  [
    'id' => 'field-id-3',
    'name' => 'Name-3'
    'type' .  => 'textarea'
  ],
]

I hope this helps.

fishstix81 avatar Mar 30 '18 17:03 fishstix81

Hi there,

It's the pages argument in your config. It can't handle page titles. Deliver a page ID or multiple IDs in an array as described in the wiki ( https://github.com/humanmade/Custom-Meta-Boxes/wiki/Create-a-Meta-Box) instead.

Good luck

Stephen Fisher [email protected] schrieb am Fr., 30. März 2018, 05:20:

@mikeselander https://github.com/mikeselander I ran into this issue as well. Just to share, it appears related to the group field. Here's the code I was using. It could be incorrect, but when I do remove the group field, the meta box renders correctly.

$metaboxes[] = [ 'title' => 'Edit Team Member', 'fields' => [ 'id' => 'member-fields', 'name' => 'Member Data', 'type' => 'group', 'fields' => self::$fields, ], 'pages' => 'Teams Members', 'context' => 'advanced', 'priority' => 'high', ];

I hope this helps.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/humanmade/Custom-Meta-Boxes/issues/449#issuecomment-377434727, or mute the thread https://github.com/notifications/unsubscribe-auth/AD55fsgUSP7BATjKOpkFGiMo2PA17xMNks5tjaRpgaJpZM4SLu-M .

deivibub avatar Mar 30 '18 20:03 deivibub

@deivibub Thanks for checking in, but that is not the case. It does appear to be related to the group property. Most importantly, the fatal error points to this property being unset. https://github.com/humanmade/Custom-Meta-Boxes/blob/develop/class-cmb-meta-box.php#L78. With the incorrect page the box won't render in the UI, but a fatal is not thrown. Hope that helps.

fishstix81 avatar Mar 30 '18 20:03 fishstix81