arpReach has a limited number of dynamic tags.
The custom dynamic tag feature in #V2 allows you to create your own dynamic tags to use in messages. For example, the Date Tags with a plus (+) or minus (-) modifiers work due to the custom dynamic tags capability.
A #V2 installation has the file user_dynamic_tags.php in its /user_functions folder. You can add your own dynamic tags functions there.
The function names should begin with the prefix “dynamic_” to allow the system to detect them.
When #V2 processes a message and detects an unknown tag, it checks if a function with the name “dynamic_<tag>” exists. If yes, it runs this function with the $contact-object and the default tag-value and uses the result as the Tag value.
Important note: Your code must be designed to handle $contact being NULL and $default being an empty string.
Predefined Custom Dynamic Tags
{URLENCODE <value>} - encodes the value to use it in links. For example:<a href="http://mysite.com/hello/?name={URLENCODE {FULL_NAME}}&company={URLENCODE {COMPANY}}">hello</a> function dynamic_URLENCODE( $contact = NULL, $default = '' ) { return rawurlencode($default); }
{HTML_TO_TEXT} - converts an HTML-marked content into TEXT (plain text). You can use this for variables with HTML content to place them in plain-text part of your messages. For example:{HTML_TO_TEXT {VARIABLE_MY_HTML_CONTENT}} function dynamic_HTML_TO_TEXT( $contact = NULL, $default = '' ) { return convert_html_to_text($default); }
{GRAVATAR_HASH} - allows you personalize messages with an avatar of your contact by using this image HTML code in your HTML messages:<img src="https://www.gravatar.com/avatar/{GRAVATAR_HASH}.jpg" /> By default, images are presented at 80px by 80px if no size parameter is supplied. You may request a specific image size, which will be dynamically delivered from Gravatar by using the s= or size= parameter and passing a single pixel dimension (since the images are square): <img src="https://www.gravatar.com/avatar/{GRAVATAR_HASH}.jpg?size=200" /> You may request images anywhere from 1px up to 2048px. Read more at: https://gravatar.com/site/implement/images function dynamic_GRAVATAR_HASH( $contact = NULL, $default = '' ) { return md5(strtolower(empty($contact->email_address)? '': $contact->email_address)); }
{FULLNAME} - may compose full name from other parts of a name. Note that the {FULL_NAME} tag (with an underscore) is a different tag.function dynamic_FULLNAME( $contact = NULL, $default = '' ) { if ( empty($contact) ) return $default; if ( empty($contact->full_name) ) { $contact->full_name = trim( implode(' ', array_filter(array( $contact->first_name, $contact->middle_name, $contact->last_name )))); } return empty($contact->full_name)? $default: $contact->full_name; }
{DATE_X <offset parameter>} - for date offsetting.Offset by days {DATE_1 +1} {DATE_1 -3} {DATE_1 +1 day} {DATE_1 -3 days} Offset by weeks {DATE_1 +1 week} {DATE_1 -3 weeks} Offset in mixed format {DATE_1 +1 year 2 months 1 week 5 days} function dynamic_DATE_1( $contact = NULL, $default = '' ) { return _dynamic_FORMATED_DATE('date_format_1', $default); } function dynamic_SHORTDATE($contact = NULL, $default = '' ) { return _dynamic_FORMATED_DATE('date_format_1', $default); } function dynamic_DATE_2( $contact = NULL, $default = '' ) { return _dynamic_FORMATED_DATE('date_format_2', $default); } function dynamic_LONGDATE( $contact = NULL, $default = '' ) { return _dynamic_FORMATED_DATE('date_format_2', $default); } function dynamic_DATE_3( $contact = NULL, $default = '' ) { return _dynamic_FORMATED_DATE('date_format_3', $default); } function dynamic_USDATE( $contact = NULL, $default = '' ) { return _dynamic_FORMATED_DATE('date_format_3', $default); } function dynamic_DATE_4( $contact = NULL, $default = '' ) { return _dynamic_FORMATED_DATE('date_format_4', $default); } function dynamic_USLONGDATE( $contact = NULL, $default = '' ) { return _dynamic_FORMATED_DATE('date_format_4', $default); } function dynamic_DATE_5( $contact = NULL, $default = '' ) { return _dynamic_FORMATED_DATE('date_format_5', $default); } function dynamic_USLONGDATENOYEAR( $contact = NULL, $default = '' ) { return _dynamic_FORMATED_DATE('date_format_5', $default); } function dynamic_DATE_6( $contact = NULL, $default = '' ) { return _dynamic_FORMATED_DATE('date_format_6', $default); } function dynamic_EUROPEANDATE( $contact = NULL, $default = '' ) { return _dynamic_FORMATED_DATE('date_format_6', $default); } function dynamic_DATE_7( $contact = NULL, $default = '' ) { return _dynamic_FORMATED_DATE('date_format_7', $default); } function dynamic_WEEKDAY( $contact = NULL, $default = '' ) { return _dynamic_FORMATED_DATE('date_format_7', $default); } function dynamic_DATE_8( $contact = NULL, $default = '' ) { return _dynamic_FORMATED_DATE('date_format_8', $default); } function _dynamic_FORMATED_DATE($date_format = '', $default = '') { $CI =& get_instance(); $default = preg_replace('/^([+-]\s*[\d]+)$/', '$1 days', trim($default)); return app_date_offset( $CI->system_settings->{$date_format}, empty($default)? '': strtotime($default) ); }