{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang3081{\fonttbl{\f0\fnil\fcharset0 Calibri;}}
{\colortbl ;\red0\green0\blue255;\red255\green0\blue0;}
{\*\generator Riched20 10.0.17134}\viewkind4\uc1
\pard\sa200\sl276\slmult1\f0\fs32\lang9 Adding full name to Welcome message\par
{{\field{\*\fldinst{HYPERLINK https://www.boonex.com/forums/topic/How-to-get-Full-Name-of-logged-in-user-.htm }}{\fldrslt{https://www.boonex.com/forums/topic/How-to-get-Full-Name-of-logged-in-user-.htm\ul0\cf0}}}}\f0\fs32\par
\par
\b To solve, add a new function in inc\\profiles.inc.php\par
Look for the getUserName function at about line 443. And add this new function right after it.\par
\pard\sl240\slmult1\b0 function getFullName( $ID = '' )\par
\{\par
if ( !$ID && !empty($_COOKIE['memberID']) )\par
$ID = (int)$_COOKIE['memberID'];\par
\par
if ( !$ID )\par
return '';\par
\par
$aProfile = getProfileInfo($ID);\par
if (!$aProfile)\par
return false;\par
\par
return $aProfile['FullName'];\par
\}\par
\par
-------------------------------------------\par
\b Then make welcome message\par
\par
\b0 To create the welcome message you need to create a PHP block. This is done by running the following line in your browser address bar:\b\par
\par
{{\field{\*\fldinst{HYPERLINK http://www.mysitename.com/administration/pageBuilder.php?action_sys=addCodeBlock }}{\fldrslt{http://www.mysitename.com/administration/pageBuilder.php?action_sys=addCodeBlock\ul0\cf0}}}}\f0\fs32\par
\par
\b0 Go to Page Builder/home/page and place a PHP block where it suits you. Now add the following code and save.\b\par
\par
\b0 date_default_timezone_set('\cf2 Australia,Brisbane\cf0 ');\par
$Hour = date('G');\par
\par
$memID = $_COOKIE['memberID'];\par
\par
$full = getFullName($memID);\par
\par
if ( $Hour >= 0 && $Hour < 12 ) \{\par
\par
echo "Good Morning ".$full." ";\par
\par
\} else if ( $Hour >= 12 && $Hour < 17 ) \{\par
\par
echo "Good Aftrenoon ".$full." ";\par
\par
\} else if ( $Hour >= 17 && $Hour < 24 ) \{\par
\par
echo "Good Evening ".$full." ";\par
\par
\}\par
\b\par
\cf2 Change timezone to suit your country.\cf0\par
\par
\i Note: you can also add the inc file code to the welcome message instead of changing the inc file. Just include the code in red or leave it off if you have already changed the inc file.\b0\par
\i0\par
\cf2 function getFullName( $ID = '' )\par
\{\par
if ( !$ID && !empty($_COOKIE['memberID']) )\par
$ID = (int)$_COOKIE['memberID'];\par
\par
if ( !$ID )\par
return '';\par
\par
$aProfile = getProfileInfo($ID);\par
if (!$aProfile)\par
return false;\par
\par
return $aProfile['FullName'];\par
\}\par
\cf0\par
date_default_timezone_set('Australia,Brisbane');\par
$Hour = date('G');\par
\par
$memID = $_COOKIE['memberID'];\par
\par
$full = getFullName($memID);\par
\par
if ( $Hour >= 0 && $Hour < 12 ) \{\par
\par
echo "Good Morning ".$full." ";\par
\par
\} else if ( $Hour >= 12 && $Hour < 17 ) \{\par
\par
echo "Good Aftrenoon ".$full." ";\par
\par
\} else if ( $Hour >= 17 && $Hour < 24 ) \{\par
\par
echo "Good Evening ".$full." ";\par
\par
\}\par
\par
\par
}