Overwrite public function in


Well-known member
To overwrite private function protected static function _getDefaultAvatarUrl() my plan is to overwrite the public function public static function getAvatarUrl() that uses the private one exclusively.*

How could I overwrite the public function? My addon listens on load_class_model and once the class is XenForo_Template_Helper_Core where the public function is located I extend that to my personal Core.php:
class MyAddon_Core extends XFCP_MyAddon_Core
public static function getAvatarUrl(array $user, $size, $forceType = '')
{  return ''; }
I want to disable all avatars with this test, however everything works as usual. Any ideas?

(* with the exception of gravatar functionality I disabled)

Similar thread: http://xenforo.com/community/thread...-class-and-override-protected-function.25889/


Well-known member
In library/config.php add:
After need copy library/XenForo/Template/Helper/Core.php to library/Proxy/XenForo/Template/Helper/Core.php and change code as you want. In runtime will be used class from proxy.
It work without extending original class.


Well-known member
This is a great idea. However I want to make the changes as small as possible. The class Core.php is rather huge and I would very much prefer to only manipulate what I really have to change.