Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Try Vanilla Forums Cloud product

overriding function variable outside core files.

edited February 20 in Vanilla 2.5 Help

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 Cheerleader & Troubleshooter Munich Moderator

    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.