Last week I took a closer look at WordPress to find out, whether I could use it as a multi-user blogging platform in my company. I had already tried LifeType, Drupal and WordPress Mu, but they all had their disadvantages (which I don’t want to explain at this point, but you may look here (German) if you are interested).
The only thing I needed, to make it as easy as possible for our employees to use the platform, was an automatic login via their IP-adresses. I use this way of authentication on some other sites on our intranet, too. I know, it is not a very secure way of authenticating your users, but as long as it is only a “free” blogging platform for all employees of the company, all I needed was the users to be logged in automatically, when they visit the site.
After searching the internet for some time, I found no plugin that fit my needs, so I decided to create one myself. However, WordPress’ API is very well documented and so after a short time, my plugin was finished.
The plugin makes use of WordPress’ wp_usermeta-table, where you can store all kinds of information about your users. All you need to do is create a field named ipaddress, that contains the corresponding user’s IP-address.
I did this via PHP in our Windows-logon script, but you are free to come up with any other way of inserting the IP-address into the table The only problem is, that you have to find out the user’s ID in wordpress. In my case this is easy because WordPress and Windows usernames are the same, so I can search the wp_users-table for the current Windows username and return the ID.
I think by using the plugin Userextra you could even be able to enter the IP address manually into the user’s profile…
An example SQL-statement (2 is the ID of the user that will be logged in, if IP 172.16.123.124 visits the site):
INSERT INTO `wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (50, 2, ‘ipaddress’, ’172.16.123.124′);
Of course you should not insert new rows into the table everytime an IP-address changes (use UPDATE instead).