MyBB Community Forums

Full Version: How to uninstall plugin ? - A plugin which is not installed
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello Members,

Today i tried installing this adsense revenue sharing program.

http://mods.mybboard.net/view/adsense-revenue-sharing

After uploading file to inc/plugins, I visited admin cp and tried to activate plugin from plugin page.

[attachment=13641]

I have attached screenshot. Please tell me how to uninstall it. Did it create database table ? These options are just irritating me and also tell me how to remove adsense id field from usercp !

[attachment=13642]

Thank you very much !
I believe this is a problem with the plugins coding. Check if the mod was made for your version and if it was, contact the plugin author.
You might just have to remove the alterations manually from the templates / database. I can't download the plugin, but if you take a look at the coding at see which parts of the database it does alter then you can easily remove them Smile

You can safely just delete the plugin file from the ./inc/plugins/ folder - you can often debug from the errors you get Wink
Heya thanks for prompt replies ... Lemme check ... Will update this thread asap !
I checked all .. Im not getting anything from coding.

Here is the file coding -

<?php
/**
* Revenue Sharing for MyBB 1.2
* Copyright © 2007 Asad Niazi, All Rights Reserved!
*
* Website: http://www.spicefuse.com
* License:
* This plugin is offered "as is" with no guarantees.
* You may redistribute it provided the code and credits
* remain intact with no changes. This is not distributed
* under GPL, so you may not re-use the code in any other
* module, plugin, or program.
*
*
* Free for non-commercial purposes!
*
*/

// comment it to disable this mod while keeping the
// dependencies happy!
$plugins->add_hook("showthread_start", "revenue_topic_banner");
$plugins->add_hook("admin_forums_do_add", "revenue_forum_add");
$plugins->add_hook("admin_forums_do_edit", "revenue_forum_edit");

function revenue_info()
{
return array(
"name" => "Revenue Sharing!",
"description" => "A plugin to share revenue of adsense ads.",
"website" => "http://spicefuse.com",
"author" => "Asad Niazi",
"authorsite" => "http://spicefuse.com",
"version" => "1.0 Beta 2",
"guid" => "77c9a400e93da8d29451b23f6f5a92e6"
);
}

