Rate and Comment based on usergroup?

  • Posts: 175
  • Thank you received: 0
6 years 4 months ago #149363

Hello, is there anyway to make different access to rating and comment?

for example:
user that is "Administrator" can rate and comment/review
user that is "Registered" user can only rate but cannot comment/review [their vote still count]

Last edit: 6 years 4 months ago by veeco.

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

  • Posts: 12469
  • Thank you received: 1716
  • MODERATOR
6 years 4 months ago #149372

Hello,
Don't think that there is an option to do that, so the solution will probably be to :
- Go to "Hikashop->Display->Views"
- Edit the "form" file of the "vote" view of your front-end template
- Change that line :

  <p class="hikashop_form_comment ui-corner-top"><?php echo JText::_('HIKASHOP_LET_A_COMMENT'); ?></p>
By :
<?php
$my = JFactory::getUser();

jimport('joomla.access.access');
$config =& hikashop_config();
$userGroups = JAccess::getGroupsByUser($my->id, (bool)$config->get('inherit_parent_group_access'));//$my->authorisedLevels();

if(!empty($userGroups)){
  foreach($userGroups as $userGroup){
    if($userGroup == YourGroupID){
?>
  <p class="hikashop_form_comment ui-corner-top"><?php echo JText::_('HIKASHOP_LET_A_COMMENT'); ?></p>
Note that you'll have to replace the YourGroupID by your Joomla user group ID that you'll be able to find through your Joomla User manager page
- And edit that lines :
<?php
}
?>
By :
<?php
}
   }
  }
}
?>

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

  • Posts: 175
  • Thank you received: 0
6 years 4 months ago #149484

Thank You.

The code will make validate whether it's administrator or normal user right?
and hide/show the comment textbox right?
but how if comments and vote connected? The empty comment validation will prevent normal user to vote

any suggestion?

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

  • Posts: 12469
  • Thank you received: 1716
  • MODERATOR
6 years 4 months ago #149514

That code will only hide the comment text area and submit button for users which are not from the user group that you have set through the YourGroupID variable.
Isn't it what you wanted ?

The following user(s) said Thank You: veeco

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

  • Posts: 4
  • Thank you received: 0
  • Hikamarket Frontedition
10 months 4 weeks ago #310609

Hi,
I try to follow your instruction but I don't where is the code
<?php
}
?>
=> I find two and reply by your sugguested code but the page still load error

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

  • Posts: 70149
  • Thank you received: 10504
  • MODERATOR
10 months 4 weeks ago #310613

Hi,

The instructions are still the same with the latest version of HikaShop.
The lines

<?php
	}
?>
are just before the end of the file:
monosnap.com/file/ZSRAPNGQhCxTXJakQQG4R0sJNRJajb
If you don't replace both pieces of code as explained, it's normal that you get an error.

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

Time to create page: 0.073 seconds
Powered by Kunena Forum