I have this code in the older version of 4.17 and it works great
{if $auth.user_id}
{assign var=“user_data” value=$auth.user_id|fn_get_user_info}
{$lang.sub_balance}
You have $ {$user_data.fields.36}, left of the current footwear subsidy
{/if}
{if $auth.user_id}
{assign var=“user_data” value=$auth.user_id|fn_get_user_info}
{$lang.subsidy}
Your Next Subsidy Renewal Date is {$user_data.fields.46},
{/if}
but when I updated to 4.19 none of this code works
I get error so I dug around and can get the profile field firstname to populate in the smarty block with Welcome {$user_info.firstname}
but I’m lost on how to get the custom profile fields to work in this new version I’ve tried {$user_data.fields.36}, {$user_info.fields.36} and a few others but nothing will bring the field data to the block.
Any one have any clue how it works in the newest version??
I’m glad I had a roll back plan in place!! but I would like to update to the newest version.before the cancel the php and roll it out to 8.1
What kind of error do you receive? Most likely you should enable the fn_get_user_info php function in the following schema
app/schemas/block_manager/smarty_allowed_functions.php
The error was string error
with the user_info.fields.36 just shows a blank spot where the data should be
in the smart_allowed do I turn them all to false?
return [
‘__’ => true,
‘fn_url’ => true,
‘count’ => true,
‘default’ => true,
‘defined’ => true,
‘floatval’ => true,
‘doubleval’ => true,
‘trim’ => true,
‘ltrim’ => true,
‘rtrim’ => true,
‘json_encode’ => true,
‘json_decode’ => true,
‘uniqid’ => true,
‘strtotime’ => true,
‘format_price’ => true,
‘strip_tags’ => true,
‘fn_allowed_for’ => true,
‘crc32’ => true,
‘md5’ => true,
‘fn_query_remove’ => true,
‘replace’ => true,
‘abs’ => true,
‘strlen’ => true,
‘round’ => true,
‘fn_strlen’ => true,
‘fn_link_attach’ => true,
‘join’ => true,
‘implode’ => true,
‘truncate’ => true,
‘serialize’ => true,
‘constant’ => true,
‘in_array’ => true,
‘nl2br’ => true,
];
Thanks found the issue my_changes/controllers/frontend/init.post.php
<?php
use Tygh\Registry;
if (!defined('BOOTSTRAP')) { die('Access denied'); }
$user_data = [];
if(!empty(Tygh::$app['session']['auth']['user_id'])){
$user_data = fn_get_user_info(Tygh::$app['session']['auth']['user_id']);
}
Tygh::$app['view']->assign('user_data', $user_data);
This solved the issue now the data shows in the smarty boxes on the front end of the customer
2 Likes