Plugin Author
shauno
(@shauno)
Hi phobic
People have asked about integrating this before. I even contacted the author of NGG Public Uploader and asked if he was interested in making it possible by adding some hooks. Unfortunately, he never responded.
I have looked into the public uploader code before, and without ‘hacking’ it a little, it’s not going to happen.
That being said, writing a custom solution is possible. The structure of the NGG Custom Fields stuff is pretty straight forward if you’re comfortable with that sort of stuff.
Is there anything specific you’re stuck on?
Thread Starter
phobic
(@phobic)
Hi Shauno, thanks for the response – I read this post:
http://wordpress.org/support/topic/plugin-nextgen-custom-fields-use-with-nextgen-public-uploader?replies=13
So I understand it’s not a quick code tweak. I’m actually using the modified Public Uploader file from that thread by ‘simoneast’, and it gets me really close – it adds two fields to the uploader form and sends the information to the ‘description’ field split in two lines. Now I just need to send the information to the two custom fields I created using NGG Custom Fields.
My PHP is weak, but it looks like this line is what posts the information to the description field:
// Combine other fields into description
$_POST['imagedescription'] = $_POST['uploader_name'] . "\r\n" . $_POST['uploader_email'] . ' [' . $_POST['receive_updates'] . ']';
I’m assuming I can just replace the field names with my custom field names? Can it be that simple?
Plugin Author
shauno
(@shauno)
That does seem to save the info into description. But adding custom fields is a little more complicated cause they are completely separate from the NGG core.
An oversimplified version of flow would be:
- Add the image to NGG (I guess this is happening already)
- Get the custom fields’ id from
wp_nggcf_fields
- Insert the
pid
, fid
, and field_value
into wp_nggcf_field_values
(setting ngg_type
to 1 for images
That’s the theory, but I haven’t actually looked at the code in awhile to tell you where to go about it. You obviously will need to be comfortable SELECTING and INSERTING data with the WP DB wrapper.