register_activation_hook problem
-
Hi, I have been getting the following message everyytime I try to activate my plugin:
Fatal error: Cannot redeclare phpbb3_integration_activate() (previously declared in /home/tyler/tylerc.org/area51/wordpress/wp-content/plugins/phpbb3.php:29) in /home/tyler/tylerc.org/area51/wordpress/wp-content/plugins/phpbb3.php on line 64
Here is my code:
<?php /* Plugin Name: phpBB3 Integration Description: Integrates phpBB3 user database with WordPress user database. Version: 1.0 Author: Tyler Cassidy Author URI: https://www.tylerc.org/ */ // Path to phpBB3 and WordPress directories $phpbb3_path = '/home/tyler/http/area51/phpBB3/'; $wp_path = '/home/tyler/http/area51/wordpress/'; // Include phpBB3 / WordPress config file include $wp_path . 'wp-config.php'; include $phpbb3_path . 'config.php'; $phpbb3_db = array( 'host' => $dbhost, 'user' => $dbuser, 'passwd' => $dbpasswd, 'name' => $dbname, 'prefix' => $table_prefix ); // Plugin Activation Function and hook function phpbb3_integration_activate() { global $phpbb3_db; global $wpdb; $wp_table = $wpdb->prefix . 'users'; $phpbb3_table = $phpbb3_db['prefix'] . 'users'; $wp_sql = "SHOW TABLE STATUS FROM " . DB_NAME . " LIKE '" . $wp_table . "'"; $phpbb3_sql = "SHOW TABLE STATUS FROM " . $phpbb3_db['name'] . " LIKE '" . $phpbb3_table . "'"; $wp_con = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } $result = $wp_con->query($wp_sql); $row = $result->fetch_array(MYSQLI_ASSOC); $wp_insert_id = $row['Auto_increment']; $result->close(); $phpbb3_con = new mysqli($phpbb3_db['host'], $phpbb3_db['user'], $phpbb3_db['passwd'], $phpbb3_db['name']); if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } $result = $phpbb3_con->query($phpbb3_sql); $row = $result->fetch_array(MYSQLI_ASSOC); $phpbb3_insert_id = $row['Auto_increment']; $result->close(); if ($wp_insert_id < $phpbb3_insert_id) $wp_con->query("ALTER TABLE " . $wp_table . " AUTO_INCREMENT = " . $phpbb3_insert_id); if ($wp_insert_id > $phpbb3_insert_id) $phpbb3_con->query("ALTER TABLE " . $phpbb3_table . " AUTO_INCREMENT = " . $wp_insert_id); $wp_con->close(); $phpbb3_con->close(); } register_activation_hook(__FILE__, 'phpbb3_integration_activate'); ?>
Would anyone happen to have any idea what is going on?
-Tyler
- The topic ‘register_activation_hook problem’ is closed to new replies.