,

Yoast Gravity Referer Gravity Forms 1.7.0 Update

After Gravity Forms 1.7.0 version, Notifications were overhauled , so now there are an array of notifications instead of just a single one. To access the notification in the form object you need to use the notification id as the key to the notifications array. The new documentation is here.

We must update the Yoast’s Gravity Referer plugin’s  gf_yst_store_referer function as below.

function gf_yst_store_referrer($notification, $form, $entry) {
	$referrerinfo = '';
	$keywords = array();
	$i = 1;
	foreach ($_SESSION['gf_yst_referer'] as $referer) {
		$referrerinfo .= str_pad("Referer $i: ",20) . $referer. "\r\n";
		$keywords_used = gf_yst_get_query($referer);
		if ($keywords_used) {
			$keywords[] = $keywords_used;
		}
		$i++;
	}
	$referrerinfo .= "\r\n";
	
	$i = 1;
	foreach ($_SESSION['gf_yst_pages'] as $page) {
		$referrerinfo .= str_pad("Page visited $i: ",20) . $page. "\r\n";
		$i++;
	}
	$referrerinfo .= "\r\n";
	
	$i = 1;
	if (count($keywords) > 0) {
		foreach ($keywords as $keyword) {
			$referrerinfo .= str_pad("Keyword $i: ",20) . $keyword. "\r\n";
			$i++;
		}
	}
	$referrerinfo .= "\r\n";
	
	if (isset($notification['message'])) {
		$notification['message'] .= "\r\nReferrer Info:\r\n".$referrerinfo;
	}
	
	return $notification;
}
add_filter('gform_notification', 'gf_yst_store_referrer', 10, 3);

 

You can download the modified plugin here.

Comments

“Yoast Gravity Referer Gravity Forms 1.7.0 Update” için bir yanıt

  1. […] my situation, I need to add Yoast Gravity Referer session data to my website. So I have added below session values at the top of […]

Bir yanıt yazın

E-posta adresiniz yayınlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir