Skip to main content
Topic: hook integrate_messageindex_topics / Usage (Read 2136 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

hook integrate_messageindex_topics / Usage

Hey,
seems that i am to stupid.
I try to use the "integrate_messageindex_topics" hook and insert a Field  which i like to retrieve from elkarte_threads as well
My Code for the handler ( which gets called)
Code: [Select]
class Topic_Prefix_Integrate
{
public static function integrate_messageindex_topics($optionArray){
//&$sort_column=$optionArray[0];
$indexOptions=$optionArray[1];

$indexOptions['custom_selects'] = array('t.prefix');
}
}

But it does not work out - Error Message:
Warning: Illegal string offset 'custom_selects' in /var/www/html/elk/sources/TopicPrefix.integrate.php on line 9

Notice: Array to string conversion in /var/www/html/elk/sources/TopicPrefix.integrate.php on line 9
Skip to main content

What is wrong here ?
Thanks
Last Edit: February 01, 2016, 01:29:10 pm by Nifty

Re: hook integrate_messageindex_topics / Usage

Reply #1

Code: [Select]
class Topic_Prefix_Integrate
{
public static function integrate_messageindex_topics(&$sort_column, &$optionArray){
$optionArray['custom_selects'] = array('t.prefix');
}
}
$optionArray is passed as second argument of the function. ;)
Bugs creator.
Features destroyer.
Template killer.

Re: hook integrate_messageindex_topics / Usage

Reply #2

Many thanks.

Re: hook integrate_messageindex_topics / Usage

Reply #3

Oh, I didn't notice!
It would be much better to use:
Code: [Select]
if (empty($optionArray['custom_selects']))
    $optionArray['custom_selects'] = array();

$optionArray['custom_selects'][] = 't.prefix';
This way if the custom_selects is already defined by another addon it's not replaced entirely. ;)
Bugs creator.
Features destroyer.
Template killer.