[SOLVED]Is there a way to print email address in my account

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
userwords
Forum Members
Forum Members
Posts: 48
Joined: Mon Dec 27, 2010 12:27 am

[SOLVED]Is there a way to print email address in my account

Post by userwords »

Ive looked docs, and the nearest is the mailto tag, thats for saving the mailto sintax around a mail address. Or sitename tag, which is the same but for the site name. But is there a tag that you could put into the template and will print the email address you have in my account site preferences.

Or maybe some php snippet you could put in a user defined tag to get the same output.

Ive even read through data base and cmsms files, and found where does this come and where is it stored. But not being a programmer myself i did not guess either how to do it, nor if it would be a good idea at all cause could make for a stupid way of increasing requests and resources on each page load or something.
Last edited by userwords on Tue Oct 29, 2013 6:15 am, edited 1 time in total.
uniqu3

Re: Is there a tag or a way to print email address in my acc

Post by uniqu3 »

No there isn't.

The UDT (name it for example get_user_email):

Code: Select all

$db = cmsms()->GetDb();
 
$user_name = isset($params['username']) ? $params['username'] : null;
$db_identifier = is_numeric($user_name) ? 'user_id' : 'username';
 
$query = "SELECT email FROM " . cms_db_prefix() . "users WHERE $db_identifier = ?";
$row = $db->GetRow($query, array($user_name));
 
if($row)
   $result = $row['email'];

if(!isset($result))
   $result = 'Username: ' . $user_name . ' doesn\'t exist';

if(isset($params['assign'])){
    $smarty->assign(trim($params['assign']), $result);
} else {
    return $result;
}
Usage:

Code: Select all

{get_user_email username='username_or_id_of_backend_user_to_get_info_from' assign='is_user_email'}
{if !empty($is_user_email)}
  Editor Email: {$is_user_email}
{/if}
userwords
Forum Members
Forum Members
Posts: 48
Joined: Mon Dec 27, 2010 12:27 am

Re: Is there a tag or a way to print email address in my acc

Post by userwords »

Another way to improve cmsms usage. Very detailed explanation.
Post Reply

Return to “CMSMS Core”