MyBB Community Forums

Full Version: MyYoutube Plugin not compatible
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I read that you can change a few things to make it compatible with 1.8   I have changed the things that needed but I still get the problem.  This is what the .php file looks like now:

<?php

if(!defined("IN_MYBB"))
{
  die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}

$plugins->add_hook("datahandler_user_update", "youtube_update");
$plugins->add_hook("member_profile_start", "youtube_profile");

function youtube_info()
{
  return array(
    "name"           => "My Youtube",
    "description"    => "Add to your profile your favorite video Youtube",
    "website"        => "http://www.mybb-es.com/",
    "author"         => "Edson Ordaz",
    "authorsite"     => "http://www.mybb-es/",
    "version"        => "1.0",
    "compatibility"  => "18*",
	"guid"			 => "03c7eaa3e61e37767b3d9ecc1c9b7a88"
  );
}

function youtube_activate()
{
	global $db;
	$db->query("ALTER TABLE ".TABLE_PREFIX."users ADD ytb VARCHAR(200) NOT NULL AFTER msn");
  
	$profile_table  = array(
		"tid" => "NULL",
		"title" => "youtube_profile",
		"template" => $db->escape_string('<br /><table border="0" cellspacing="{$theme[\'borderwidth\']}" cellpadding="{$theme[\'tablespace\']}" width="100%" class="tborder">
<tr>
<td colspan="2" class="thead"><strong>Youtube Video</strong></td>
</tr>
<tr>
<td class="trow1">
<object width="425" height="350">
<param name="movie" value="http://www.youtube.com/v/{$user[\'ytb\']}"></param>
<param name="wmode" value="transparent"></param>
<embed src="http://www.youtube.com/v/{$user[\'ytb\']}" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350">
</embed>
</object>
</td>
</tr>
</table>'),
		"sid" => "-1",
	);
	$profile_table_empty  = array(
		"tid" => "NULL",
		"title" => "youtube_profile_empty",
		"template" => $db->escape_string('<br /><table border="0" cellspacing="{$theme[\'borderwidth\']}" cellpadding="{$theme[\'tablespace\']}" width="100%" class="tborder">
<tr>
<td colspan="2" class="thead"><strong>Youtube Video</strong></td>
</tr>
<tr>
<td class="trow1">
<center>{$user[\'username\']} Not have any video from YouTube</center>
</td>
</tr>
</table>'),
		"sid" => "-1",
	);
	
	$db->insert_query("templates", $profile_table);
	$db->insert_query("templates", $profile_table_empty);
	require_once MYBB_ROOT."inc/adminfunctions_templates.php";

	find_replace_templatesets('usercp_profile','#{\$customfields\}#',
         '{$customfields}
<br />
<fieldset class="trow2">
<legend><strong>YouTube Video</strong></legend>
<table cellspacing="0" cellpadding="{$theme[\'tablespace\']}">
<tr>
Enter the ID of your Video to Youtube:
<input type="text" class="textbox" name="ytb" size="25" value="{$user[\'ytb\']}" />
</tr>
</table>
</fieldset>');

	find_replace_templatesets('member_profile','#{\$profilefields}#',
        '{$profilefields}{$youtube}');
}

function youtube_deactivate()
{
	global $db;
	$db->query("ALTER TABLE ".TABLE_PREFIX."users DROP COLUMN ytb");

	$db->delete_query("templates","title = 'youtube_profile'");
	$db->delete_query("templates","title = 'youtube_profile_empty'");
	require_once MYBB_ROOT."inc/adminfunctions_templates.php";

	find_replace_templatesets('usercp_profile',
      preg_quote('#{$customfields}
<br />
<fieldset class="trow2">
<legend><strong>YouTube Video</strong></legend>
<table cellspacing="0" cellpadding="{$theme[\'tablespace\']}">
<tr>
Enter the ID of your Video to Youtube:
<input type="text" class="textbox" name="ytb" size="25" value="{$user[\'ytb\']}" />
</tr>
</table>
</fieldset>#'),
      '{$customfields}',0);

   find_replace_templatesets('member_profile',
        preg_quote('#{$youtube}#'),
      '',0);
}

function youtube_profile()
{
	global $db,$mybb,$youtube,$templates,$theme;
	$query = $db->write_query("SELECT * FROM ".TABLE_PREFIX."users WHERE uid=".intval($mybb->input[uid]));
	$user = $db->fetch_array($query);
	if(empty($user['ytb']))
	{
		eval("\$youtube = \"".$templates->get("youtube_profile_empty")."\";");
	}else{
		eval("\$youtube = \"".$templates->get("youtube_profile")."\";");
	}
}

function youtube_update($ytb)
{
	global $mybb, $db;
	if(isset($mybb->input['ytb']))
	{
		$ytb->user_update_data['ytb'] = $db->escape_string($mybb->input['ytb']);
	}
}

I still get this issue that shows up on my Admin screen:

MyBB has experienced an internal SQL error and cannot continue.

SQL Error:
1054 - Unknown column 'msn' in 'mybb_users'
Query:
ALTER TABLE mybb_users ADD ytb VARCHAR(200) NOT NULL AFTER msn
Please contact the MyBB Group for technical support.

I have no idea what is this.  If someone could help me I would greatly appreciate it.  If not then I'll just delete it.  Thanks in advance.
You probably don't care but I wouldn't recommend the use of this plugin, at all.
yeah I'm over it...lol...

You can delete this thread someone....