XF 2.2 How to disable/hide IP logging of certain users/admins?

I want to disable/spoof the IP logging of admins on my forum. Since there is no point in exposing their IP to mods. How can I do this? I looked this up but only found an old 1.4 plugin that's irrelevant now. What would be the easiest way of achieving this?
 
No, there are no settings.
I understood that already. Just asked in case it was recently added or to atleast make the devs consider it. Tried your add on. Immediately caused server errors and couldn't retrieve any ip's any longer. No offense but that's what I mean. This should be a setting or easily done in code. Easiest way I could think is maybe a cron job with db operation but that's not really elegant.
 
I've had no reports of errors. Please post them in the addon thread so they can be investigated.

There are a lot of things individuals consider should be in the core, but the reality is that it's not going to hapoen. That is why there are addons, to extend the core to suit individuals needs/wants.
 
The only way you could do that in the core settings is to disable the permission for mods or the user in question from viewing ips at all. And only allow admins to view ip addresses. Then they wouldn't be able to. As far as keeping admins ip addresses private, there really is no way in the core Xenforo as this is all based around the "can view ip addresses" permission found in permission settings.
 
I hope it helps someone..

src/XF/repository/Ip.php

line 21-38 replace;


PHP:
public function logIp($userId, $ip, $contentType, $contentId, $action = '')
    {      
        $entity = $this->em->create('XF:Ip');
        $entity->user_id = $userId;
       $removeip= array ('1','2','3');  /* 1,2,3 sample user id */ 
         if (in_array($userId,$removeip)) {
                    $entity->ip = '1.1.1.1';
        } else {
                     $entity->ip = $ip;
         }
        

        $entity->content_type = $contentType;
        $entity->content_id = $contentId;
        $entity->action = $action;

        if ($entity->save(false))
        {
            return $entity;
        }
        else
        {
            return null;
        }
    }
 
Top Bottom