PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Image / logo / avatar for user

  1. Hello,

    I need to store a logo / image for a user when registering or editing user profile. I also need to have edit / upload capability in the admin side of WP.

    I've checked Justin Tadlock's tutorial for custom user meta, but couldn't see the support for an image upload.

    What's the best way to do it?
    Many thanks, Dasha

    WP: 3.5.1.
    Gravity Forms: 1.6.12
    User Registration Add-on: 1.4

    Posted 11 years ago on Wednesday March 20, 2013 | Permalink
  2. I'm trying to do the same thing. Using the file upload function to attach a photo to either the avatar field of the user meta data or maybe to an extra custom field that is attached to the user object.

    Tried using the User registration add-on, but no luck so far.

    Posted 11 years ago on Friday March 22, 2013 | Permalink
  3. There is no support for setting avatar images in Gravity Forms. You can allow the upload of an image, but you will need to integrate that image with another plugin to store that image as the user's avatar.

    Posted 11 years ago on Saturday March 23, 2013 | Permalink
  4. Hello Chris,

    Thanks for letting me know. I'm trying to use Advanced Custom Fields plugin for displaying files in User Profile page.

    I was wondering if it's possible with filters or actions to achieve the following: to get the "File Upload" advanced field to do the following:

    1. Save img to the Media Library?
    2. In the User Registration I've got custom meta field that stores the data of the File Upload. By default it stores full URL. Can I store Media Library Upload (from the step 1) ID?

    I've tried using "Image" post field, but that completely doesn't work with User. I know that "Image" post field uploads to Media and (maybe) uses ID for associating it with a post. Could you help me to implement that bit of functionality for the "File Upload" field?

    I would very much appreciate any tips and help on how to achieve the two issues.

    Many thanks,
    Dasha

    Posted 11 years ago on Wednesday March 27, 2013 | Permalink
  5. I would not use a post field, and I would use the file upload field (I would restrict the uploads to image types.) It sounds like you want to take the file upload and ensure it gets moved to the media library. I think the function you want is wp_insert_attachment http://codex.wordpress.org/Function_Reference/wp_insert_attachment

    You can run that at the time of gform_after_submission to move the uploaded file to the media gallery.

    Posted 11 years ago on Saturday March 30, 2013 | Permalink
  6. It seems that this should be a pretty obvious functionality of the user registration... if you can have them upload a picture, why not be able to have it be their avatar? Anyone figured this out? I really need this..

    Posted 11 years ago on Wednesday April 3, 2013 | Permalink
  7. Hello Chris,

    Thank you for the pointers. However, I'm not sure how to accomplish the 'moving file into the library folder' task.

    I'm using gform_after_submission filter and when inspecting $entry I can see the URL where the file has been already uploaded, for example: http://example.dev/wp/wp-content/uploads/gravity_forms/GF_related_long_number/2013/04/la-fitness.jpg

    However, I can't figure out how to get all the necessary info abou it for required by the wp_insert_attachment function (array of attachement data, filename).

    Could you please assist me with it: how to get all the data required for an image/file to be uploaded to the media library when using FIle Upload? Is there GF function I can use?

    Many thanks, Dasha

    Posted 11 years ago on Thursday April 4, 2013 | Permalink
  8. Dasha, I would print_r the $entry, in your gform_after_submission function, so you can see how all the data is being stored and what you need to use. Then, you use the WordPress function wp_insert_attachment to attach the image to the post, and move it to the media library at the same time.

    Posted 11 years ago on Thursday April 11, 2013 | Permalink
  9. Hello Chris,

    When print_r the $entry here is what I can see for the file upload field:
    [7] => http://example.dev/wp/wp-content/uploads/gravity_forms/GF_related_long_number/2013/04/la-fitness.jpg

    Where [7] is the ID of the File field in the form. However, there is no additional information about the file (width, heigh and so on) within the $entry. I think that info is only specified for Image field as we know that only images are uploaded and all of them will have that information.

    How do I figure all necessary additional information for File field? I'm a bit lost at the moment.

    Many thanks,
    Dasha

    Posted 11 years ago on Tuesday April 23, 2013 | Permalink