Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

overriding function variable outside core files.

edited February 2018 in Vanilla 2.0 - 2.8

hello vanilla version 2.5.1/php7

$Definition can be change in conf/localephp. thread

Verifying email address link was bugged (0A 3D). I made a change in library/core/classemailphp. So can $this variable be changed outside the core files?

/* Constructor. */
line 46
function __construct() {$this->PhpMailer->Encoding = 'quoted-printable';
function __construct() {$this->PhpMailer->Encoding = '8bit';

documentation on function.

if (!function_exists('functionName')) {
function functionName() {
// Do something.

So would I put a file in conf/functionsgeneralphp with

if (!function_exists('function __construct')) {
function function __construct() {
$this->PhpMailer->Encoding = '8bit';



  • R_JR_J Ex-Fanboy Munich Admin

    You need to distinguish between objects methods and functions. If a function is defined in the way that you have described, it can be overriden. Normally you should avoid replacing anything and try to add functionality.

    There is an event fired right before a mail is send and you could use it to change the encoding:

    public function gdn_email_beforeSendMail_handler($sender) {
        $sender->Encoding = '8bit';

    Hooking into events is the preferred way in Vanilla to take influence.

    You could put this in a small plugin (that you create for this purpose) or in your custom themes (made by you) themehook-file.

  • okay cool! so time to look at documentation hooking into events and plugins.

        public function send($EventName = '') {
Sign In or Register to comment.