MyBB Community Forums

Full Version: I need help !!!
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I would like to see the address after RE: in the auto reply!

how can i do this?

I have an auto reply plugin that sends an auto reply to the thread but the address is not visible

can someone help me? 

Thx.

[Image: 4SPJrfU.png]

Auto Reply Plugin Php code !

<?php
/*
+--------------------------------------------------------------------------
|   Auto Reply in a Specific Forum
|   =============================================
|   by Tom Moore (www.xekko.co.uk)
|   =============================================
+---------------------------------------------------------------------------
|   > Date started: 10th February
|
|	Will automatically reply to a thread made in a specific forum
+--------------------------------------------------------------------------
*/
 
// 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.");
}

$plugins->add_hook("newthread_do_newthread_end", "replyto_world");

function replyto_info()
{
	return array(
		"name"			=> "Reply to Introduction",
		"description"	=> "A simple plugin that will automatically reply to a new thread in a specific forum",
		"website"		=> "http://community.mybboard.net/thread-44374.html",
		"author"		=> "Tom.M",
		"authorsite"	=> "http://www.xekko.co.uk",
		"version"		=> "1.0",
		"guid" 			=> "",
		"compatibility" => "*" // Should be 1.4.4 compatible - unable to test on previous versions
	);
}
function replyto_install()
{
	global $db;
	$query = $db->query("SELECT COUNT(DISTINCT gid) AS groups FROM ".TABLE_PREFIX."settings LIMIT 1");
	$last_group = $db->fetch_field($query, "groups") + 1;
	$row = 1;
	
	$set_group = array(
		"gid" => "arep",
		"name" => "arep",
		"title" => "Auto-Reply Settings",
		"description" => "Change the settings for the auto-reply plugin.",
		"disporder" => $last_group+1,
		"isdefault" => 0
	);
	
	$db->insert_query("settinggroups", $set_group);
		$group = $db->fetch_array($db->query("SELECT gid FROM ".TABLE_PREFIX."settinggroups WHERE name = 'arep' LIMIT 1"));

	$set_one = array(
		"name" => "arepforid",
		"title" => "Forum ID",
		"description" => "The \'fid\' of the forum you want new threads to be automatically replied to.",
		"optionscode" => "text",
		"value" => "1",
		"disporder" => $row++,
		"gid" => $group['gid']
	);
	
	$set_two = array(
		"name" => "arepuser",
		"title" => "User ID",
		"description" => "The user ID number who will appear to have posted the reply.",
		"optionscode" => "text",
		"value" => "1",
		"disporder" => $row++,
		"gid" => $group['gid']
	);
	
	$set_three = array(
		"name" => "arepmessage",
		"title" => "Message",
		"description" => "The message text of the automatic reply (MyCode allowed). You can use {username} in the message to display their username",
		"optionscode" => "textarea",
		"value" => "Welcome to the Forums, {username}! Please remember to read through the rules, and if you get stuck, use the search function or our help documents...\n\nOtherwise enjoy your stay, and thanks for joining!",
		"disporder" => $row++,
		"gid" => $group['gid']
	);
			
		$db->insert_query("settings", $set_one);
		$db->insert_query("settings", $set_two);
		$db->insert_query("settings", $set_three);
	
	rebuild_settings();
}

function replyto_uninstall()
{
	global $db;
	
	$db->delete_query("settinggroups", "name='arep'");
	$db->delete_query("settings", "name='arepforid'");
	$db->delete_query("settings", "name='arepuser'");
	$db->delete_query("settings", "name='arepmessage'");
	
	rebuild_settings();
}

function replyto_is_installed()
{
	global $db;
	$exists = $db->num_rows($db->simple_select("settinggroups", "name", "name = 'arep'"));
	if($exists > 0)
 	{
 		return true;
	}
	return false;
}

function replyto_activate()
{
	// Should just activate plugin effects
}

function replyto_deactivate()
{
	// Should just deactivate plugin effects
}

function replyto_world()
{
	global $db, $fid, $mybb, $tid;
if($fid == $mybb->settings['arepforid'])
{
		// Load the user who'll be posting this message
	$user = $db->fetch_array($db->simple_select("users", "*", "uid = '".$mybb->settings['arepuser']."'", array("limit" => 1)));	
		// Set up datahandler
	require_once MYBB_ROOT."inc/datahandlers/post.php";
	$posthandler = new PostDataHandler("insert");
	$message = $mybb->settings['arepmessage'];
		// Requested by Indigored: Use of {username}
	if(my_strpos($mybb->settings['arepmessage'], "{username}") !== false)
	{
		$query = $db->simple_select("posts", "username", "tid='".$tid."'", array("limit" => 1));
		$username = $db->fetch_field($query, "username");
		$mybb->settings['arepmessage'] = str_replace("{username}", $username, $mybb->settings['arepmessage']);
	}
	$post = array(
		"tid" => $tid,
		"replyto" => "1",
		"fid" => $mybb->settings['arepforid'],
		"subject" => "Re:",
		"icon" => "",
		"uid" => $user['uid'],
		"username" => $user['username'],
		"dateline" => TIME_NOW + 1, // Increase time to set the lastpost correctly
		"message" => $mybb->settings['arepmessage'],
		"ipaddress" => get_ip(),
		"posthash" => $mybb->input['posthash']
	);
	if($mybb->input['pid'])
	{
		$post['pid'] = $mybb->input['pid'];
	}
	if($user['signature']) // If the user has a signature, use it in the post
	{
	$usersignature = 1;
	}
	$post['options'] = array(
		"signature" => $usersignature,
		"subscriptionmethod" => "0", // Auto set this to 0 (otherwise it would just be terribly annoying)
		"disablesmilies" => "0" // Who doesn't like smilies?!?!?!?!?!?!?!?!!!! *pow pow
	);
	$posthandler->set_data($post);	
	$valid_post = $posthandler->validate_post(); // Because it needs to be validated (datahandler requirement)
		if(!$valid_post)
		{
			$post_errors = $posthandler->get_friendly_errors();
		}
	$postinfo = $posthandler->insert_post();
		// We need to update the forum/thread lastpost
		// Update Thread
	$last_thread = array(
		"lastposter" => $user['username'],
		"lastposteruid" => $user['uid']
	);
	$db->update_query("threads", $last_thread, "tid = '".$tid."'");
		// Update Forum
	$last_forum = array(
		"lastposter" => $user['username'],
		"lastposteruid" => $user['uid']
	);
	$db->update_query("forums", $last_forum, "fid = '".$fid."'");
}
}

?>
I honestly don't understand your question.
(2019-11-30, 05:15 PM)WallBB Wrote: [ -> ]I honestly don't understand your question.

ok done SOLVED.