trying to use $current_user->user_name in an iframe. cannot figure how to make extra variables available for a module iframe.
I’m trying to put the logged-in user name in the url for an iframe in a detail view for Contacts. Absolutely no luck yet.
One work-around is to put the whole iframe tag in custom/modules/Contacts/metadata/detailviewdefs.php as customCode
I added an iframe using studio, then I edit detailviewdefs.php. I find the name of my iframe (‘quotes_c’ in this case) and add the customCode line. the {$fields.recid_c.value} brings in a variable available to the module. The ‘.$current_user->user_name.’ is the variable I cannot access directly from studio.
like this:
array (
'name' => 'quotes_c',
'customCode' => '<iframe src="http://digitaldeltec/designer/projectlist.php?&recid={$fields.recid_c.value}&goldmineid='.$current_user->user_name.' " style="height:500px; width:100%;"></iframe>',
'label' => 'LBL_QUOTES',
),
Problem with this is, using studio will rewrite this file and delete the ‘.$current_user->user_name.’ portion or replace it with the value hardcoded into the url.
Any eye-openers would be helpful. thanks