MyBB Community Forums

Full Version: registered links not working with conditional statement any more
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
A very useful plugin to us that was working in 1.6 appears to not be working as we need in 1.8. Any tips would be appreciated.

The original code:

if ($mybb->user['uid'] == 0)
{
$lang->load('registeredlinks');

$lang->reglinks_text = str_replace("{bburl}",$mybb->settings['bburl'],$lang->reglinks_text);

$message = preg_replace('#<a href="(.*?)</a>#i', $lang->reglinks_text, $message);

}

We changed if line to:
 if($forum['pid'] != 70 && !in_array($forum['fid'], array(100,140,68,78,39,159,56,160)) && in_array($mybb->usergroup['gid'], array(1, 5, 7, 12))) 

 { ......

This is because we needed certain forums to have public links. It worked great in 1.6, but in 1.8 it hides the link regardless of group or forum......

Any help with this line here to get it to work with 1.8?

Much thanks
Change your code to the following:

if($forum['pid'] != 70 && !in_array($forum['fid'], array(100,140,68,78,39,159,56,160) && in_array($mybb->usergroup['gid'], array(1, 5, 7, 12)) 

 { ...... 

What you done was closed the if statement after the first array with the extra bracket and then tried closing it again rendering it more or less useless.
SOLVED: Issue was - additional variables for the conditional not properly declared in the plugin