Plugin Directory

Changeset 1504333


Ignore:
Timestamp:
09/28/2016 09:13:32 AM (10 years ago)
Author:
thebluecube
Message:

Adding a shortcode to have advanced conditional logic in email notifications.

Location:
bluecube-mighty-gravity-forms
Files:
5 added
3 edited

Legend:

Unmodified
Added
Removed
  • bluecube-mighty-gravity-forms/trunk/bluecube-mighty-gravityforms.php

    r1487459 r1504333  
    66 * Description: This plugin adds some advanced features to Gravity Forms e.g. custom validation rules etc.
    77 * Author: Blue Cube Communications Ltd
    8  * Version: 1.0.1
     8 * Version: 1.1
    99 * Author URI: https://thebluecube.com
    1010 * License: GPLv2 or later
     
    1717
    1818$bc_mighty_gravityforms = new BlueCube\Mighty_Gravity_Forms();
    19 
  • bluecube-mighty-gravity-forms/trunk/class/Mighty_Gravity_Forms.php

    r1487459 r1504333  
    3939
    4040        add_filter('gform_field_input', [$this, 'addFrontEndNumberRangeChange'], 10, 5);
     41
     42          // Adding a shortcode to have advanced conditional logic in email notifications
     43          add_shortcode('gf_notification_conditional_block', [$this, 'notificationConditionalBlockShortcode']);
    4144    }
    4245
     
    840843        return ''; // We did not want to return any html
    841844    }
     845
     846     /**
     847     * A function to process the `gf_notification_conditional_block` shortcode.
     848     * This shortcode helps adding a conditional block of content to email notifications.
     849     * The shortcode should have an attribute called `function`.
     850     * The `function` attribute is the name of the callback that would determine whether
     851     * the block should be shown on the email or not.
     852     * Please note that all the attributes of the shortcode are passed to the callback
     853     * as an associative array.
     854     *
     855     * @param            $atts
     856     * @param  string    $content
     857     * @return string
     858     */
     859    public function notificationConditionalBlockShortcode($atts, $content = '')
     860    {
     861        // If no content is defined, we do not proceed with the process
     862        if ($content == '' || ! isset($atts['function']) || ! function_exists($atts['function']))
     863            return '';
     864
     865        return (call_user_func($atts['function'], $atts)) ? $content : '';
     866    }
    842867}
  • bluecube-mighty-gravity-forms/trunk/readme.txt

    r1487817 r1504333  
    44Tags: form, forms, form validation, gravity forms, add-on, extension
    55Requires at least: 4.6
    6 Tested up to: 4.6
    7 Stable tag: 1.0.1
     6Tested up to: 4.6.1
     7Stable tag: 1.1
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
    1010
    11 This plugin adds some additional features to the Gravity Forms plugin: Advanced input validations, Input ID change, Form access control
     11This plugin adds some additional features to the Gravity Forms plugin: Advanced input validations, Input ID change, Form access control, Advanced conditional logic for email notifications
    1212
    1313== Description ==
     
    1818* Advanced input validations
    1919* Form access control
     20* Advanced conditional logic shortcode to be used in email notifications
    2021
    2122Documentation: https://thebluecube.com/wordpress-plugins/bluecube-mighty-gravity-forms/documentation/
     
    3435== Changelog ==
    3536
     37= 1.1 =
     38* Adding advanced conditional logic shortcode to be used in email notifications
     39
    3640= 1.0.1 =
    3741* Passing an array of additional arguments to the custom validation rule function
Note: See TracChangeset for help on using the changeset viewer.