Skip to content

Commit d6e1339

Browse files
committed
Add method to get title of an idea
1 parent 853ca43 commit d6e1339

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

event/listener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ public function show_idea($event)
230230
'IDEA_STATUS_NAME' => $this->ideas->get_status_from_id($idea['idea_status']),
231231
'IDEA_STATUS_LINK' => $this->helper->route('phpbb_ideas_list_controller', array('status' => $idea['idea_status'])),
232232

233-
'IDEA_DUPLICATE' => $idea['duplicate_id'],
233+
'IDEA_DUPLICATE' => $idea['duplicate_id'] ? $this->ideas->get_title($idea['duplicate_id']) : '',
234234
'IDEA_RFC' => $idea['rfc_link'],
235235
'IDEA_TICKET' => $idea['ticket_id'],
236236
'IDEA_IMPLEMENTED' => $idea['implemented_version'],

factory/ideas.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,25 @@ public function set_title($idea_id, $title)
444444
return true;
445445
}
446446

447+
/**
448+
* Get the title of an idea.
449+
*
450+
* @param int $id ID of an idea
451+
*
452+
* @return string The idea's title
453+
*/
454+
public function get_title($id)
455+
{
456+
$sql = 'SELECT idea_title
457+
FROM ' . $this->table_ideas . '
458+
WHERE idea_id = ' . (int) $id;
459+
$result = $this->db->sql_query_limit($sql, 1);
460+
$idea_title = $this->db->sql_fetchfield('idea_title');
461+
$this->db->sql_freeresult($result);
462+
463+
return $idea_title;
464+
}
465+
447466
/**
448467
* Submits a vote on an idea.
449468
*

0 commit comments

Comments
 (0)