[wp-hackers] Using Media Library "selector" on user-edit page

Robert Lusby nanogwp at gmail.com
Fri May 11 12:20:34 UTC 2012


I've added a custom field text input to my user edit pages in the admin 
area, for an image.

At present the process is upload image to media library, get url, go to 
user edit, copy+paste URL into the correct text input.

I want to speed this up by opening the Media Library "selector", like 
you can in custom post types. I've used a common bit of code found while 
Googling for doing this, the Media Library selector opens, however 
throws the following error:

*Notice*: Undefined index: post_id in 
*C:\wamp\www\sprkle-com\trunk\httpdocs\wp-admin\includes\media.php* on 
line *1481
*
Obviously I suspect this is because I'm calling the Media Library 
selector from the user edit screen, rather than a post screen, but is 
there a way around this?

What's the correct way of opening the Media Library selcetor from the 
user edit screen?

Screenshot:
http://i.imgur.com/uXULB.gif

Code used:
http://pastebin.com/6evLRMEa

Thanks,
Rob.


More information about the wp-hackers mailing list