The following will only work if you’re uploading one image at a time, but the idea here is that on return of the exp:gallery_extended:form tag that you can have the entry_id of that photo in order to ensure that on the returned page where you might have an SAEF it’s definitely the user’s uploaded image and not just the most recent one.
Swap out everything starting on line 1050 of mod.gallery_extended.php and ending where the comment says //end insert
// -------------------------------------------
// Get out
// -------------------------------------------
if ($IN->GBL('override_resize', 'POST') == 'yes' );
if ( stristr( $return, "http" ) )
{
$FNS->redirect( $return );
}
elseif ( stristr ( $return, "n;try%" ) ) // This is where wondermonkey takes over to try to send back an entry_id
{
$query = $DB->query( "SELECT entry_id FROM exp_gallery_entries WHERE entry_date = '".$fields['entry_date']."' AND author_id = '".$SESS->userdata('member_id')."'" ); //try to find the entry that the module just created.
if (! $query->num_rows == 0 )
{
$return = str_replace('n;try%',$query->row['entry_id'],$return); //Now grab and swap the n;try% from the return URL with the entry_id we just garnered. Boom. Better than an extension.
}
$FNS->redirect( $FNS->create_url( $return ) );
}
else
{
$FNS->redirect( $FNS->create_url( $return ) );
}
exit;
}
// End insert
In order to use this, you’ll need to add n;try% after your templategroup/template to the return parameter of your gallery_extended:form tag, such as:
{exp:gallery_extended:entry_form gallery_name="my_g_name" redirect="{path=upload/entry}" form_id="uploadForm" type="weblog" return="/upload/entry/n;try%" onsubmit = "[removed] void(0);" override_resize = "yes"}
Hope this makes it into the next version Mitchell!
