Hi,
Since 0.2.0 (latest) version, I introduced a tinycoffee_options
filter. It is not yet documented, but it allows to modify pretty much every possible option, callbacks included. Also, all the options can be overwritten in shortcode mode, via arguments.
Arūnas.
Thread Starter
LGRIS
(@lgris)
Thanks for the quick reply. If we were using the shortcode it would be easy to modify. Using the modal view how would I go about changing those callbacks dynamically from the blog listing page for example where the read more links are the triggers to turn on the modal then on cancel or success forward the person to the link they clicked.
I have not had a chance to look at the filter you mentioned yet but will.
Thanks
Lee
Hi again,
As the example of filter usage, the script will always set callback urls to the current link.
add_filter( 'tinycoffee_options', 'arunas_filter_callbacks' ) ;
function arunas_filter_callbacks( $options ) {
// get the current url
global $wp;
$current_url = home_url(add_query_arg(array(),$wp->request));
// modify tinycoffee options array
$options['callback_success'] = $current_url;
$options['callback_cancel'] = $current_url;
// return modified options array
return $options;
}
As for Your scenario, I think you should use JavaScript to trigger the modal, and you could modify the form fields at the same time, again, using JavaScript:
jQuery( function($){
$('.more-link').click(function(e){
// modify form fields
var url = $(this).attr('href');
$('#modal-container input[name=return]').val(url);
$('#modal-container input[name=cancel_return]').val(url);
// open tinyCoffee modal
openCoffee();
});
});
Note – the above code snippets are concept only, I haven’t actually tried them. There might be typos, etc. but they illustrate the general idea.