1

I'm developing a plugin where users need to be able to upload an image (a payment receipt) to a custom user field. At the time, I'm using a code I found here Extra User Profile Field Upload File / Image and it is working. The problem is I don't want WP Media to show a lot of things, I just want the user to be able to upload a single image without seeing private site information or media and without being able to create something like a gallery.

Please, answer if you have any idea about how doing it. Thank you!

1 Answer 1

0

You can use ACF to do this.

  1. Set up your custom field for the user profile.
  2. Use the acf_form() to produce a form containing the field on your front end for the user to interact with.
  3. Customise your acf_form() arguments to use a "simple" uploader (this will not expose WP Media Library to users then)

Example:

$field_arguments = array(
  'post_id' => 'user_'.$current_user->ID,
  'field_groups' => array(111), // Replace with ACF Group you created
  'form' => true,
  'uploader' => 'basic', // This is what hides the WP Media Library to the user
  'submit_value'    => 'Submit'
);
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.