How to add code check user logged

More
11 years 3 months ago #32274 by lungkao
Am Create imageadv Fields i want add download original file for registered user
Code:
// 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
Code:
<div class="img_download"><a href="'.JURI::root().$srcorg.'" id="img_download" target="_blank"> Download </div>

i want add code check user logged in

| สอบถามปัญหา joomla | รับทำเว็บ joomla

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

More
11 years 3 months ago #32277 by ggppdk
Hello,
this is a common asked joomla question, you can use either of these:
Code:
$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...

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

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

| สอบถามปัญหา joomla | รับทำเว็บ joomla

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

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.473 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline