- This topic has 2 replies, 2 voices, and was last updated 6 years, 1 month ago by
Steve.
-
AuthorPosts
-
-
January 5, 2016 at 8:28 pm #5495
friendlyfire3MemberI am creating user profile pages on the front end of the site.
I’m allowing them to upload a cover photo as a background image for their profile.
i’m following this to get the profile image uploaded to the profile
: https://piklist.com/user-guide/tutorials/displaying-images-upload-field/I have the field in the user’s folder in a plugin.
<?php /* Title: Profile Cover Photo Description: Displays on your profile as a background cover image Capability: manage_options */ // image upload piklist('field', array( 'type' => 'file' ,'field' => 'cover_image' ,'label' => 'Upload image' )); ?>I can upload the image just fine.
However, when I go to get the data back, I can’t get the id.
($author code is not referenced below but is a valid variable in this instance)$image_ids = get_user_meta($author->ID, 'cover_image'); print_r($image_ids);I get on the page:
Array ( )Any suggestions?
-
January 5, 2016 at 8:35 pm #5496
friendlyfire3MemberUpdate: I took out the key “cover_image” and noticed there’s a item called “my_image”. Turns out it is the same as what I added.
How do I change the key for it? I’d rather it be semantic and thought using the field key in piklist would do just that.
-
January 5, 2016 at 10:49 pm #5500
SteveKeymaster@friendlyfire3– When creating forms for the front-end of your website, you need to tell Piklist the scope of each field…where to save the data.
Add this:
'scope' => 'user_meta'
The field ‘my_image’ must be left over from something else. Piklist will save the field exactly how you specify it
-
-
AuthorPosts
- You must be logged in to reply to this topic.