• Very nice looking plugin. Was wondering if it is possible to adjust the callback setting (success or cancel) to be dynamic instead of hard coded. For example to have the lightbox popup on a link to a post then if they choose to cancel or support then redirect them to the link they originally clicked to?

    I will take a look in the code and see if I can help, but thought I would ask.

    Thanks

    https://www.ads-software.com/plugins/tinycoffee/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Arunas Liuiza

    (@ideag)

    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

    Plugin Author Arunas Liuiza

    (@ideag)

    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.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Callback Settings’ is closed to new replies.