[wp-hackers] Allow users to upload their own images - hook to use?

Jacob Snyder jacobsnyder at gmail.com
Wed Sep 11 23:24:03 UTC 2013


You could use Advanced Custom Fields, a free plugin, to create a form that
collects the user data and image as custom fields for the user. You don't
have to create a post or anything. They will be stored right to the user
and can be retrieved by using this method:

get_field('met_key', 'user_' . $user_id);

Extremely simple... and a very well established plugin.

Of course if you already have a form, try using wp_insert_post to create a
post, set the user as the author or save the generated post_id into the
user's meta:

$post_id = wp_insert_post()
update_user_meta($user_id, 'user_info', $post_id);

And then you can retrieve it through one of those methods.


More information about the wp-hackers mailing list