Pushing Session information into an add_filter and add_shortcode block

I asking this question for a second time. Sorry. The first solution did not work. It resulted in a code error of Notice: Undefined variable: wp_session in /***/shopping-with.php on line 33,

and that post seems to have fallen into an abyss, as I can’t get anyone to continue the conversation. So I am starting a new one here.

I need to get the information from a session to pass into an add_filter (for gravity forms) and add_shortcode (self explanatory) block.

My attempts are not working, and a suggestion has also failed.

I can echo my values before and after any add_filter or add_shortcode blocks, but I can’t get those values to parse the blocks.

The suggestion was the inclusion of a function – then call the function. This is shown below, and this did not work.

$wp_session = WP_Session::get_instance();

if ($wp_session['socialbug_name'] != null && strlen($wp_session['socialbug_name']) > 0)
<div style="text-align:center; font-weight: normal;">
<b>Shopping With:</b> <?php echo $wp_session['socialbug_name']; ?> |
<b>City:</b> <?php echo $wp_session['socialbug_city']; ?> |
<b>Phone:</b> <?php echo $wp_session['socialbug_phone']; ?> |
<b>Email:</b> <?php echo $wp_session['socialbug_email']; ?>

add_filter('gform_field_value_consultant_gform', 'fn_get_consultant_webemail');
function fn_get_consultant_webemail($value){
// $bizemail = $gformxml->Email;
// return $bizemail;
$gfxml = get_the_gformxml();
if( !empty( $gfxml ) ){
$bizemail = $gformxml->Email;
return $bizemail;

return '';

function get_the_gformxml(){
$gformxml = "";
if ( $wp_session['socialbug_name'] != null
&& strlen($wp_session['socialbug_name']) > 0 ){
$gformid = $wp_session['socialbug_affiliate_id'];
$context = stream_context_create(array('http' => array('header' => 'Accept: application/xml')));
$url = 'http://***/AffiliateId=' . $gformid;
$gformxml = file_get_contents($url, false, $context);
$gformxml = simplexml_load_string($gformxml);
return $gformxml;


I am under a wicked crunch time line here as this system is suppose to launch Saturday night, and can not launch if I can’t get the session information (specifically the email address) to dynamically populate into the Gravity form.

Many thanks for any assistance you can offer.