Quote:
Originally Posted by kh99
Kudos to LifesGreatestGift for writing the plugin. But I think there may be one small problem: on this line:
Code:
LEFT JOIN " . TABLE_PREFIX . "user AS user ON (user.userid = thread.firstpostid)
I think you want thread.postuserid instead of thread.firstpostid.
|
As is, if you do a var_dump on $groups it shows the proper primary and secondary groups of the threadstarter.
The code works, I just messed up the "Specific forums" conditional.
if (in_array($thread['forumid'], array(1,2,3)))
please review other mods and vB code for proper usage. But other than that, the code is sound, and taken directly from forumdisplay.php
--------------- Added [DATE]1361811270[/DATE] at [TIME]1361811270[/TIME] ---------------
Quote:
Originally Posted by addamroy
When I go to save the threadbit template after inserting your if conditional, I get the following error message:
"Warning: Invalid argument supplied for foreach() in [path]/includes/functions.php on line 3568
Forum Message
The following error occurred when attempting to evaluate this template:
%1$s
This is likely caused by a malformed conditional statement. It is highly recommended that you fix this error before continuing, but you may continue as-is if you wish."
|
you must be doing something wrong because the code is tested as working 100% on vanilla vbulletin 4.2 pl3
--------------- Added [DATE]1361811317[/DATE] at [TIME]1361811317[/TIME] ---------------
i didnt even mess up the conditional it all works 100%
--------------- Added [DATE]1361811597[/DATE] at [TIME]1361811597[/TIME] ---------------
It was throwing an error, try this code
PHP Code:
if (in_array($thread['forumid'], array(3,4,5)))
{
$current_thread = $thread['threadid'];
$query = $vbulletin->db->query_first_slave("
SELECT user.usergroupid, user.membergroupids
FROM " . TABLE_PREFIX . "thread AS thread
LEFT JOIN " . TABLE_PREFIX . "user AS user ON (user.userid = thread.firstpostid)
WHERE thread.threadid = " . $current_thread . "
");
$primary_group = $query['usergroupid'];
$secondary_groups = $query['membergroupids'];
if(!empty($secondary_groups)) {
$groups = $primary_group . "," . $secondary_groups;
} else {
$groups = $primary_group;
}
$groups_all = explode(",", $groups);
} else {
$groups_all = array();
}
vB_Template::preRegister('threadbit',array('group' => $groups_all));