PM on new rep

Status
Not open for further replies.
Reputation
0
I know a code that can be placed into a file to upload to the forum ftp directory that will do this for you. Might be something to add an extra effect to the forum :) Haven't seen this on many myBB forums.

Add this into notepad, and save with php file extension.
Code:
<?php
$l['pmonreputation_newreputation'] = 'New Reputation ';
$l['pmonreputation_positive'] = 'Positive';
$l['pmonreputation_negative'] = 'Negative';
$l['pmonreputation_netural'] = 'Netural';

$l['pmonreputation_body1'] = 'You have just recieved ';
$l['pmonreputation_body2'] = ' reputation from  ';


?>

put this into your forum directory under inc/languages/english

here is the second file you need to add as a php file:
Code:
<?php
/*
PM On Reputation
by: vbgamer45
http://www.mybbhacks.com
Copyright 2010  MyBBHacks.com

############################################
License Information:

Links to http://www.mybbhacks.com must remain unless
branding free option is purchased.
#############################################
*/
if(!defined('IN_MYBB'))
	die('This file cannot be accessed directly.');

$plugins->add_hook('reputation_do_add_end','pmonreputation_sendpm');


function pmonreputation_info()
{

	return array(
		"name"		=> "PM On Reputation",
		"description"		=> "This plugin sends the user a pm when they receive new reputation",
		"website"		=> "http://www.mybbhacks.com",
		"author"		=> "vbgamer45",
		"authorsite"		=> "http://www.mybbhacks.com",
		"version"		=> "1.0",
		"guid" 			=> "465430b96e45ab9af6e5ff2c97e3ec21",
		"compatibility"	=> "1*"
		);
}



function pmonreputation_activate()
{

}

function pmonreputation_deactivate()
{


}

function pmonreputation_sendpm()
{
	global $db, $user_info, $lang, $reputation, $existing_reputation;

	// Change exisitng
	if ($existing_reputation['uid'])
	{
		return;
	}

	$lang->load('pmonreputation');


	// Get username of reputation adder
	$query = $db->write_query("SELECT username FROM ".TABLE_PREFIX."users
		 WHERE uid = " . $reputation['adduid']);
	$userRow = $db->fetch_array($query);


	$subject = '';
	$body =  '';

	// Netural
	if ($reputation['reputation'] == 0)
	{
		$subject = $lang->pmonreputation_newreputation . " " . $lang->pmonreputation_netural;
		$body =   $lang->pmonreputation_body1 . $lang->pmonreputation_netural . $lang->pmonreputation_body2 . $userRow['username'];
	}

	// Negative
	if ($reputation['reputation'] < 0)
	{
		$subject = $lang->pmonreputation_newreputation . " " . $lang->pmonreputation_negative;
		$body =   $lang->pmonreputation_body1 . $lang->pmonreputation_negative . $lang->pmonreputation_body2 . $userRow['username'];
	}

	// Positive
	if ($reputation['reputation'] > 0)
	{
		$subject = $lang->pmonreputation_newreputation . " " . $lang->pmonreputation_positive;
		$body =   $lang->pmonreputation_body1 . $lang->pmonreputation_positive . $lang->pmonreputation_body2 . $userRow['username'];
	}




	// Send PM
	require_once MYBB_ROOT."inc/datahandlers/pm.php";
	$pmhandler = new PMDataHandler();

	$pm = array(
		'subject' => $subject,
		'message' => $body,
		'icon' => '',
		'toid' => array($reputation['uid']),
		'fromid' => $reputation['adduid'],
		"do" => '',
		"pmid" => '',

	);

	$pm['options'] = array(
	'signature' => '0',
	'savecopy' => '0',
	'disablesmilies' => '0',
	'readreceipt' => '0',
	);


	$pmhandler->set_data($pm);
	$valid_pm = $pmhandler->validate_pm();

	if( $valid_pm)
	{
		$pmhandler->insert_pm();
	}


}




?>

This file will go in your ftp under inc/plugins

After all that is done, you can now go to your admin panel and activate your new pm on reputation plugin :) Just something I thought I'd share since i've used it before, and I found it fairly useful. The users seemed to have liked it as well.
 
Reputation
0
Purple Muffin said:
That would suck, I like to randomly find out that I have new rep :)

haha, no problem :) I also made this thread to give him a couple favicon's that i've made. You're output is great though. It's really up for discussion as of now, because i'm sure he'll only do what everyone wants.

favicons:
http://www.megaupload.com/?d=QVKH2RTN

If you don't like those I can turn this image into a favicon later on as well.
2zok7ls.jpg
 

Reality

User is banned.
Reputation
0
Reputation shouldn't be used to be noticed, it should be used when it is needed.

Thus making forums like the ones that use that obsess over reputation, I'd rather this forum was not shaped by rep.
 
Status
Not open for further replies.
Top