2013-08-14, 10:03 PM
So I'm trying to make this into a plugin and idk what im doing wrong
if(!defined("IN_MYBB")) die();
$plugins->add_hook("postbit","coinurlposts_postbit");
function coinurlposts_getCoinUrl($url) {
$uuid = "518d8d0ee1ee5172488964"; // Change this
$url = rawurlencode($url);
$result = file_get_contents("http://coinurl.com/api.php?uuid={$uuid}&url={$url}");
if($result == 'error')
return 'href="#"';
else
return 'href="'.$result.'"';
}
function coinurlposts_postbit($post) {
global $mybb;
$post['message'] = preg_replace('/href\=\"([^\s"]+)\"/e', 'coinurlposts_getCoinUrl("$1")', $post['message']);
return $post;
}