changing or adding to the redirect message through a plugin
Dannymh Offline
Junior Member
**
Posts: 2
Joined: Mar 2012
Post: #1
changing or adding to the redirect message through a plugin
Hi,

I am writing a small plugin for my site which displays a certain message if the user has <25 messages on the redirect page. The only issue I am facing is that I can't seem to append to it.

I can get everything to trigger but just cant get the message from the redirect and add anything to it.

Can anyone point me to how I can hook into $message on the redirect page?

I did a var dump of $mybb and can't find that language string there anywhere

My code so far is
[code]
<?php
/**
* MyBB 1.6
* Copyright 2010 MyBB Group, All Rights Reserved
*
* Website: http://mybb.com
* License: http://mybb.com/about/license
*
* $Id: hello.php 5754 2012-03-09 14:58:03Z Tomm $
*/

// 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("redirect", "redirect_new_user);


function redirect_new_user_info()
{
/**
* Array of information about the plugin.
* name: The name of the plugin
* description: Description of what the plugin does
* website: The website the plugin is maintained at (Optional)
* author: The name of the author of the plugin
* authorsite: The URL to the website of the author (Optional)
* version: The version number of the plugin
* guid: Unique ID issued by the MyBB Mods site for version checking
* compatibility: A CSV list of MyBB versions supported. Ex, "121,123", "12*". Wildcards supported.
*/
return array(
"name" => "Redirect new user!",
"description" => "This displays a specific redirect message to users who have less than 25 posts",
"website" => "",
"author" => "Dannymh",
"authorsite" => "t",
"version" => "1.0",
"guid" => "",
"compatibility" => "*"
);
}

function redirect_new_user()
{
global $mybb;



if($mybb->user["postnum"]<=25) {
$mybb->user['showredirect']=1;


}

}

This forces the redirect but there is nothing in $mybb array that has the message that is displayed and i cant seem to find how I can tap into that.

Can anyone tell me how I might achieve this?

Cheers
Dan
08-02-2012 05:10 PM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #2
RE: changing or adding to the redirect message through a plugin

PHP Code:
$plugins->add_hook('redirect', 'herp');
function herp(&$args) {
  $args['message'] = 'herpy derpy';
}


My Blog
08-02-2012 10:39 PM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

 Standard Tools
Forum Jump: