Shortcode for User fields
-
I have a custom user field that I created under user profiles that has an attachment (example: the field label is resume_word)
I wanted to use a shortcode to pull the custom field, if there is an attachment , over to a page with the shortcode. I want the users resume file to display
I keep getting an error when trying and it just displays “array”..
I’m just learning and wasn’t sure exactly how to do this if it has an attachment and it being a custom field I entered for the user profile.
Thank you.
-
Hello,
Currently, the plugin doesn’t have much support for user fields that are stored as arrays. I can see if adding some extra parameters will make it possible. Could you tell me the code you’re using to display the user field? Are you using the
[field]or[user]shortcode?Hi, I am using the user shortcode:
[user resume_word_format]
Thanks
In the newest plugin update, I added a way to look inside a user field stored as array. Can you tell me the output of the following code?
[array user_field=resume_word_format debug=true]Hi the output from above is:
Array
(
[_edit_lock] => Array
(
[0] => 1440869309:1
)[_edit_last] => Array
(
[0] => 1
)[_wp_page_template] => Array
(
[0] => default
)[_wpb_vc_js_status] => Array
(
[0] => false
)[_vc_post_settings] => Array
(
[0] => a:2:{s:7:”vc_grid”;a:0:{}s:10:”vc_grid_id”;a:0:{}}
)[slide_template] => Array
(
[0] =>
)[_x_entry_body_css_class] => Array
(
[0] =>
)[_x_entry_alternate_index_title] => Array
(
[0] =>
)[_x_entry_disable_page_title] => Array
(
[0] => off
)[_x_page_one_page_navigation] => Array
(
[0] => Deactivated
)[_x_entry_bg_image_full] => Array
(
[0] =>
)[_x_entry_bg_image_full_fade] => Array
(
[0] => 750
)[_x_entry_bg_image_full_duration] => Array
(
[0] => 7500
)[_x_slider_above] => Array
(
[0] => Deactivated
)[_x_slider_above_bg_video] => Array
(
[0] =>
)[_x_slider_above_bg_video_poster] => Array
(
[0] =>
)[_x_slider_above_scroll_bottom_anchor_enable] => Array
(
[0] => off
)[_x_slider_above_scroll_bottom_anchor_alignment] => Array
(
[0] => top left
)[_x_slider_above_scroll_bottom_anchor_color] => Array
(
[0] => #ffffff
)[_x_slider_above_scroll_bottom_anchor_color_hover] => Array
(
[0] => #ffffff
)[_x_slider_below] => Array
(
[0] => Deactivated
)[_x_slider_below_bg_video] => Array
(
[0] =>
)[_x_slider_below_bg_video_poster] => Array
(
[0] =>
)[_x_slider_below_scroll_bottom_anchor_enable] => Array
(
[0] => off
)[_x_slider_below_scroll_bottom_anchor_alignment] => Array
(
[0] => top left
)[_x_slider_below_scroll_bottom_anchor_color] => Array
(
[0] => #ffffff
)[_x_slider_below_scroll_bottom_anchor_color_hover] => Array
(
[0] => #ffffff
)[_x_portfolio_category_filters] => Array
(
[0] => a:1:{i:0;s:14:”All Categories”;}
)[_x_portfolio_columns] => Array
(
[0] => Two
)[_x_portfolio_layout] => Array
(
[0] => full-width
)[_x_portfolio_posts_per_page] => Array
(
[0] => 24
)[_x_portfolio_disable_filtering] => Array
(
[0] => off
))
Hmm..I don’t see any attachment ID there.
Does this display anything?
[array user_field=resume_word debug=true]Hopefully there’s some data there that we can use to find the attachment.
Also, what theme/plugin are you using to create this user field?
Hi
I’m using Xtheme and for the user field I’m using the Pods plugin. I looked to make sure my field name is correct and also I was able to attach a file under the new field on the actual user’s profile so I know its functioning…hmmmmm[array user_field=resume_word debug=true] looks like this:
Array
(
[_edit_lock] => Array
(
[0] => 1440881029:1
)[_edit_last] => Array
(
[0] => 1
)[_wp_page_template] => Array
(
[0] => default
)[_wpb_vc_js_status] => Array
(
[0] => false
)[_vc_post_settings] => Array
(
[0] => a:2:{s:7:”vc_grid”;a:0:{}s:10:”vc_grid_id”;a:0:{}}
)[slide_template] => Array
(
[0] =>
)[_x_entry_body_css_class] => Array
(
[0] =>
)[_x_entry_alternate_index_title] => Array
(
[0] =>
)[_x_entry_disable_page_title] => Array
(
[0] => off
)[_x_page_one_page_navigation] => Array
(
[0] => Deactivated
)[_x_entry_bg_image_full] => Array
(
[0] =>
)[_x_entry_bg_image_full_fade] => Array
(
[0] => 750
)[_x_entry_bg_image_full_duration] => Array
(
[0] => 7500
)[_x_slider_above] => Array
(
[0] => Deactivated
)[_x_slider_above_bg_video] => Array
(
[0] =>
)[_x_slider_above_bg_video_poster] => Array
(
[0] =>
)[_x_slider_above_scroll_bottom_anchor_enable] => Array
(
[0] => off
)[_x_slider_above_scroll_bottom_anchor_alignment] => Array
(
[0] => top left
)[_x_slider_above_scroll_bottom_anchor_color] => Array
(
[0] => #ffffff
)[_x_slider_above_scroll_bottom_anchor_color_hover] => Array
(
[0] => #ffffff
)[_x_slider_below] => Array
(
[0] => Deactivated
)[_x_slider_below_bg_video] => Array
(
[0] =>
)[_x_slider_below_bg_video_poster] => Array
(
[0] =>
)[_x_slider_below_scroll_bottom_anchor_enable] => Array
(
[0] => off
)[_x_slider_below_scroll_bottom_anchor_alignment] => Array
(
[0] => top left
)[_x_slider_below_scroll_bottom_anchor_color] => Array
(
[0] => #ffffff
)[_x_slider_below_scroll_bottom_anchor_color_hover] => Array
(
[0] => #ffffff
)[_x_portfolio_category_filters] => Array
(
[0] => a:1:{i:0;s:14:”All Categories”;}
)[_x_portfolio_columns] => Array
(
[0] => Two
)[_x_portfolio_layout] => Array
(
[0] => full-width
)[_x_portfolio_posts_per_page] => Array
(
[0] => 24
)[_x_portfolio_disable_filtering] => Array
(
[0] => off
))
I retried it with the first one you gave me after the last update and got this:
Array
(
[ID] => 7980
[post_author] => 1
[post_date] => 2015-08-18 17:05:58
[post_date_gmt] => 2015-08-18 21:05:58
[post_content] =>
[post_title] => Sherri Killough Resume April 2015
[post_excerpt] =>
[post_status] => inherit
[comment_status] => open
[ping_status] => open
[post_password] =>
[post_name] => sherri-killough-resume-april-2015
[to_ping] =>
[pinged] =>
[post_modified] => 2015-08-26 20:03:22
[post_modified_gmt] => 2015-08-27 00:03:22
[post_content_filtered] =>
[post_parent] => 0
[guid] => http://virtualjobconnections.com/wp-content/uploads/2015/08/Sherri-Killough-Resume-April-2015.docx
[menu_order] => 0
[post_type] => attachment
[post_mime_type] => application/vnd.openxmlformats-officedocument.wordprocessingml.document
[comment_count] => 0
[pod_item_id] => 7980
)Ah, OK – so there’s the attachment data. Hopefully these fields are sufficient for your purpose.
The following should display the attachment title as a link:
[array user_field=resume_word_format] <a href="[field guid]">[field post_title]</a> [/array]
The topic ‘Shortcode for User fields’ is closed to new replies.