What is the code to see element by author

5 years 11 months ago #1 by eastkilla
Hi,

Your plugin is very nice, thanks.
It works very well in joomla article with the {f90filter TOKEN ACTION} Content {/f90filter}

I'm using K2 Profile, and I have customize user's page in user.php file. I add some new links, and I want that those links are displayed only for each user.
Your code dont work if I paste it directly in user.php file. I would like to know what is the code behind author Token that I can use to do that ?

Thanks for help.
5 years 11 months ago #2 by Function90
Sorry for delay in reply. Content filter plugin only works of "onContentPrepare" plugin.
If you are using php code, then you can directly check the user group of logged in user and do the required things.
Let me know if you need anything else.

Thank you
Team Function90
You can share your views regarding our extension at JED ( extensions.joomla.org/profile/profile/details/225115#extensions )

Hire Professional Joomla Developers. ( www.function90.com/contact-us.html )
5 years 11 months ago #3 by eastkilla
I have created some new links in user's profile. But those links are visible by all registred users. I would like they are visible only by the logged user in his profile not others.
5 years 11 months ago #4 by Function90
Hello,

If you can change the php code then no need to use content filter.
in the php file you can use below code
$currentUserid = JFactory::getApplication()->input->get('id',0,'INT');
$loggedinuser = JFactory::getUser()->id;
if(!$loggedinuser){
   // user is not logged in
}
elseif($loggedinuser == $currentUserid){
   // same user is logged in and viewing his own profile
}
else{
   // logged in  user is different from profile owner
}

Thank you
Team Function90
You can share your views regarding our extension at JED ( extensions.joomla.org/profile/profile/details/225115#extensions )

Hire Professional Joomla Developers. ( www.function90.com/contact-us.html )
5 years 11 months ago #5 by eastkilla
Hi, thanks for your answer

I'm not very familiar with php.

For exemple I would like to add this in K2 user.php file.
<div class="nav-user">
		<ul  class="nav nav-pills">
			<li><a href="index.php?option=com_kunena&view=user&Itemid=185">My forum profile</a></li>
		
			<li><a href="index.php/forum/mesrecents">My Forum Subjects</a></li>
		
			<li><a href="index.php?option=com_komento&view=profile">My comments</a></li>
		</ul>
	</div>
How can I add you code that every user see it on his own profile ?

Thanks a lot

best regards
5 years 11 months ago - 5 years 11 months ago #6 by Function90
Try below code.
$currentUserid = JFactory::getApplication()->input->get('id',0,'INT');
$loggedinuser = JFactory::getUser()->id;
if(!$loggedinuser){
   // user is not logged in
}
elseif($loggedinuser == $currentUserid){
   // same user is logged in and viewing his own profile
   <div class="nav-user">
		<ul  class="nav nav-pills">
			<li><a href="index.php?option=com_kunena&view=user&Itemid=185">My forum profile</a></li>
		
			<li><a href="index.php/forum/mesrecents">My Forum Subjects</a></li>
		
			<li><a href="index.php?option=com_komento&view=profile">My comments</a></li>
		</ul>
	</div>
}
else{
   // logged in  user is different from profile owner
}

Thank you
Team Function90
You can share your views regarding our extension at JED ( extensions.joomla.org/profile/profile/details/225115#extensions )

Hire Professional Joomla Developers. ( www.function90.com/contact-us.html )
5 years 11 months ago - 5 years 11 months ago #7 by eastkilla
Hi,

Thanks a lot for the time you take to give me a solution. But I'm not very familiar with php, I don't know where to paste the code.

This is my user.php file :
<?php
/**
 * @version		$Id: user.php 1812 2013-01-14 18:45:06Z lefteris.kavadas $
 * @package		K2
 * @author		JoomlaWorks http://www.joomlaworks.net
 * @copyright	Copyright (c) 2006 - 2013 JoomlaWorks Ltd. All rights reserved.
 * @license		GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
 */

// no direct access
defined('_JEXEC') or die;

// Get user stuff (do not change)
$user = JFactory::getUser();

?>

<!-- Start K2 User Layout -->

<div id="k2Container" class="userView<?php if($this->params->get('pageclass_sfx')) echo ' '.$this->params->get('pageclass_sfx'); ?>">

	<?php if($this->params->get('userFeedIcon',1)): ?>
	<!-- RSS feed icon -->
	<div class="k2FeedIcon">
		<a href="<?php echo $this->feed; ?>" title="<?php echo JText::_('K2_SUBSCRIBE_TO_THIS_RSS_FEED'); ?>">
			<span><?php echo JText::_('K2_SUBSCRIBE_TO_THIS_RSS_FEED'); ?></span>
		</a>
		<div class="clr"></div>
	</div>
	<?php endif; ?>

	<?php if ($this->params->get('userImage') || $this->params->get('userName') || $this->params->get('userDescription') || $this->params->get('userURL') || $this->params->get('userEmail')): ?>
	<div class="userBlock">
	
		<?php if(isset($this->addLink) && JRequest::getInt('id')==$user->id): ?>
		<!-- Item add link -->
		<span class="userItemAddLink">
			<a class="modal" rel="{handler:'iframe',size:{x:990,y:550}}" href="<?php echo $this->addLink; ?>">
				<?php echo JText::_('K2_POST_A_NEW_ITEM'); ?>
			</a>
		</span>
		<?php endif; ?>
	
		<?php if ($this->params->get('userImage') && !empty($this->user->avatar)): ?>
		<img src="<?php echo $this->user->avatar; ?>" alt="<?php echo $this->user->name; ?>" style="width:<?php echo $this->params->get('userImageWidth'); ?>px; height:auto;" />
		<?php endif; ?>
		
	<div class="name-user">	
		<?php if ($this->params->get('userName')): ?>
		<h2><?php echo $this->user->name; ?></h2>
		
		<?php if(!JFactory::getUser()->guest): ?><div class="modif"><a href="index.php/component/users/profile?layout=edit"><i class="icon-edit"></i> Modifier mon Profil</a></div><?php endif; ?>
		<?php endif; ?>
		
	</div>

	[b]<div class="nav-user">
		<ul  class="nav nav-pills">
		<?php if(!JFactory::getUser()->guest): ?>
			<li><a href="index.php?option=com_kunena&view=user&Itemid=185">Mon Profil Forum</a></li>
		<?php endif; ?>
		
		<?php if(!JFactory::getUser()->guest): ?>
			<li><a href="index.php/forum/mesrecents">Mes Sujets Forum</a></li>
		<?php endif; ?>
		
		<?php if(!JFactory::getUser()->guest): ?>
			<li><a href="index.php?option=com_komento&view=profile">Mes Commentaires</a></li>
		<?php endif; ?>
		</ul>
	</div>[/b]
		
		<?php if ($this->params->get('userDescription') && trim($this->user->profile->description)): ?>
		<div class="userDescription"><?php echo $this->user->profile->description; ?></div>
		<?php endif; ?>
		
		<?php if (($this->params->get('userURL') && isset($this->user->profile->url) && $this->user->profile->url) || $this->params->get('userEmail')): ?>
		<div class="userAdditionalInfo">
			<?php if ($this->params->get('userURL') && isset($this->user->profile->url) && $this->user->profile->url): ?>
			<span class="userURL">
				<?php echo JText::_('K2_WEBSITE_URL'); ?>: <a href="<?php echo $this->user->profile->url; ?>" target="_blank" rel="me"><?php echo $this->user->profile->url; ?></a>
			</span>
			<?php endif; ?>

			<?php if ($this->params->get('userEmail')): ?>
			<span class="userEmail">
				<?php echo JText::_('K2_EMAIL'); ?>: <?php echo JHTML::_('Email.cloak', $this->user->email); ?>
			</span>
			<?php endif; ?>	
		</div>
		<?php endif; ?>

		<div class="clr"></div>
		
		<?php echo $this->user->event->K2UserDisplay; ?>
		
		<div class="clr"></div>
	</div>
	<?php endif; ?>
	
	<?php if(count($this->items)): ?>
	<!-- Item list -->
	<div class="userItemList">
		<?php foreach ($this->items as $item): ?>
		
		<!-- Start K2 Item Layout -->
		<div class="userItemView<?php if(!$item->published || ($item->publish_up != $this->nullDate && $item->publish_up > $this->now) || ($item->publish_down != $this->nullDate && $item->publish_down < $this->now)) echo ' userItemViewUnpublished'; ?><?php echo ($item->featured) ? ' userItemIsFeatured' : ''; ?>">
		
			<!-- Plugins: BeforeDisplay -->
			<?php echo $item->event->BeforeDisplay; ?>
			
			<!-- K2 Plugins: K2BeforeDisplay -->
			<?php echo $item->event->K2BeforeDisplay; ?>
		
			<div class="userItemHeader">			

			  <?php if($this->params->get('userItemImage') && !empty($item->imageGeneric)): ?>
			  <!-- Item Image -->
			  <div class="userItemImageBlock">
				  <span class="userItemImage">
				    <a href="<?php echo $item->link; ?>" title="<?php if(!empty($item->image_caption)) echo K2HelperUtilities::cleanHtml($item->image_caption); else echo K2HelperUtilities::cleanHtml($item->title); ?>">
				    	<span class="imagehoverlink"></span><img src="<?php echo $item->imageGeneric; ?>" alt="<?php if(!empty($item->image_caption)) echo K2HelperUtilities::cleanHtml($item->image_caption); else echo K2HelperUtilities::cleanHtml($item->title); ?>" style="width:202px; height:120px;" />
				    </a>
				  </span>
				  <div class="clr"></div>
			  </div>
			  <?php endif; ?>
			
			  <?php if($this->params->get('userItemTitle')): ?>
			  <!-- Item title -->
			  <h3 class="userItemTitle">
					<?php if(isset($item->editLink)): ?>
					<!-- Item edit link -->
					<span class="userItemEditLink">
						<a class="modal" rel="{handler:'iframe',size:{x:990,y:550}}" href="<?php echo $item->editLink; ?>">
							<?php echo JText::_('K2_EDIT_ITEM'); ?>
						</a>
					</span>
					<?php endif; ?>

			  	<?php if ($this->params->get('userItemTitleLinked') && $item->published): ?>
					<a href="<?php echo $item->link; ?>">
			  		<?php echo $item->title; ?>
			  	</a>
			  	<?php else: ?>
			  	<?php echo $item->title; ?>
			  	<?php endif; ?>
			  	<?php if(!$item->published || ($item->publish_up != $this->nullDate && $item->publish_up > $this->now) || ($item->publish_down != $this->nullDate && $item->publish_down < $this->now)): ?>
			  	<span>
		  			<sup>
		  				<?php echo JText::_('K2_UNPUBLISHED'); ?>
		  			</sup>
	  			</span>
	  			<?php endif; ?>
			  </h3>
			  <?php endif; ?>
		
		</div>

		<div class="itemInformation nspArt">
			<p class="nspInfo nspInfo1 tleft fnull">
			
			<?php if($this->params->get('userItemDateCreated')): ?>
				<!-- Date created -->
				<span class="nspData">
					<i class="icon-time"></i><?php echo JHTML::_('date', $item->created , JText::_('K2_DATE_FORMAT_LC2')); ?>
				</span>
			<?php endif; ?>  
		  
		  				<?php if($this->params->get('userItemCategory')): ?>
				<!-- Item category name -->
					<a class="nspCat" href="<?php echo $item->category->link; ?>"><i class="icon-folder-open"></i><?php echo $item->category->name; ?></a>
				<?php endif; ?>
			
			</p>			
		</div>
		  <!-- Plugins: AfterDisplayTitle -->
		  <?php echo $item->event->AfterDisplayTitle; ?>
		  
		  <!-- K2 Plugins: K2AfterDisplayTitle -->
		  <?php echo $item->event->K2AfterDisplayTitle; ?>

		  <div class="userItemBody">
		
			  <!-- Plugins: BeforeDisplayContent -->
			  <?php echo $item->event->BeforeDisplayContent; ?>
			  
			  <!-- K2 Plugins: K2BeforeDisplayContent -->
			  <?php echo $item->event->K2BeforeDisplayContent; ?>
		  
			  <?php if($this->params->get('userItemIntroText')): ?>
			  <!-- Item introtext -->
			  <div class="userItemIntroText">
			  	<?php echo K2HelperUtilities::wordLimit($item->introtext,47); ?>
			  </div>
			  <?php endif; ?>
		
				<div class="clr"></div>

			  <!-- Plugins: AfterDisplayContent -->
			  <?php echo $item->event->AfterDisplayContent; ?>
			  
			  <!-- K2 Plugins: K2AfterDisplayContent -->
			  <?php echo $item->event->K2AfterDisplayContent; ?>
		
			  <div class="clr"></div>
		  </div>
		
		  <?php if($this->params->get('userItemCategory') || $this->params->get('userItemTags')): ?>
		  <div class="userItemLinks">
				
			  <?php if($this->params->get('userItemTags') && isset($item->tags)): ?>
			  <!-- Item tags -->
			  <div class="userItemTagsBlock">
				  <span><?php echo JText::_('K2_TAGGED_UNDER'); ?></span>
				  <ul class="userItemTags">
				    <?php foreach ($item->tags as $tag): ?>
				    <li><a href="<?php echo $tag->link; ?>"><?php echo $tag->name; ?></a></li>
				    <?php endforeach; ?>
				  </ul>
				  <div class="clr"></div>
			  </div>
			  <?php endif; ?>

				<div class="clr"></div>
		  </div>
		  <?php endif; ?>  
		
			<div class="clr"></div>

			<?php if($this->params->get('userItemCommentsAnchor') && ( ($this->params->get('comments') == '2' && !$this->user->guest) || ($this->params->get('comments') == '1')) ): ?>
			<!-- Anchor link to comments below -->
			<div class="userItemCommentsLink">
				<?php if(!empty($item->event->K2CommentsCounter)): ?>
					<!-- K2 Plugins: K2CommentsCounter -->
					<?php echo $item->event->K2CommentsCounter; ?>
				<?php else: ?>
					<?php if($item->numOfComments > 0): ?>
					<a href="<?php echo $item->link; ?>#itemCommentsAnchor">
						<?php echo $item->numOfComments; ?> <?php echo ($item->numOfComments>1) ? JText::_('K2_COMMENTS') : JText::_('K2_COMMENT'); ?>
					</a>
					<?php else: ?>
					<a href="<?php echo $item->link; ?>#itemCommentsAnchor">
						<?php echo JText::_('K2_BE_THE_FIRST_TO_COMMENT'); ?>
					</a>
					<?php endif; ?>
				<?php endif; ?>
			</div>
			<?php endif; ?>
		  
			<?php if ($this->params->get('userItemReadMore')): ?>
			<!-- Item "read more..." link -->
			<div class="userItemReadMore">
				<a class="k2ReadMore" href="<?php echo $item->link; ?>">
					<?php echo JText::_('K2_READ_MORE'); ?>
				</a>
			</div>
			<?php endif; ?>
			
			<div class="clr"></div>

		  <!-- Plugins: AfterDisplay -->
		  <?php echo $item->event->AfterDisplay; ?>
		  
		  <!-- K2 Plugins: K2AfterDisplay -->
		  <?php echo $item->event->K2AfterDisplay; ?>
			
			<div class="clr"></div>
		</div>
		<!-- End K2 Item Layout -->
		
		<?php endforeach; ?>
	</div>

	<!-- Pagination -->
	<?php if(count($this->pagination->getPagesLinks())): ?>
	<div class="pagination">
		<?php echo $this->pagination->getPagesLinks(); ?>
		<div class="clr"></div>
		<?php echo $this->pagination->getPagesCounter(); ?>
	</div>
	<?php endif; ?>
	
	<?php endif; ?>

</div>

<!-- End K2 User Layout -->

Thanks a lot for your help !

Best regards
5 years 11 months ago #8 by Function90
Hello,

You can use the attached file. You can view the difference between original file and this attached file.


Attachment file.php.zip not found


Thank you
Team Function90
You can share your views regarding our extension at JED ( extensions.joomla.org/profile/profile/details/225115#extensions )

Hire Professional Joomla Developers. ( www.function90.com/contact-us.html )
Attachments:
5 years 11 months ago #9 by eastkilla
Hi,

You are really fantastic !

Unfortunately, when I click on user link, it gives me and empty page. Somthing is wrong i think :(
5 years 11 months ago #10 by Function90
Please use the below attached file


Attachment file.php_2014-10-16.zip not found


Thank you
Team Function90
You can share your views regarding our extension at JED ( extensions.joomla.org/profile/profile/details/225115#extensions )

Hire Professional Joomla Developers. ( www.function90.com/contact-us.html )
Attachments:
5 years 11 months ago #11 by eastkilla
Woooowww !

Really I don't know how to say you thanks ! It works very well ! Best support ever seen.

Best regards, I love you ;)
5 years 11 months ago #12 by Function90
Hello,

It is our pleasure to help you. Let us know if you need any custom extension development. We would be happy to do it.

You can give your feedback about ContenHider plugin on JED, if you have used it.
extensions.joomla.org/extensions/access-...nt-restriction/25829

Thank you
Team Function90
You can share your views regarding our extension at JED ( extensions.joomla.org/profile/profile/details/225115#extensions )

Hire Professional Joomla Developers. ( www.function90.com/contact-us.html )
5 years 11 months ago #13 by eastkilla
Hi,

A good extension will be extensions.joomla.org/extensions/extensi.../k2-extensions/22247
But it's only for Joomla 2.5.
What is the price to develop a similar extension for Joomla 3.xxx ?
5 years 11 months ago #14 by Function90
Hello,

We have replied you on your registered email id. Please check and reply us.

Thank you
Team Function90
You can share your views regarding our extension at JED ( extensions.joomla.org/profile/profile/details/225115#extensions )

Hire Professional Joomla Developers. ( www.function90.com/contact-us.html )
Powered by Kunena Forum
Cron Job Starts