This plugin will look like this, without the callsign field though. I wrote it for my forums (for the most part) and now sharing it with you. It is licensed to you under the standard MIT licence everyone knows and loves (Seriously... Do anything you want with the below. I don't care if you print it out, roll it up with your drug of choice, and smoke it)
<< - This is a joke
Also while I did make this for my Swap "n" Shop you can modify the code below to make if say just about anything. As for support I will try an help whenever possible.
How to install :
Admincp >> Plugins & Products >> Add New Plugin
- Product : VBulletin
- Hook Location : postbit_display_complete
- Title : Anything that you want
- Execution Order : 5
- Plugin PHP Code
You may also want to change: - "<site>" to your sites url. (occurs twice in code)
- "__HASH__" This is the salt for your hash, changing this value will make it much more harder to brute-force the hash. (occurs once in code)
PHP Code:
$show_hashed_ip_forumid = array();/* fill with nothing to enable on all section */
if (isset($post) && isset($thread) && isset($post['ip']) && isset($thread['forumid'])) {
$show_hashed_ip = false;
if (array() == $show_hashed_ip_forumid) {
$show_hashed_ip = true;
} else if (in_array($thread['forumid'], $show_hashed_ip_forumid)) {
$show_hashed_ip = true;
}
if ($show_hashed_ip) {
//do curl call to api for getting country name by ip
$geo_api_url = 'http://www.geoplugin.net/php.gp?ip='.$post['ip'];
$ch = curl_init();
$timeout = 5;
curl_setopt($ch, CURLOPT_URL, $geo_api_url);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0)");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,false);
curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$data = curl_exec($ch);
curl_close($ch);
$geo_code = unserialize($data);
$country = $geo_code['geoplugin_countryName'];
$post['message'] .= '
<div style="margin-top: 25px;
border: 1px solid green;
padding: 8px;line-height: 20px;
font-size: 11px;">
<strong>This ad was posted by:</strong> '.$post['username'].'
<strong>Country:</strong> '.$country.'
<strong>IP Hash:</strong> '.md5(__HASH__.':'.$post['ip']).' <br />
To inquire about this listing, please contact the seller directly as specified in the ad. <br />
If no email address or phone was given, <a href="http://<site>/forums/member.php?'.$post['userid'].'-'.$post['username'].'">click HERE to send '.$post['username'].' a private message</a>. <br />
<site> assumes no responsibility for the accuracy of this listing</div>
';
}
}
Note : to enable it only on some subforums, replace this
PHP Code:
$show_hashed_ip_forumid = array();/* fill with nothing to enable on all section */
With this (for example sub forum ids are 5, 6, 10)
PHP Code:
$show_hashed_ip_forumid = array(5, 6, 10);/* fill with nothing to enable on all sec