<?php
class Andy_ChangeDate_Listeners_ControllerPublic
{
public static function Post($class, &$extend)
{
if ($class == 'XenForo_ControllerPublic_Post') #make this match the event hint, this will allow it to work on 1.1 also.
$extend[] = 'Andy_ChangeDate_ControllerPublic_Post'; #this is the name of your class that you're extending with.
}
}
?>
Thank you, Daniel. Your help is greatly appreciated.
Question wouldn't the correct path for Post.php be this?
library/Andy/ChangeDate/Listeners/ControllerPublic/Post.php
PHP:<?php class Andy_ChangeDate_Listeners_ControllerPublic { public static function Post($class, &$extend) { if ($class == 'XenForo_ControllerPublic_Post') #make this match the event hint, this will allow it to work on 1.1 also. $extend[] = 'Andy_ChangeDate_ControllerPublic_Post'; #this is the name of your class that you're extending with. } } ?>
If it's a listener, it's recommended to go in /addon/listener/type.php (not literal), if it's a controller file for the public it goes in /addon/ControllerPublic/file.php (not literal). Make sense?
<?php
class Andy_ChangeDate_Listeners_ControllerPublic
{
public static function Post($class, &$extend)
{
if ($class == 'XenForo_ControllerPublic_Post') #make this match the event hint, this will allow it to work on 1.1 also.
$extend[] = 'Andy_ChangeDate_ControllerPublic_Post'; #this is the name of your class that you're extending with.
}
}
?>
Its in the wrong path. Refer to my previous explanation.
The code I gave you is for the Listener.My problem is I have no idea if I'm creating a listener or controller file.
What I have done so far is to create a file here:
library/Andy/ChangeDate/ControllerPublic/Post.php
The contents are:
PHP:<?php class Andy_ChangeDate_Listeners_ControllerPublic { public static function Post($class, &$extend) { if ($class == 'XenForo_ControllerPublic_Post') #make this match the event hint, this will allow it to work on 1.1 also. $extend[] = 'Andy_ChangeDate_ControllerPublic_Post'; #this is the name of your class that you're extending with. } } ?>
What am I creating? Is it a listener or controller file?
<?php
class Andy_ChangeDate_Listener
{
public static function Post($class, &$extend)
{
$extend[] = 'Andy_ChangeDate_ControllerPublic_Post';
}
?>
<?php
class Andy_ChangeDate_Listener
{
public static function Post($class, &$extend)
{
ZEND_DEBUG::dump("This listener is executed");break;
//$extend[] = 'Andy_ChangeDate_ControllerPublic_Post';
}?>
Summary:
1. Create library/Andy/ChangeDate/Listener.php as in #56
2. Setup the addon with this data:
Listen to event: load_class_controller
Execute Callback: Andy_ChangeDate_Listener
Event Hint: XenForo_ControllerPublic_Post
<?php
class Andy_ChangeDate_Listener
{
public static function Post($class, array &$extend)
{
$extend[] = 'Andy_ChangeDate_ControllerPublic_Post';
}
}
We use essential cookies to make this site work, and optional cookies to enhance your experience.