Skip to content

Instantly share code, notes, and snippets.

@max-kk
Created August 22, 2016 09:04
Show Gist options
  • Save max-kk/c826ecf61bf7e9cfce1b56c235011372 to your computer and use it in GitHub Desktop.
Save max-kk/c826ecf61bf7e9cfce1b56c235011372 to your computer and use it in GitHub Desktop.
Add first photo data to upload response array (in wp-foto-vote\public\class-fv-public-ajax.php)
<?php
add_filter('fv/public/upload/response', 'fv_upload_add_photo_data', 11, 1);
function fv_upload_add_photo_data($response) {
if ( !empty($response['inserted_photo_ids'][0]) ) {
$photo0 = ModelCompetitors::query()->findByPK( $response['inserted_photo_ids'][0] );
if ( !empty($photo0) ) {
$response['inserted_photo_datas'][0] = FV_Public::_prepare_contestant_to_js($photo0);
}
}
return $response;
}
FvLib.addHook('fv/upload/ready', function(data){
// data.inserted_photo_datas[0].url - Photo full url
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment