Ticket #308 (closed enhancement: fixed)

Opened 5 months ago

Last modified 4 months ago

Tag Cloud should be User Sensitive

Reported by: justinr Assigned to: nobody
Priority: normal Milestone: 0.9.2
Component: core Version: 0.9.0
Severity: normal Keywords:
Cc: justinr, renato Patch Included: 0
Review Stage: reviewed

Description

The site Tag Cloud should take into account the current user when making up its list. This seems to have been started in mod/search/lib/tags_display.php, but never finished. Lines 11-13 should be changed from:

if ($tags = get_records_sql('SELECT DISTINCT tag,count(ident) AS number, '.$db->random.' AS rand 
                             FROM '.$CFG->prefix."tags WHERE " . $searchline . "
                             GROUP BY tag having number > 1 order by rand limit 200")) {


into:

if ($tags = get_records_sql('SELECT DISTINCT tag,count(ident) AS number, '.$db->random.' AS rand 
                             FROM '.$CFG->prefix."tags WHERE " . $searchline . "
                             GROUP BY tag having number > 1 order by rand limit 200")) {

Change History

(follow-up: ↓ 2 ) 02/08/08 04:28:20 changed by renato

  • cc set to justinr, renato.
  • review_stage changed from unreviewed to needinfo.
  • milestone changed from 0.9.1 to 0.9.2.

I don't quite understand what you mea, and it seems to me that the versions of the code are identical. Could uyou explain better / provide the code you meant?

(in reply to: ↑ 1 ) 02/09/08 19:00:41 changed by justinr

Replying to renato:

I don't quite understand what you mea, and it seems to me that the versions of the code are identical. Could uyou explain better / provide the code you meant?

Shoot, sorry. Looks like I pasted the wrong code somehow. Anyway, the current code is:

if ($tags = get_records_sql('SELECT DISTINCT tag,count(ident) AS number, '.$db->random.' AS rand
                              FROM '.$CFG->prefix."tags WHERE access = ?
                              GROUP BY tag having number > 1 order by rand limit 200",array('PUBLIC'))) {

As found here: http://elgg.org/trac/browser/devel/mod/search/lib/tags_display.php

The fix just makes use of the $searchline variable that's already defined (and correctly at that) in the file but never referenced. The fix is (as pasted above, apparently twice):

if ($tags = get_records_sql('SELECT DISTINCT tag,count(ident) AS number, '.$db->random.' AS rand 
                             FROM '.$CFG->prefix."tags WHERE " . $searchline . "
                             GROUP BY tag having number > 1 order by rand limit 200")) {

So instead of just pulling in "PUBLIC" tags, it pulls in whatever tags that the current user (or logged-out user) is allowed to view.

03/20/08 13:27:57 changed by misja

  • status changed from new to closed.
  • resolution set to fixed.
  • review_stage changed from needinfo to reviewed.

Corrected in r1569