• Resolved wassereimer

    (@wassereimer)


    Hi,

    i′m writing a plugin. But i have a problem with the install routine.

    When i want to activate the plugin, i get the error “Das Plugin kann nicht aktiviert werden, da es einen fatalen Fehler erzeugt.” that means “The plugin cannot be activated. It caused a fatal error.”

    But i see no error message.
    I′ve tried a lot.

    // multiside installation
    function ecp_activate($networkwide) {
    	global $wpdb;
    	if (function_exists('is_multisite') && is_multisite()) {
    		if ($networkwide) {
    			$old_blog = $wpdb->blogid;
    			$blogids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
    			foreach ($blogids as $blog_id) {
    				switch_to_blog($blog_id);
    				ecp_install();
    			}
    			switch_to_blog($old_blog);
    			return;
    		}
    	}
    // single installation
      ecp_install();
    }
    
    // install function
    function ecp_install(){
    	global $wpdb;
    	$ecp_table = "CREATE TABLE IF NOT******and so on*****
    	$wpdb->query($ecp_table);
    }
    
    register_activation_hook( __FILE__, 'ecp_activate' );

    Whats wrong?

    Best regards

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator bcworkz

    (@bcworkz)

    Have you checked the PHP error logs? If you define WP_DEBUG as true on wp-config.php, you should be able to see error messages in your browser.

    Thread Starter wassereimer

    (@wassereimer)

    WP_DEBUG is of course set to true. But getting no error messeges…
    The error log does not have informations about this error.

    Thread Starter wassereimer

    (@wassereimer)

    Ok, now i don′t get the error…. But the table is not created until installation… -.-

    Thread Starter wassereimer

    (@wassereimer)

    Found the problem…. -.- There was two mistakes. First i forgot to delete the

    if ( !defined( 'WP_UNINSTALL_PLUGIN' ) )
        exit();

    Code in a included file (This was the fatal error without message) and there was a path related problem to a file…

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘register_activation_hook’ is closed to new replies.