MyBB Community Forums

Full Version: PHP control does not go to admin
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am trying to modify an abandoned nofollow plugin whereby I want to nofollow all links posted by members except admins.

But no matter what I write in the if condition , the control does not go inside the if condition hence I end up with ALL links nofollow (even the ones posted by admin)

function nofollow_parse($msg)
  global $mybb;
    if ($mybb->usergroup['cancp'] == 1) 
{ return null; 
$msg = preg_replace("#<a href=\"(.+)\" target=\"_blank\" rel=\"noopener\" class=\"mycode_url\">#i", "<a href=\"$1\" target=\"_blank\" rel=\"noopener nofollow\" class=\"mycode_url\">", $msg);
return $msg;

I have tried with ($mybb->user['usergroup'] == 4) as well.

Can the experts here please point out what I may be doing wrong?
try replacing $msg with $message ...
Perhaps my premise was wrong, I have solved this in a different way.

I have another follow question to this for which I have opened a new thread.