MyBB Community Forums

Full Version: PLugin not working
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
So I was making a plugin to add the new google +1 button to threads but I have a issue. No errors when going into the plugins section but it's not showing up, so I cant activate it...?

<?php

// Disallow direct access to this file for security reasons
if(!defined("IN_MYBB"))
{
    die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}


function google1_info()
{
global $db;

    return array(
        'name'            => 'Goole +1',
        'description'    => 'Adds a Google +1 button to the first post of a thread.',
        'website'        => 'http://mods.mybb.com/',
        'author'        => 'Blake',
        'authorsite'    => 'http://mcmines.com',
        'version'        => '1.0',
        'compatibility'    => '16*',
        'guid'           => ''
    );
}

function google1_activate()
{
global $db;

require MYBB_ROOT."/inc/adminfunctions_templates.php"; 

find_replace_templatesets("postbit", "#".preg_quote("{\$ignore_bit}")."#i", "<script type=\"text/javascript\" src=\"http://apis.google.com/js/plusone.js\"></script> {\$ignore_bit}");
find_replace_templatesets("postbit", "#".preg_quote("{\$post['message']}<br />")."#i", "<div style=\"float: right;\"><g:plusone></g:plusone></div> {\$post['message']}<br />");
}

function google1_deactivate()
{

require MYBB_ROOT."/inc/adminfunctions_templates.php"; 

find_replace_templatesets("postbit", "#".preg_quote("<script type=\"text/javascript\" src=\"http://apis.google.com/js/plusone.js\"></script>")."#i", '', 0); 
find_replace_templatesets("postbit", "#".preg_quote("<div style=\"float: right;\"><g:plusone></g:plusone></div>")."#i", '', 0); 
}
?>
Make sure your plugin file is also called "google1.php".
Oops, my mistake but i get this error and dont know whats wrong...
Fatal error: Cannot redeclare google1_info() in inc/plugins/google1.php on line 10

Line 10: function google1_info()
This error shows that you've another plugin with google1_info function in your ./inc/plugins/ folder.