Thread: Plugins
View Single Post
  #1  
Old 06-06-2009, 12:36 PM
cheechm
Guest
 
Posts: n/a
Default Plugins

I can't post in the other forum, because I don't have a license.. Although I wrote a mod for my friend and testing it on his forum I can't get it to work.

Code:
<?xml version="1.0" encoding="ISO-8859-1"?>

<product productid="postthismonth" active="1">
<title>cheechm - Posts this month</title>
<description>cheechm - Posts this month</description>
<version>1.0</version>

<plugins>
	<plugin active="1" product="vbulletin">
		<title><![CDATA[Posts This Month Mod]]></title>
		<hookname>template_groups</hookname>
		<phpcode>$only['ch_'] = 'Posts This Month';</phpcode>
	</plugin>
	<plugin active="1" product="poststhismonth">
		<title><![CDATA[cheechm - Posts this month]]></title>
		<hookname>cache_templates</hookname> 
		<phpcode><![CDATA[
		if ($vbulletin->options['ch_ptm_enable'])
		{
			$globaltemplates = array_merge($globaltemplates, array('ch_poststhismonth'));
		}]]></phpcode>
	</plugin>
	<plugin active="1" product="poststhismonth">
		<title><![CDATA[cheechm's Mods]]></title>
		<hookname>global_start</hookname>
		<phpcode><![CDATA[
		if ($vbulletin->options['ch_ptm_enable'])
		{
			$ch_user = $vbulletin->userinfo['username'];
			
			// Connect to THT database
mysql_connect("localhost", "root", "**") or die(mysql_error());
mysql_select_db("vb_test") or die(mysql_error());


// Get a specific result from the "tht_user" table
$ch_result = mysql_query("SELECT * FROM user
 WHERE username='$ch_user' ") or die(mysql_error());


// get the first (and hopefully only) entry from the result
$ch_row = mysql_fetch_array( $result );
// Print out the contents of each row into a table
$ch_previous_post = $row['posts'];

mysql_close();

$result = $db->query_read("SELECT posts FROM " . TABLE_PREFIX . "user WHERE username = '$ch_user'");
			// get the first (and hopefully only) entry from the result
$array = $db->fetch_array($result);

// Save to variable
$ch_total_post = $array['posts'];
$ch_months_posts = $ch_total_post - $ch_previous_post;
eval('$poststhismonth = "' . fetch_template('ch_posts_this_month') . '";');
}
		}]]></phpcode>
	</plugin>
</plugins>

<templates>
	<template name="ch_poststhismonth" templatetype="template" date="1209819618" username="cheechm" version="1.0"><![CDATA[
	<if condition="$vboptions[ch_ptm_enable]">
$vbphrase[ch_ptm_phrase] <phrase 1="$ch_months_posts">$vbphrase[ch_ptm]</phrase>
	</if>]]></template>
</templates>

<phrases>
	<phrasetype name="GLOBAL" fieldname="global">
		<phrase name="ch_ptm" username="cheechm"><![CDATA[{1}]]></phrase>
	</phrasetype>
	<phrasetype name="vBulletin Settings" fieldname="vbsettings">
		<phrase name="settinggroup_chptm" username="cheechm"><![CDATA[Posts This Month Mod]]></phrase>
		<phrase name="setting_ch_ptm_enable_title" username="cheechm"><![CDATA[Hack Options]]></phrase>
		<phrase name="setting_ch_ptm_enable_desc" username="cheechm"><![CDATA[Enable Hack?]]></phrase>
		<phrase name="setting_ch_ptm_phrase_title" username="cheechm"><![CDATA[Phrase Options]]></phrase>
		<phrase name="setting_ch_ptm_phrase_desc" username="cheechm"><![CDATA[Posts this month phrase]]></phrase>

	</phrasetype>
</phrases>

<options>
	<settinggroup name="chptm" displayorder="2">
		<setting varname="ch_ptm_enable" displayorder="10">
			<datatype>number</datatype>
			<optioncode>yesno</optioncode>
			<defaultvalue>1</defaultvalue>
		</setting>
		<setting varname="ch_ptm_phrase" displayorder="11">
			<datatype>free</datatype>
			<defaultvalue><![CDATA[Posts this month:]]></defaultvalue>
		</setting>
	</settinggroup>
</options>
</product>
I can't tell what is wrong, and debug doesn't give any info.


Thanks

PS: I can't view code!
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03431 seconds
  • Memory Usage 1,781KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete