Please, i need your help in enabling voting/rating in article category blog layout instead of just displaying the rating score.

I want users to be able to vote from the category blog layout because there will be no link for the user to go to the full article where they could have voted.

After some digging

The code that determines the display of of the drop-down box for the selection of votes and voting in articles is this:

if ($this->app->input->getString('view', '') === 'article' && $row->state == 1) 

found on line 131 of plugins\content\vote.php

When i changed the 'article' in the code above to 'category', the voting drop-down displayed on the category blog layout but when i selected a score and tried to vote, i got this error message:

 Fatal error: Call to undefined method ContentModelCategory::storeVote() in http://site.com\components\com_content\controllers\article.php on line 349

Please, your inputs and possible solution is highly welcomed.

Thanks in advance.

Only changing view condition in vote plugin will not work because, for which is submitting data must be directed to the article controller instead of category controller. If you will see this https://github.com/joomla/joomla-cms/blob/staging/plugins/content/vote/tmpl/vote.php#L35 you will get an idea that form action is current url. Try to change this action to article (you may pass view name in hidden variable like task).

[Haven't tested it practically but it should work]

  • Thanks @gunjan for your interest. I will appreciate if you help with "Try to change this action to article (you may pass view name in hidden variable like task)" for I am not yet proficient with codes but i will read on the topic to see if i will be able to solve it. However, i will highly welcome your help. Thanks – kije May 8 '17 at 9:47

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.