function revenue_activate()
{
global $db;

$help_doc = <<<DOC
This is a Revenue Sharing forum! We share some of our adsense income with our users on thread views.
<br /><br />

To get your adsense id, look at your ad code:<br /><br />

For example:<br /><br />

google_ad_client = "pub-<strong>5900000000000000</strong>"; <--- <em>The bolded part is your adsense ID.</em><br />
google_ad_width = 468;<br />
google_ad_height = 60;<br />
<br />

This is how it works:<br /><br />

<ol>
<li>You enter your Adsense ID in your profile.</li>
<li>You post a new topic or make a reply to an existing topic.</li>
<li>When you have at least 10 posts and you're actively participating, your Adsense ID is used for ads randomly and thus generating you income for the clicks made on the banners when your Adsense ID is used.</li>
</ol>

Your ad exposure depends on certain factors and a weight is calculated based on these. We do reveal some of the factors taken into account, however, we cannot list all of them as a prudent practice to prevent abuse. <br /><br />

A few points to know:<br />

<ul>
<li>You <em>do not</em> get more exposure on topics that contain too many replies. It's very logical! -- Since the ads are shared between the topic starter and the repliers, the more the repliers, the less the exposure.</li>
<li>Users given more weight get more exposure (this is set by site admin and you may get details from site admin regarding this). For example, in a forum giving more weight to topic starters, the topic starter will account for 3 times more weight than replying users. Suppose there are 4 replies to a topic, ~43% of the 75% share will be offered to the topic starter, while the rest will be shared between the repliers.</li>
</ul>

That's all you need to know about Revenue Sharing on this forum. Happy Posting & Earning!<br /><br />

The Revenue sharing at this forum is powered by <a href='http://spicefuse.com'>SpiceFuse Revenue Sharing</a> software plugin for MyBB.

DOC;

$help_doc = str_replace("'", "\'", $help_doc);

// create a group
$db->query("INSERT INTO `".TABLE_PREFIX."settinggroups` VALUES (NULL, 'spicefuse_revenue', 'SpiceFuse Revenue Sharing', 'Settings for the adsense revenue sharing plugin.', 1, '');");
$id = $db->insert_id();

$db->query("INSERT INTO `".TABLE_PREFIX."helpdocs` VALUES (NULL, 1, 'Revenue Sharing and Adsense ID?', 'Why I am being asked for adsense ID and what is revenue sharing?', '{$help_doc}', 'no', 'yes', 3);");
$hid = $db->insert_id();

// maybe the adsense settings do exist?
$query = $db->query("SELECT fid FROM `".TABLE_PREFIX."profilefields` WHERE `name` LIKE 'Adsense ID%'");
$fid = 'fid' . $db->fetch_field($query, 'fid');

if ($fid == "fid") {
$db->query("INSERT INTO `".TABLE_PREFIX."profilefields` VALUES (NULL, 'Adsense ID (<a href=\"misc.php?action=help&hid={$hid}\">what\'s this?</a>)', 'You can earn money on your Adsense account while posting on this forum.', 1, 'text', 20, 16, 'no', 'yes', 'yes')");
$fid = "fid" . $db->insert_id();

$db->query("
ALTER
TABLE ".TABLE_PREFIX."userfields
ADD $fid TEXT
");
}

$db->query("
INSERT INTO `".TABLE_PREFIX."settings` (`sid`, `name`, `title`, `description`, `optionscode`, `value`, `disporder`, `gid`) VALUES
(NULL, 'default_adsense', 'Default adsense id?', 'This is the id that will be used when displaying site owner\'s advertisements.', 'text', '', 1, {$id}),
(NULL, 'rev_sharing', 'Sharing', 'How much percent of views do you want to share (it\'s random and rough!)', 'select\r\n25=25% of revenue\r\n50=50% of revenue\r\n75=75% of revenue\r\n100=100% of revenue', '75', 2, {$id}),
(NULL, 'rev_fid', 'Users Adsense ID field?', 'What''s the fid for custom field that will be used to get adsense ids of members?', 'text', '{$fid}', 3, {$id});
");

// get all the forums and insert the settings
$query = $db->query("SELECT fid, name FROM ".TABLE_PREFIX."forums WHERE `type` = 'f' ORDER by `disporder` ASC");
while ($forum_data = $db->fetch_array($query))
{
$fid = $forum_data['fid'];
$forum_data['name'] = addslashes($forum_data['name']);

$db->query("INSERT INTO `".TABLE_PREFIX."settings` VALUES (NULL, 'rev_forum_{$fid}', '{$forum_data[name]}', 'Adjust weight settings for this forum.', 'select\r\n1=Repliers get more weight\r\n2=Topic starters get more weight\r\n3=Equal weight\r\n4=Only topic starters get weight', '3', 6, {$id})");
}

// rebuild settings...
rebuildsettings();
}

function revenue_deactivate()
{
global $mybb, $db;

$query = $db->query("SELECT gid FROM ".TABLE_PREFIX."settinggroups WHERE name = 'spicefuse_revenue'");
$gid = $db->fetch_field($query, 'gid');

if ($gid > 0) {
$db->query("DELETE FROM ".TABLE_PREFIX."settinggroups WHERE name = 'spicefuse_revenue'");
$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE gid = {$gid}");
}
}

function revenue_topic_banner()
{
global $mybb, $db;

if ($mybb->input['tid'] == "") {
return;
}

// 75% sharing on topics
switch ($mybb->settings['rev_sharing'])
{
case '25':
$sharing = array(1, 1, 1, 2); // 1/4 is shared
break;

case '50':
$sharing = array(1, 1, 2, 2); // 1/2 is shared
break;

case '75':
$sharing = array(1, 2, 2, 2); // 3/4 is shared
break;

case '100':
$sharing = array(2, 2, 2, 2); // full is shared
break;
}

$rand_entry = array_rand($sharing);

if ($sharing[ $rand_entry ] == 1) {
$the_adsense_id = $mybb->settings['default_adsense'];
}
else
{

$query = $db->query("SELECT {$mybb->settings[rev_fid]} as adsense_id, p.replyto, p.pid, p.fid, u.postnum, u.uid FROM ".TABLE_PREFIX."posts p LEFT JOIN ".TABLE_PREFIX."userfields c ON(c.ufid=p.uid)
LEFT JOIN ".TABLE_PREFIX."users u ON(u.uid=p.uid) WHERE p.tid = '{$mybb->input[tid]}' AND u.uid <> {$mybb->user[uid]}");
$adsense_ids = $users_multi_posts = array();
while ($f = $db->fetch_array($query))
{
// rules:
// - minimum 10 posts
// - no more than one entry in array (weight is a special case though!)
if ($f['adsense_id'] == "" OR $f['postnum'] < 10) {
continue;
}
else if (in_array($f['adsense_id'], $adsense_ids)) {

// do not give weight if 'repliers' get more weight, and the topic owner is replying to his topic
// It's obvious about forums that give more weight to repliers are doing so because users usually
// ask for help. You surely do not want to give them both help and money.
if ($mybb->settings['rev_forum_'.$f['fid']] == 1 AND $data_cache['topic_owners'][$f['replyto']] == $f['uid']) {
continue;
}

$users_multi_posts[$f['uid']]['adsense_id'] = $f['adsense_id'];
$users_multi_posts[$f['uid']]['posts']++;
continue;
}

// only topic starters get weight
if ($mybb->settings['rev_forum_'.$f['fid']] == 4 AND $f['replyto'] == 0) {
continue;
}

// add to array
$adsense_ids[] = $f['adsense_id'];

// record topic starters ids
if ($f['replyto'] == 0) {
$data_cache['topic_owners'][$f['pid']] = $f['uid'];
}

// dependent on forum settings stuff
if ($mybb->settings['rev_forum_'.$f['fid']] == "" OR $mybb->settings['rev_forum_'.$f['fid']] == 3) {
continue;
}

// repliers get more weight..
if ($mybb->settings['rev_forum_'.$f['fid']] == 1 AND $f['replyto'] != 0) {
$weight_times = 2;
}
// topic starters get more weight..
else if ($mybb->settings['rev_forum_'.$f['fid']] == 2 AND $f['replyto'] == 0) {
$weight_times = 2;
}
else
{
continue; // unexpected anyways!
}

// give more weight as necessary
for ($i = 0; $i < $weight_times; $i++) {
$adsense_ids[] = $f['adsense_id'];
}
}

// take care of users with multiple replies
// - weighs 1 per 3 posts
while (list($key,$val) = each($users_multi_posts))
{
$user_posts_weight = round($val['posts'] / 3);
if ($user_posts_weight > 0)
{
// give more weight
for ($i = 0; $i < $user_posts_weight; $i++) {
$adsense_ids[] = $val['adsense_id'];
}
}
}

// random adsense id pick
$rand_pick = array_rand($adsense_ids);
//echo $rand_pick;
$the_adsense_id = $adsense_ids[ $rand_pick ];
}

//print_r($adsense_ids);

// add the topic bottom banner
revenue_bottom_banner($the_adsense_id);
}

/**
* Add forums to settings whenever they're added from admin cp
*
* @access private
*/
function revenue_forum_add()
{
global $mybb, $db;

$fid = $db->insert_id();
$name = $db->escape_string($mybb->input['name']);

// get group id
$query = $db->query("SELECT gid FROM ".TABLE_PREFIX."settinggroups WHERE name = 'spicefuse_revenue'");
$gid = $db->fetch_field($query, 'gid');

// insert setting
if ($gid > 0) {
$db->query("INSERT INTO `".TABLE_PREFIX."settings` VALUES (NULL, 'rev_forum_{$fid}', '{$name}', 'Adjust weight settings for this forum.', 'select\r\n1=Repliers get more weight\r\n2=Topic starters get more weight\r\n3=Equal weight\r\n4=Only topic starters get weight', '3', 6, {$gid})");
}
}

/**
* Update forum names in settings whenever they're edited from admin cp
*
* @access private
*/
function revenue_forum_edit()
{
global $mybb, $db, $fid;

$title = $db->escape_string($mybb->input['name']);
$db->query("UPDATE `".TABLE_PREFIX."settings` SET `title` = '{$title}' WHERE `name` = 'rev_forum_{$fid}'");
}

function revenue_bottom_banner($adsense_id)
{
global $ad_data;

if ($adsense_id == "" OR strlen($adsense_id) < 15) {
global $mybb;
$adsense_id = $mybb->settings['default_adsense'];
}

$adsense_id = str_replace("pub-", "", $adsense_id);

// ad data -- variable in template
$ad_data = '
<tr><td class="trow1" align="center">
<div style="width: 728px; height: 90px; text-align: center;">
<script type="text/javascript"><!--
google_ad_client = "pub-'.$adsense_id.'";
google_ad_width = 728;
google_ad_height = 90;
google_ad_format = "728x90_as";
google_ad_type = "text";
google_ad_channel ="4000920195";
google_color_border = "FFFFFF";
google_color_link = "CC0000";
google_color_bg = "F7F7F7";
google_color_text = "000000";
google_color_url = "666666";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>
</td></tr>
';
}

?>
Seems like there's a few inserts that the plugin won't remove even if you uninstall/deactivate. To run through a list, these are the tables affected:
  • mybb_helpdocs
  • mybb_profilefields
  • mybb_settings
  • mybb_settinggroups
You'll need to look through these to remove the data the plugin adds. (mybb_ is just the table prefix!)
I deleted fid and Adsense ID table from mybb_profilefields! Have i done the right thing ?

Now how to delete data from other tables ?
Hey thanks for your support! Problem solved ...