Loading...
 
Skip to main content

13.x: Forum Thread Rating doesn't display icons for value 0, wrong icon for value 1, and no icons when labels are set beyond values

Status
Closed
Subject
13.x: Forum Thread Rating doesn't display icons for value 0, wrong icon for value 1, and no icons when labels are set beyond values
Version
13.x
Category
  • Error
  • Usability
Feature
All / Undefined
Deliberation
Edit interface (UI)
Forum
Rating
Resolution status
Fixed or Solved
Submitted by
Xavier de Pedro
Lastmod by
Xavier de Pedro
Rating
(1)
Description

13.x: Forum Thread Rating doesn't display icons for value 0, wrong icon for value 1 (fixed) , and no icons when labels are set beyond values (unfixed still)

I have it reproduced reusing the show instance of this other bug report:
https://dev.tiki.org/item5253
(linked here in case I need to go there to "svn up" again)

See this thread started by admin:
http://xavi-9794-5253.show.tikiwiki.org/tiki-view_forum_thread.php?comments_parentId=1

admin:
u: admin
p: 12345

Log in as user1
u: user1
p: user1


And here you can see a screenshot of the issue reproduced similarly in local:

Image


With these values in Wiki rating options:

Copy to clipboard
0=foo,1=bar,2=bar2,3=bar3,4=bar4,5=bar5
Solution

Hi Gezza,
The issue is due to the foreach array value, Because there is no key is used to store the values in array and display it the option is directly used. Now i fixed it by giving key values.

Please refer the commit Id :51666

Thanks


Fix confirmed. Thanks!

Workaround

note: mani is working on a fix

gezzaz note: I also took a look, maybe you find my findings useful. Problem seems to be with function get_options_smiles in lib/rating/ratinglib.php

When you set a name (text) for rating options, confusion comes as numbers are expected on some places.

Copy to clipboard
foreach ($options as $key => &$option) { $optionsAsKeysSorted[$option] = $key; } unset($key); ksort($optionsAsKeysSorted); $sets = $this->get_options_smiles_id_sets(); $set = $sets[count($options)]; foreach ($optionsAsKeysSorted as $key => &$option) { $option = array( 'img' => 'img/rating_smiles/' . $option . '.png', 'color' => $colors[$option] ); }

this seems to work for me, but also in rating.tpl you need to change the key and value in the foreach when rating_smileys pref is on.

There might be some conceptual confusion here when having text as rating values, I could not get further yet.

Importance
5
Easy to solve?
5
Priority
25
Demonstrate Bug on Tiki 19+
Demonstrate Bug (older Tiki versions)
Ticket ID
5257
Created
Wednesday 28 May, 2014 09:56:29 UTC
by Xavier de Pedro
LastModif
Thursday 19 June, 2014 16:49:17 UTC


Show PHP error messages