-
AuthorPosts
-
austenn01 Friend
austenn01
- Join date:
- August 2010
- Posts:
- 175
- Downloads:
- 115
- Uploads:
- 14
- Thanked:
- 33 times in 1 posts
September 20, 2015 at 1:40 pm #687152Hello,
In the Category Item layout, there is the ‘cog icon’ at top right corner of each Article, and once clicked it shows a drop menu with: print, email, and edit )shows edit if user have permissions to edit).
What I want to do is only show the Cog Icon to Super Administrators for example.
So to do this, I need to know what php code to use in the template/html/com_content/category/xxx_item.php file.
I need to wrap the blow code in some php code that says (only show the below code if user in in the Supper Administrator Joomla User group (group id=8).
<!-- Aside -->
<?php if ($topInfo || $icons) : ?>
<aside class="article-aside clearfix"><dl class="article-info">
<dt class="article-info-term">
<?php echo JText::_('COM_CONTENT_ARTICLE_INFO'); ?>
</dt>
<?php if ($params->get('show_author') && !empty($this->item->author)) : ?>
<?php echo JLayoutHelper::render('joomla.content.info_block.author', array('item' => $this->item, 'params' => $params)); ?>
<?php endif; ?>Thanks,
EDIT:
Oh..I need to add one more rule. I need to be able to hide the Cog Icon by defining multiple Joomla User Groups (IE: Super Admin, Administrator, Manager) OR to show the Cog Icon to all Joomla User Groups above ‘Manager’ for example.
austenn01 Friendaustenn01
- Join date:
- August 2010
- Posts:
- 175
- Downloads:
- 115
- Uploads:
- 14
- Thanked:
- 33 times in 1 posts
September 20, 2015 at 4:23 pm #687214Ok, I found this code:
<?php
$user =& JFactory::getUser();
$uid = $user->id;jimport( 'joomla.access.access' );
$groups = JAccess::getGroupsByUser($uid, false);
if(in_array(8, $groups)){
echo 'only visible for super-admin test';
}?>
If i add this to my template/html/com_content/category/xxx_item.php file, I will only see this text: “only visible for super-admin test” when i am logged in as a super administrator.
The issue I have (as I dont know how to write php), is how to use the code just above and add the code from my original post to it.
Can someone please help?
austenn01 Friendaustenn01
- Join date:
- August 2010
- Posts:
- 175
- Downloads:
- 115
- Uploads:
- 14
- Thanked:
- 33 times in 1 posts
September 20, 2015 at 4:23 pm #749093Ok, I found this code:
<?php
$user =& JFactory::getUser();
$uid = $user->id;jimport( 'joomla.access.access' );
$groups = JAccess::getGroupsByUser($uid, false);
if(in_array(8, $groups)){
echo 'only visible for super-admin test';
}?>
If i add this to my template/html/com_content/category/xxx_item.php file, I will only see this text: “only visible for super-admin test” when i am logged in as a super administrator.
The issue I have (as I dont know how to write php), is how to use the code just above and add the code from my original post to it.
Can someone please help?
Ninja Lead ModeratorNinja Lead
- Join date:
- November 2014
- Posts:
- 16064
- Downloads:
- 310
- Uploads:
- 2864
- Thanks:
- 341
- Thanked:
- 3854 times in 3563 posts
September 21, 2015 at 3:59 am #687257Hi,
In this case, you can try to do with my solution below
Open templates/ja_medicare/html/layouts/joomla/content/icons.php file and add code above as my screenshot
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/defined('JPATH_BASE') or die;
$canEdit = $displayData['params']->get('access-edit');
$user = JFactory::getUser();
$uid = $user->id;jimport( 'joomla.access.access' );
$groups = JAccess::getGroupsByUser($uid, false);?>
<div class="icons">
<?php if(in_array(8, $groups)): ?>
<?php if (empty($displayData['print'])) : ?><?php if ($canEdit || $displayData['params']->get('show_print_icon') || $displayData['params']->get('show_email_icon')) : ?>
<div class="btn-group pull-right">
<a class="btn dropdown-toggle" data-toggle="dropdown" href="#"> <span class="icon-cog"></span> <span class="caret"></span> </a>
<?php // Note the actions class is deprecated. Use dropdown-menu instead. ?>
<ul class="dropdown-menu">
<?php if ($displayData['params']->get('show_print_icon')) : ?>
<li class="print-icon"> <?php echo JHtml::_('icon.print_popup', $displayData['item'], $displayData['params']); ?> </li>
<?php endif; ?>
<?php if ($displayData['params']->get('show_email_icon')) : ?>
<li class="email-icon"> <?php echo JHtml::_('icon.email', $displayData['item'], $displayData['params']); ?> </li>
<?php endif; ?>
<?php if ($canEdit) : ?>
<li class="edit-icon"> <?php echo JHtml::_('icon.edit', $displayData['item'], $displayData['params']); ?> </li>
<?php endif; ?>
</ul>
</div>
<?php endif; ?><?php else : ?>
<div class="pull-right">
<?php echo JHtml::_('icon.print_screen', $displayData['item'], $displayData['params']); ?>
</div><?php endif; ?>
<?php endif; ?>
</div>
Hope it helps
Regards
Ninja Lead ModeratorNinja Lead
- Join date:
- November 2014
- Posts:
- 16064
- Downloads:
- 310
- Uploads:
- 2864
- Thanks:
- 341
- Thanked:
- 3854 times in 3563 posts
September 21, 2015 at 3:59 am #749136Hi,
In this case, you can try to do with my solution below
Open templates/ja_medicare/html/layouts/joomla/content/icons.php file and add code above as my screenshot
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/defined('JPATH_BASE') or die;
$canEdit = $displayData['params']->get('access-edit');
$user = JFactory::getUser();
$uid = $user->id;jimport( 'joomla.access.access' );
$groups = JAccess::getGroupsByUser($uid, false);?>
<div class="icons">
<?php if(in_array(8, $groups)): ?>
<?php if (empty($displayData['print'])) : ?><?php if ($canEdit || $displayData['params']->get('show_print_icon') || $displayData['params']->get('show_email_icon')) : ?>
<div class="btn-group pull-right">
<a class="btn dropdown-toggle" data-toggle="dropdown" href="#"> <span class="icon-cog"></span> <span class="caret"></span> </a>
<?php // Note the actions class is deprecated. Use dropdown-menu instead. ?>
<ul class="dropdown-menu">
<?php if ($displayData['params']->get('show_print_icon')) : ?>
<li class="print-icon"> <?php echo JHtml::_('icon.print_popup', $displayData['item'], $displayData['params']); ?> </li>
<?php endif; ?>
<?php if ($displayData['params']->get('show_email_icon')) : ?>
<li class="email-icon"> <?php echo JHtml::_('icon.email', $displayData['item'], $displayData['params']); ?> </li>
<?php endif; ?>
<?php if ($canEdit) : ?>
<li class="edit-icon"> <?php echo JHtml::_('icon.edit', $displayData['item'], $displayData['params']); ?> </li>
<?php endif; ?>
</ul>
</div>
<?php endif; ?><?php else : ?>
<div class="pull-right">
<?php echo JHtml::_('icon.print_screen', $displayData['item'], $displayData['params']); ?>
</div><?php endif; ?>
<?php endif; ?>
</div>
Hope it helps
Regards
austenn01 Friendaustenn01
- Join date:
- August 2010
- Posts:
- 175
- Downloads:
- 115
- Uploads:
- 14
- Thanked:
- 33 times in 1 posts
September 24, 2015 at 1:10 am #692011Hello Ninja Lead,
Thanks for your reply…it does work, but I think you have completly missed the purpose of what I was asking and a few other things.
Your option is incredibly limiting, as it hides the COG ICON for ALL pages, category’s etc. Which is NOT what I want.
As per my request above, I want to hide the COG ICON in the category_item.php file, and ONLY this view. Honestly its a bit ridiculous to be showing the COG ICON with Print and Email on a category item listing page when we show snippets of maybe 9 or more joomla articles….why do we need to show 9 COG ICONS with 9 email and print options, its crazy and it looks ugly as hell. The only time this is a good option, is when someone with editing rights is logged on…as this makes frontend editing easier. But for the normal website visitor, its really silly to be showing the COG ICON on a category item page for each joomla article snippet.
Can you assist with what I am trying to do?
austenn01 Friendaustenn01
- Join date:
- August 2010
- Posts:
- 175
- Downloads:
- 115
- Uploads:
- 14
- Thanked:
- 33 times in 1 posts
September 24, 2015 at 1:10 am #749524Hello Ninja Lead,
Thanks for your reply…it does work, but I think you have completly missed the purpose of what I was asking and a few other things.
Your option is incredibly limiting, as it hides the COG ICON for ALL pages, category’s etc. Which is NOT what I want.
As per my request above, I want to hide the COG ICON in the category_item.php file, and ONLY this view. Honestly its a bit ridiculous to be showing the COG ICON with Print and Email on a category item listing page when we show snippets of maybe 9 or more joomla articles….why do we need to show 9 COG ICONS with 9 email and print options, its crazy and it looks ugly as hell. The only time this is a good option, is when someone with editing rights is logged on…as this makes frontend editing easier. But for the normal website visitor, its really silly to be showing the COG ICON on a category item page for each joomla article snippet.
Can you assist with what I am trying to do?
Ninja Lead ModeratorNinja Lead
- Join date:
- November 2014
- Posts:
- 16064
- Downloads:
- 310
- Uploads:
- 2864
- Thanks:
- 341
- Thanked:
- 3854 times in 3563 posts
September 24, 2015 at 3:15 am #692024Hi,
I tried to find on template/html/com_content/category/ folder but I could not see category_item.php as you mentioned above, if you want to apply with only Category list you have to change from blog_item.php file
+ Copy plugins/system/t3/base-bs3/html/com_content/category/blog_item.php file
+ Paste template/html/com_content/category/ folder
+ Open blog_item.php file
find and change
<?php if ($icons): ?>
<?php echo JLayoutHelper::render('joomla.content.icons', array('item' => $this->item, 'params' => $params)); ?>
<?php endif; ?>to
<?php if ($icons): ?>
<?php
$user = JFactory::getUser();
$uid = $user->id;jimport( 'joomla.access.access' );
$groups = JAccess::getGroupsByUser($uid, false);
if(in_array(8, $groups)){
echo JLayoutHelper::render('joomla.content.icons', array('item' => $this->item, 'params' => $params));
}
?>
<?php endif; ?>Hope it helps
Regards
Ninja Lead ModeratorNinja Lead
- Join date:
- November 2014
- Posts:
- 16064
- Downloads:
- 310
- Uploads:
- 2864
- Thanks:
- 341
- Thanked:
- 3854 times in 3563 posts
September 24, 2015 at 3:15 am #749537Hi,
I tried to find on template/html/com_content/category/ folder but I could not see category_item.php as you mentioned above, if you want to apply with only Category list you have to change from blog_item.php file
+ Copy plugins/system/t3/base-bs3/html/com_content/category/blog_item.php file
+ Paste template/html/com_content/category/ folder
+ Open blog_item.php file
find and change
<?php if ($icons): ?>
<?php echo JLayoutHelper::render('joomla.content.icons', array('item' => $this->item, 'params' => $params)); ?>
<?php endif; ?>to
<?php if ($icons): ?>
<?php
$user = JFactory::getUser();
$uid = $user->id;jimport( 'joomla.access.access' );
$groups = JAccess::getGroupsByUser($uid, false);
if(in_array(8, $groups)){
echo JLayoutHelper::render('joomla.content.icons', array('item' => $this->item, 'params' => $params));
}
?>
<?php endif; ?>Hope it helps
Regards
austenn01 Friendaustenn01
- Join date:
- August 2010
- Posts:
- 175
- Downloads:
- 115
- Uploads:
- 14
- Thanked:
- 33 times in 1 posts
September 24, 2015 at 3:46 pm #692369Hello,
Thanks works…thankyou… category_item.php was in another JoomArt template I was working on (i want this feature for all the sites I develop).
So the second thing I was after is how to reference more than 1 user group as per above, not just user group with id of 8. So how do I add more than 1 user group id, what code do i use?
Thanks again,
austenn01 Friendaustenn01
- Join date:
- August 2010
- Posts:
- 175
- Downloads:
- 115
- Uploads:
- 14
- Thanked:
- 33 times in 1 posts
September 24, 2015 at 3:46 pm #749628Hello,
Thanks works…thankyou… category_item.php was in another JoomArt template I was working on (i want this feature for all the sites I develop).
So the second thing I was after is how to reference more than 1 user group as per above, not just user group with id of 8. So how do I add more than 1 user group id, what code do i use?
Thanks again,
Ninja Lead ModeratorNinja Lead
- Join date:
- November 2014
- Posts:
- 16064
- Downloads:
- 310
- Uploads:
- 2864
- Thanks:
- 341
- Thanked:
- 3854 times in 3563 posts
September 25, 2015 at 2:02 am #692395Hi,
I can’t replicate the second question, it’s general question for Joomla so pls try to raise the same question into Joomla forum for help.
Regards
Ninja Lead ModeratorNinja Lead
- Join date:
- November 2014
- Posts:
- 16064
- Downloads:
- 310
- Uploads:
- 2864
- Thanks:
- 341
- Thanked:
- 3854 times in 3563 posts
September 25, 2015 at 2:02 am #749654Hi,
I can’t replicate the second question, it’s general question for Joomla so pls try to raise the same question into Joomla forum for help.
Regards
austenn01 Friendaustenn01
- Join date:
- August 2010
- Posts:
- 175
- Downloads:
- 115
- Uploads:
- 14
- Thanked:
- 33 times in 1 posts
January 18, 2016 at 4:50 pm #851871Hello,
The code given above no longer works. When I click to EDIT from the COG drop menu, it takes me to a 403 error page saying: You are not permitted to use that link to directly access that page (#228).
Can anyone help to fix this issue and also if anyone can help with my 2nd question from above?
Thanks,
Ninja Lead ModeratorNinja Lead
- Join date:
- November 2014
- Posts:
- 16064
- Downloads:
- 310
- Uploads:
- 2864
- Thanks:
- 341
- Thanked:
- 3854 times in 3563 posts
January 19, 2016 at 2:53 pm #855109Hi
In this To check the problem on your site I need the URL of your site, admin login backend of your site and FTP account via Set as private reply. I will help you to detect this Issue directly on your site. -
AuthorPosts
This topic contains 14 replies, has 2 voices, and was last updated by Ninja Lead 8 years, 10 months ago.
We moved to new unified forum. Please post all new support queries in our New Forum