How to add code check user logged

5 years 8 months ago #32274 by lungkao
Am Create imageadv Fields i want add download original file for registered user
// Create imageadv tags (according to configuration parameters) that will be used for the requested 'display' variable
			switch ($prop)
			{
				case 'display_backend':
					$img_legend   = '<img src="'.JURI::root().$srcb.'" alt ="'.$alt.'"'.$legend.' class="'.$class_img_field.'" />';
					$img_nolegend = '<img src="'.JURI::root().$srcb.'" alt ="'.$alt.'" class="'.$class_img_field.'" />';
					break;
				case 'display_small':
					$img_legend   = '<img src="'.JURI::root().$srcs.'" alt ="'.$alt.'"'.$legend.' class="'.$class_img_field.'" />';
					$img_nolegend = '<img src="'.JURI::root().$srcs.'" alt ="'.$alt.'" class="'.$class_img_field.'" />';
					break;
				case 'display_medium':
					$img_legend   = '<img src="'.JURI::root().$srcm.'" alt ="'.$alt.'"'.$legend.' class="'.$class_img_field.'" />';
					$img_nolegend = '<img src="'.JURI::root().$srcm.'" alt ="'.$alt.'" class="'.$class_img_field.'" />';
					break;
				case 'display_large':
					$img_legend   = '<img src="'.JURI::root().$srcl.'" alt ="'.$alt.'"'.$legend.' class="'.$class_img_field.'" />';
					$img_nolegend = '<img src="'.JURI::root().$srcl.'" alt ="'.$alt.'" class="'.$class_img_field.'" />';
					break;
				case 'display': default:
					$_src = $isItemsManager ? $srcb : $src;
					$img_legend   = '<img src="'.JURI::root().$_src.'" alt ="'.$alt.'"'.$legend.' class="'.$class_img_field.'" /><div class="img_download"><a href="'.JURI::root().$srcorg.'"  target="_blank">
Download
					</div>';
					$img_nolegend = '<img src="'.JURI::root().$_src.'" alt ="'.$alt.'" class="'.$class_img_field.'" /><div class="img_download"><a href="'.JURI::root().$srcorg.'" id="img_download"  target="_blank">
Download
					</div>';
					break;
			}


am add
<div class="img_download"><a href="'.JURI::root().$srcorg.'" id="img_download"  target="_blank">
Download
					</div>

i want add code check user logged in

| [url=http://joomlachannel.com:3qv9ynub]สอบถามปัญหา joomla[/url] | [url=http://www.colorpack.co.th:3qv9ynub]รับทำเว็บ joomla[/url]

Please Log in or Create an account to join the conversation.

5 years 8 months ago #32277 by ggppdk
Hello,
this is a common asked joomla question, you can use either of these:
$user = &JFactory::getUser();

$is_logged = ! $user->guest;
$is_logged = (boolean) $user->id;


-- FLEXIcontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!

Please Log in or Create an account to join the conversation.

5 years 8 months ago #32278 by lungkao
Thank you :D post test who online end of year ;)

| [url=http://joomlachannel.com:3qv9ynub]สอบถามปัญหา joomla[/url] | [url=http://www.colorpack.co.th:3qv9ynub]รับทำเว็บ joomla[/url]

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
© 2018 Flexicontent. All Rights Reserved.