Viewing 17 reply threads
  • Author
    Posts
    • #4552
      justin
      Member

      I have a Group field that is set as add_more => true and after I ran the script successfully, the data in the database is not formatted the same. It seems like it is pulling correctly inside of the user profile, and if I update the profile, then the mysql data is updated to the new corrected format. The problem I am having is displaying the content with 2 different formats and it broke my front-end template that displays the data.

      Data saved before migration:
      Array ( [0] => Array ( [user_job] => Array ( [0] => 3464 [1] => 3698 ) [user_job_start] => Array ( [0] => 2010-02-05 [1] => 2012-04-29 ) [user_job_current] => Array ( [0] => Array ( [0] => job_old ) [1] => Array ( [0] => job_current ) ) [user_job_end] => Array ( [0] => 2012-04-28 [1] => ) ) )

      Data saved after migration:
      Array ( [0] => Array ( [0] => Array ( [user_job] => 3695 [user_job_start] => 2014-09-11 [user_job_current] => Array ( [0] => job_current ) [user_job_end] => ) [1] => Array ( [user_job] => 3582 [user_job_start] => 2015-06-09 [user_job_current] => Array ( [0] => job_old ) [user_job_end] => 2015-10-07 ) ) )

      Here is my group

      piklist('field', array(
          'type' => 'group'
          ,'field' => 'user_jobs_group'
          ,'add_more' => true
          ,'label' => __('Jobs')
      	,'columns' => 12
          ,'description' => 'Add each job and history.'
          ,'fields' => array(
      		array(
              'type' => 'select'
              ,'field' => 'user_job'
              ,'label' => 'Job'
              ,'columns' => 4
              ,'choices' => piklist(
      						get_posts(
      							array(
      								'post_type' => 'post_jobs'
      								,'orderby' => 'title'
      								,'order' => 'asc'
      								,'posts_per_page' => -1
      								,'post_status'=> 'any'
      							)
      							,'objects'
      						)
      						,array(
      							'ID'
      							,'post_title'
      						)
      						)
            )
      	  ,array(
      	  'type' => 'datepicker'
      	 ,'field' => 'user_job_start'
      	 ,'label' => 'Start'
      	 ,'columns' => 3
      	,'options' => array(
      	   'dateFormat' => 'yy-mm-dd'
      	   ,'firstDay' => '0'
      	)
          )
      	,array(
              'type' => 'radio'
      		,'field' => 'user_job_current'
      		,'label' => 'Current?'
      		,'columns' => 2
      		,'choices' => array(
      		  'job_current' => 'Current'
      		  ,'job_old' => 'Past'
      )
            )
      	,array(
      	  'type' => 'datepicker'
      	 ,'field' => 'user_job_end'
      	 ,'label' => 'End'
      	 ,'columns' => 3
      	 ,'conditions' => array(
         array(
          'field' => 'user_job_current'
          ,'value' => 'job_current'
         )
       )
      	,'options' => array(
      	   'dateFormat' => 'yy-mm-dd' 
      	   ,'firstDay' => '0'
      	)
          )
      	)
      
        ));
    • #4558
      Steve
      Keymaster

      @justin– I’m sorry if our initial blog post wasn’t clear. We changed the array structure to make it easier for you. Any custom code you wrote targeting a specific array key will probably not work. You can now loop through this data with standard foreach loops.

      We’re sorry for any confusion. But the feedback we’ve received is that making this small change now, will make things better for all Piklist developers in the future.

    • #4561
      justin
      Member

      I understand that the arrays were changed, and that is absolutely fine with me, and I think it is a lot better. I thought though that the script that 0.9.9.2 had that ran initially was suppose to change all of the old structures to the new array structure. What I am saying is that they did not change them. I would have to go into each of the user profiles and hit save in order for the array to be updated to the new structure.

      I was letting you up know that the script did not seem to work. I have an ok solution right now by manually determining which type of structure it is and outputting it with the correct method. I was hoping though that you had a solution to transition all my old data to the new structure.

    • #4562
      Steve
      Keymaster

      @justin– I’m sorry, I didn’t understand.

      Do you have some legacy user meta data you send to us so we can test? The upgrade script was supposed to fix everything.

    • #4563
      justin
      Member

      Yea, this is legacy user_meta from myPHPAdmin after the script was run.

      a:4:{s:8:"user_job";a:1:{i:0;s:4:"3467";}s:14:"user_job_start";a:1:{i:0;s:10:"2009-09-05";}s:16:"user_job_current";a:1:{i:0;a:1:{i:0;s:7:"job_old";}}s:12:"user_job_end";a:1:{i:0;s:10:"2010-07-08";}}

      If I go into a profile and save a user’s profile for this field, this is what is saved to my database, in the correct format:

      a:1:{i:0;a:4:{s:8:"user_job";s:4:"3695";s:14:"user_job_start";s:10:"2014-09-11";s:16:"user_job_current";a:1:{i:0;s:11:"job_current";}s:12:"user_job_end";s:0:"";}}

      Thanks,

    • #4566
      Steve
      Keymaster

      @justin– I just tested with your code and the script ran great for me. Updated the db just like it was supposed to.

      Any other details you can offer would help.

    • #4568
      justin
      Member

      The only other thing I can think of is that I have almost 2000 users in my database. Each user probably has 10-15 pieces of meta-data created by piklist. It said the script was successful, but maybe it error-ed out because of the size? The whole thing probably took 30 seconds, so that would be a lot of meta to zip through and update.

      Would re-running the script cause any harm?

    • #4569
      Steve
      Keymaster

      Rerunning the script should be fine. But we still recommend backing up your data first.

    • #4573
      justin
      Member

      How would I force the rerun of the script?

      Would I delete the “piklist_updates” row from my wp_options table?

      I think maybe it just was not run properly, because I think my plugin was not turned on when the last update was run.

      Thanks,

    • #4574
      Steve
      Keymaster

      Can you go to this page: yourdomain.com/wp-admin/admin.php?page=piklist_update_0_9_9

    • #4575
      justin
      Member

      I am logged in as the administrator and it says “You do not have sufficient permissions to access this page.”

    • #4579
      Steve
      Keymaster

      Add this to your wp_options table:

      Option Name: piklist_updates
      Option Value:: a:1:{s:7:"piklist";a:1:{i:0;s:5:"0.9.9";}}

      That should trigger it.

    • #4580
      justin
      Member

      So That was part of the problem. I can see that it did update some of my other fields, but it keeps failing. It just stalls, and this is what is in the debug log. I have tried running it 2 times and it keeps getting stuck here.

      [14-Oct-2015 17:26:08 UTC] WordPress database error Got error 'empty (sub)expression' from regexp for query SELECT user_id FROM xs_usermeta WHERE meta_key = 'user_jobs_group' AND CAST(meta_value AS CHAR) RLIKE '' ORDER BY CAST(meta_value AS CHAR)  made by do_action('wp_ajax_piklist_update_0_9_9'), call_user_func_array, Piklist_Update_0_9_9->ajax, include('/plugins/extreme-items/parts/meta-boxes/job-meta-box.php'), WP_User_Query->__construct, WP_User_Query->prepare_query, WP_Meta_Query->get_sql, apply_filters_ref_array, call_user_func_array, Piklist_WordPress::get_meta_sql, Piklist_WordPress::get_sql_for_query
      [14-Oct-2015 17:26:09 UTC] WordPress database error Got error 'empty (sub)expression' from regexp for query SELECT user_id FROM xs_usermeta WHERE meta_key = 'user_jobs_group' AND CAST(meta_value AS CHAR) RLIKE '' ORDER BY CAST(meta_value AS CHAR)  made by do_action('wp_ajax_piklist_update_0_9_9'), call_user_func_array, Piklist_Update_0_9_9->ajax, include('/plugins/extreme-items/parts/meta-boxes/job-side.php'), WP_User_Query->__construct, WP_User_Query->prepare_query, WP_Meta_Query->get_sql, apply_filters_ref_array, call_user_func_array, Piklist_WordPress::get_meta_sql, Piklist_WordPress::get_sql_for_query

      I uploaded my two files that are listed in the error logs.
      https://drive.google.com/folderview?id=0BwbidsNuwyPoVEJodHdzeGZkaFU&usp=sharing

      thanks

    • #4587
      Steve
      Keymaster

      @justin– We’ll get this fixed in the next release of the beta.

    • #4601
      Kevin
      Keymaster

      @Justin-

      Check out the latest version, this issue should be resolved with the latest update to the upgrade script.

      Thanks,

      Kevin

    • #4623
      justin
      Member

      Hi guys, I just tried to update my data again after updating to 0.9.9.3, and I received the this error still in my debug logs.

      [19-Oct-2015 15:08:04 UTC] WordPress database error Got error 'empty (sub)expression' from regexp for query SELECT DISTINCT SQL_CALC_FOUND_ROWS xs_users.* FROM xs_users INNER JOIN xs_usermeta ON ( xs_users.ID = xs_usermeta.user_id ) WHERE 1=1 AND ( 
        ( xs_usermeta.meta_key = 'user_jobs_group' AND CAST(xs_usermeta.meta_value AS CHAR) RLIKE '' )
      ) ORDER BY user_login ASC  made by do_action('wp_ajax_piklist_update_0_9_9'), call_user_func_array, Piklist_Update_0_9_9->ajax, include('/plugins/extreme-items/parts/meta-boxes/job-meta-box.php'), WP_User_Query->__construct, WP_User_Query->query
      [19-Oct-2015 15:08:05 UTC] WordPress database error Got error 'empty (sub)expression' from regexp for query SELECT DISTINCT SQL_CALC_FOUND_ROWS xs_users.* FROM xs_users INNER JOIN xs_usermeta ON ( xs_users.ID = xs_usermeta.user_id ) WHERE 1=1 AND ( 
        ( xs_usermeta.meta_key = 'user_jobs_group' AND CAST(xs_usermeta.meta_value AS CHAR) RLIKE '' )
      ) ORDER BY user_login ASC  made by do_action('wp_ajax_piklist_update_0_9_9'), call_user_func_array, Piklist_Update_0_9_9->ajax, include('/plugins/extreme-items/parts/meta-boxes/job-side.php'), WP_User_Query->__construct, WP_User_Query->query
    • #4629
      Steve
      Keymaster

      @justin– Is this an install we can log into? If so, we’d appreciate if you could email some log in info. We would need WP, FTP and DB access. Email to [email protected]

    • #4669
      Steve
      Keymaster

      @justin– we logged into your site and ran the update. All looks good to us.

Viewing 17 reply threads
  • The topic ‘Add More + GROUP data not correct [0.9.9.2]’ is closed to new replies.