• Resolved chriscb65

    (@chriscb65)


    That’s weird… I must the XXXth to post a question about this damn register_activation_hook. My problem is quite strange, the activation hook didn’t trigger if I don’t finish my method with and exit() ( and exit() is firing an error…)

    This code doesn’t work :

    in file wppc_deck_admin.php

    class wppc_deck_admin {
        public function __construct() {
        }
    
        public function install() {
          global $dfd;
    
          wppcLog($dfd, "Installation du plugins");
          //
          // @mkdir(WPPC_GALLERY_PATH.'cache', 02775, true);
          // @mkdir(WPPC_GALLERY_PATH.'original', 02777, true);
          //
          // chmod(WPPC_GALLERY_PATH.'cache', 02777);
          // chmod(WPPC_GALLERY_PATH.'original', 02777);
          //
          // wppcLog($dfd, "Src : ".WPPC_ABSPATH."medias/default.jpg\nDst : ".WPPC_GALLERY_PATH."original");
          // copy(WPPC_ABSPATH."medias/default.jpg", WPPC_GALLERY_PATH."original/default.jpg");
          //
          // $this->createTables();
        }
      }

    And this one work but trigger an error (due to the exit)

    public function install() {
          global $dfd;
    
          wppcLog($dfd, "Installation du plugins");
          //
          // @mkdir(WPPC_GALLERY_PATH.'cache', 02775, true);
          // @mkdir(WPPC_GALLERY_PATH.'original', 02777, true);
          //
          // chmod(WPPC_GALLERY_PATH.'cache', 02777);
          // chmod(WPPC_GALLERY_PATH.'original', 02777);
          //
          // wppcLog($dfd, "Src : ".WPPC_ABSPATH."medias/default.jpg\nDst : ".WPPC_GALLERY_PATH."original");
          // copy(WPPC_ABSPATH."medias/default.jpg", WPPC_GALLERY_PATH."original/default.jpg");
          //
          // $this->createTables();
          exit();
        }

    And here is the register_activation_hook in the main file :

    if (is_admin()) {
    
            require_once(WPPC_ABSPATH."class/wppc_deck.admin.class.php");
            wppcLog($dfd, "Just before activation hook");
    
            $wppcDeck = new wppc_deck_admin();
            register_activation_hook( __FILE__, array(&$wppcDeck, 'install'));
    
    }

    I really don’t understand what is happening

    With the second piece of code, the install method is called and with the first one, nothing happened ( but the plugins is activated ).

    I really need helk..

Viewing 1 replies (of 1 total)
  • Thread Starter chriscb65

    (@chriscb65)

    I think I’ve found where my problem come from : the responsable is my debug file descriptor $dfd (defined in another file)… I think this var is used somewhere else in wordpress.

Viewing 1 replies (of 1 total)
  • The topic ‘register_activation_hook … again’ is closed to new replies.