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

Lionel POINTET lionel.pointet at globalis-ms.com
Fri May 11 12:35:13 UTC 2012


Hi Rob,

I think you could simply send an empty post_id to the media-upload script :
tb_show('', 'media-upload.php?type=image&TB_iframe=true*&post_id*');
The warning won't show and you'll still get the functionality.

But maybe is there a better way to call this window, I can't tell.

Lionel

2012/5/11 Robert Lusby <nanogwp at gmail.com>

> 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.
> ______________________________**_________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.**com <wp-hackers at lists.automattic.com>
> http://lists.automattic.com/**mailman/listinfo/wp-hackers<http://lists.automattic.com/mailman/listinfo/wp-hackers>
>


More information about the wp-hackers mailing list