hook integrate_messageindex_topics / Usage February 01, 2016, 12:43:30 pm 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 wellMy 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 9Notice: Array to string conversion in /var/www/html/elk/sources/TopicPrefix.integrate.php on line 9Skip to main contentWhat is wrong here ?Thanks
Re: hook integrate_messageindex_topics / Usage Reply #1 – February 01, 2016, 03:33:13 pm 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.
Re: hook integrate_messageindex_topics / Usage Reply #2 – February 01, 2016, 03:48:43 pm Many thanks.
Re: hook integrate_messageindex_topics / Usage Reply #3 – February 01, 2016, 05:46:45 pm 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.