Hook don´t fire



Hey @everybody,

I am a newcomer and have a litte problem with my own app. I want to fire a hook, that add a LDAP user to his LDAP shared group folder. This is what I want at the end. For the first testing I only want that the hook create a log-file when I create an user in the backend. But it didn´t work and I didn´t get any errors. I created the hook as desribet in the development manual:


And this is the code that I had created:
namespace OCA\LdapFolder\AppInfo;

$app = new Application();

//\OCP\Util::connectHook('OC_User', 'post_createUser', 'OCA\LdapFolder\Hooks\LdapHooks', 'LdapHooks');

namespace OCA\LdapFolder\AppInfo;

use \OCP\AppFramework\App;

use \OCA\LdapFolder\Hooks\LdapHooks;

class Application extends App {

	public function __construct(array $urlParams=array()){
		parent::__construct('ldapfolder', $urlParams);

		$container = $this->getContainer();

		 * Controllers
		$container->registerService('LdapHooks', function($c) {
			return new LdapHooks(

namespace OCA\LdapFolder\Hooks;

class LdapHooks {

	private $userManager;

	public function __construct($userManager){
		$this->userManager = $userManager;

	public function register() {
		$callback = function($user) {
			$file=fopen("test.txt", "a");
			fwrite($file, 'it is working' . $user);
		$this->userManager->listen('\OC\User', 'postCreateUser', $callback);


I hope that I made only a little mistake, or that I understand something wronge.

Thank you for your help

Best Regards


Hey there,

I have a similar problem, using ownCloud 10.

Anyone any idea on how to do it right?


For reference: Topic „Filesystem hooks don't fire