Support » Plugin: Page Builder by SiteOrigin » $instance dosn't retrieve saved data

  • Hello , I’m planning to develop many widgets to work with your builder

    But I found a bug !

    in siteorigin-panels/widgets/widgets.php on line 149 “public function form($instance){“

    $instance should retrieve saved data but it’s empty cause you are saving widget’s settings as post meta “update_post_meta($post_id, ‘panels_data’, $panels_data);”

    is there any work around ???

    http://wordpress.org/plugins/siteorigin-panels/

Viewing 15 replies - 1 through 15 (of 17 total)
  • Plugin Author Greg Priday

    (@gpriday)

    Hi masteryo!

    Thanks for letting me know about this issue. I’m going to take a look at it as soon as I get back to the office.

    it’s possible to retrieve data in form function , but we need panel id to do that
    like this :

    $global $post
    $all_instances = get_post_meta($post->ID, 'panels_data', true);
    foreach($all_instances $as $i => $instances)
        if($this->panel_id == $i)
           $instance = $instances;

    unfortunately , you are creating panel id in panels.admin.panels.js , so it’s hard to get panel id in php
    formHtml = formHtml.replace( /\{\$id\}/g, newPanelId );

    Btw , edit gallery In gallery widget is not working

    error in firebug :
    ReferenceError: event is not defined
    event.preventDefault();
    panels.admin.media.js (line 83)

    You forgot to add event in ” click: function(){“
    click: function(event){

    Another Bug Found:
    if we enable “Copy Content to Post Content” I get always php timeout

    // Update the post, removing this action first so we don't infinite loop.
            remove_action('save_post', 'siteorigin_panels_save_post');
            wp_update_post($post);
            add_action('save_post', 'siteorigin_panels_save_post', 10, 2);

    I the above code didn’t fix stopping from infinite loop. If i remove it will work fine

    Plugin Author Greg Priday

    (@gpriday)

    Your official title is now Bug Finder Extraordinaire 🙂

    I’ll go over all these issues and fix up what I can. Most of the issues seem fixable.

    🙂 , thanks

    Please let me know once you fix the issue especially the first bug , Cause I’m not able to continue develop widgets without fixing it

    Plugin Author Greg Priday

    (@gpriday)

    Just letting you know I haven’t forgotten about this thread. I’ve been really busy with a new theme launch. I’ll be getting to these issues soon.

    actually I’v been checking your page builder plugin in github every day looking for updates ,Really thank you for your great support

    Don’t forget Please , let me know once you fix it

    Plugin Author Greg Priday

    (@gpriday)

    Is Page Builder on GitHub? I haven’t put it on myself, but due to popular demand, I’ll probably move development there as soon as I find some time.

    Huh? he is using your name that’s why I thought is you
    check it out https://github.com/wp-plugins/siteorigin-panels

    Plugin Author Greg Priday

    (@gpriday)

    That looks like something by Plugin Mirror that automatically syncs my updates from WP.org to GitHub. That’s pretty cool.

    http://www.pluginmirror.com/plugins/siteorigin-panels/

    It looks up to date, so you can keep an eye out for updates there.

    Dear Greg Priday, When do you think the first bug will be fixed?

    Cause if it’s going to take time , I’ll try to figure out work around

    I was trying to figure out a solution , but I think the only solution is to retrieve data & widget form of opened dialog using ajax

    Masteryo, would this explain why array data doesn’t show in the pagebuiler widget options but it does show on the site?

    @masteryo, your code in http://wordpress.org/support/topic/instance-dosnt-retrieve-saved-data?replies=15#post-4655592 really helped me get close. Here is what I had to do to make this work for me.

    public function form ( $instance ) {
        if ( empty( $instance ) ) {
          global $post;
          $all_instances = get_post_meta( $post->ID, 'panels_data', true);
          foreach( $all_instances['widgets'] as $i => $instances ) {
            if ( $this->panel_id == $i ){
              $instance = $instances;
            }
          }
        }
      /*
      awesome code for my custom widget
      */
    }

    In my case, my widget has fields that are loaded dynamically are are used in both the sidebar ( which already works fine ) and in the panels pages, so I just needed a condition for when the $instance is not available to the form function.

    I am so happy now, thanks everyone!

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘$instance dosn't retrieve saved data’ is closed to new replies.