- This topic has 11 replies, 3 voices, and was last updated 6 years, 4 months ago by
Steve.
-
AuthorPosts
-
-
March 12, 2015 at 1:44 pm #3458
vsaldaMemberI’m testing Piklist on my local machine. I activated the Piklist’s demos and checking the User profile part I noticed that ‘Default’ workflow tab isn’t displaying any info.
I debugged this part and I noticed two things:1. Class class-piklist-user.php seems to be in charge of registering User Profile fields. Around line 325, inside the conditional
if (isset($arguments['meta_boxes'])), it counts the availabe metaboxes available onself::$meta_boxes, which contains 13 and this number matches the available fields under/piklist-demos/parts/users, but there’s no file registering the User Profile fields.2. Under
/piklist-demos/parts/formsthere’s a file nameduser-profile.phpwhich registers profile’s fields that matches with those theuser-default.phpis trying to load.By the time
if (!in_array(self::$meta_boxes[$i]['config']['name'], $arguments['meta_boxes']))is run (on class-piklist-user.php),$arguments['meta_boxes']contains just five values:Personal Options, Name, Contact Info, About the user, About Yourselfwhich aren’t part ofself::$meta_boxes[$i], so it goes and unsets:unset(self::$meta_boxes[$i]).My question is, as I couldn’t find any reference on the documentation, how is
/parts/forms/used?? And for the profile’s default workflow tab to work, seems a file is missing inside ‘/parts/users/`in order to register this fields, is it right??Thanks for any hint that helps me clarify things.
VictorAttachments:
You must be logged in to view attached files. -
March 12, 2015 at 3:10 pm #3460
vsaldaMemberI’ve been checking the code for the forms part, and I found it is handled by the class-piklist-form.php and it is used to generated forms in the front end by using a shortcode, awesome.
So I guess I should add the fields needed for the default workflow tab to work.
Victor
-
March 12, 2015 at 3:11 pm #3461
-
March 12, 2015 at 3:21 pm #3462
vsaldaMemberHi @Steve, yup, that’s the file I was checking before and the one that took me to class-piklist-user.php, but when debugging, these metaboxes aren’t part of self::$meta_boxes[$i][‘config’][‘name’] and therefore $arguments[‘meta_boxes’] is unset. So I suspect it is because these fields aren’t in the /parts/users folder, I’m guessing by following the flow, just getting familiar with Piklist. So, should i add these fields under /parts/users or it is supposed to work just by activating? but I don’t see where user-default.php is pulling these ‘meta_boxes’ from.
-
March 12, 2015 at 3:57 pm #3463
-
March 12, 2015 at 6:56 pm #3465
vsaldaMember@Steve, it didn’t work. It’s a fresh install with only WordPress Importer and Piklist plugins active with Twentyfifteen theme and PHP 5.6.5. I will give it another try later. Thanks!
-
September 12, 2015 at 9:16 am #4310
okeanosMemberI just answer to myself. I found out the pb is about localization. My wp was in french and changing for english solved the issue.
For those who are trying to find a solution, it seems that by just adding the translated version of $meta_boxes it is working.
In the file admin-user-profile-fields.php, change :
var meta_boxes = ['<?php echo implode("', '", $meta_boxes); ?>'];to
<?php $translated_metaboxes = array(); foreach ($meta_boxes as $meta_box) { $translated_metaboxes[] = __($meta_box); } ?> var meta_boxes = ['<?php echo implode("', '", $translated_metaboxes); ?>']; -
September 12, 2015 at 11:55 pm #4314
-
September 14, 2015 at 11:33 am #4321
okeanosMember@Steve I don’t use localization plugin.
-
-
March 13, 2015 at 8:08 am #3467
vsaldaMemberI guess I’m getting closer, I modified the user-default.php to look like this:
<?php /* Title: Default Order: 10 Flow: User Test Default: true */ piklist('include_user_profile_fields', array( 'meta_boxes' => array( 'User Info' ) )); piklist('shared/code-locater', array( 'location' => __FILE__ ,'type' => 'Workflow Tab' )); ?>And added a file user-info.php to /parts/users containing:
<?php /* Title: User Info Capability: manage_options Order: 10 */ $current_user = wp_get_current_user(); $user_meta = get_user_meta($current_user->ID); piklist('field', array( 'type' => 'hidden' ,'scope' => 'user' ,'field' => 'ID' ,'value' => $current_user->ID )); piklist('field', array( 'type' => 'html' ,'scope' => 'user' ,'field' => 'user_login' ,'label' => 'User login' ,'value' => $current_user->user_login )); piklist('field', array( 'type' => 'password' ,'scope' => 'user' ,'field' => 'user_pass' ,'label' => 'Password' )); piklist('field', array( 'type' => 'text' ,'scope' => 'user_meta' ,'field' => 'first_name' ,'label' => 'First name' ,'value' => $user_meta['first_name'][0] )); piklist('field', array( 'type' => 'text' ,'scope' => 'user_meta' ,'field' => 'last_name' ,'label' => 'Last name' ,'value' => $user_meta['last_name'][0] )); piklist('field', array( 'type' => 'text' ,'scope' => 'user_meta' ,'field' => 'nickname' ,'label' => 'Nickname' ,'value' => $user_meta['nickname'][0] )); piklist('field', array( 'type' => 'text' ,'scope' => 'user' ,'field' => 'display_name' ,'label' => 'Display name' ,'value' => $current_user->display_name )); piklist('field', array( 'type' => 'text' ,'scope' => 'user' ,'field' => 'user_email' ,'label' => 'Email' ,'value' => $current_user->user_email ,'required' => true )); piklist('field', array( 'type' => 'text' ,'scope' => 'user' ,'field' => 'user_url' ,'label' => 'Website' ,'value' => $current_user->user_url )); piklist('field', array( 'type' => 'text' ,'scope' => 'user_meta' ,'field' => 'user_twitter' ,'label' => 'Twitter ID' ,'value' => $user_meta['user_twitter'][0] )); piklist('field', array( 'type' => 'text' ,'scope' => 'user_meta' ,'field' => 'description' ,'label' => 'Biographical Info' ,'value' => $user_meta['description'][0] )); piklist('field', array( 'type' => 'checkbox' ,'scope' => 'user_meta' ,'field' => 'checkbox' ,'label' => 'Keyboard Shortcuts' ,'choices' => array( 'true' => __('Enable keyboard shortcuts for comment moderation.', 'piklist-demo') ) )); piklist('field', array( 'type' => 'checkbox' ,'scope' => 'user_meta' ,'field' => 'checkbox' ,'label' => 'Toolbox' ,'choices' => array( 'true' => __('Show Toolbar when viewing site', 'piklist-demo') ) )); piklist('shared/code-locater', array( 'location' => __FILE__ ,'type' => 'Meta Box' ));I basically used the forms code. If I add info for First name and last name, those aren’t saved, but I works when I saved the Twitter ID. Any suggestion to get the user meta saved? Am I missing a paramater?
Thanks in advance
-
September 15, 2015 at 11:56 am #4328
-
-
AuthorPosts
- You must be logged in to reply to this topic.