Index: trunk/xpressme_integration_kit/include/old_template-loader.php
===================================================================
--- trunk/xpressme_integration_kit/include/old_template-loader.php	(revision 252)
+++ trunk/xpressme_integration_kit/include/old_template-loader.php	(revision 252)
@@ -0,0 +1,67 @@
+<?php
+if ( defined('WP_USE_THEMES') && constant('WP_USE_THEMES') ) {
+	do_action('template_redirect');
+	if ( is_feed() ) {
+		include(ABSPATH . '/wp-feed.php');
+		return;
+	} else if ( is_trackback() ) {
+		include(ABSPATH . '/wp-trackback.php');
+		return;
+	} else if ( is_404() && $template = get_404_template() ) {
+		include($template);
+		return;
+	} else if ( is_search() && $template = get_search_template() ) {
+		include($template);
+		return;
+	} else if ( is_home() && $template = get_home_template() ) {
+		include($template);
+		return;
+	} else if ( is_attachment() && $template = get_attachment_template() ) {
+		include($template);
+		return;
+	} else if ( is_single() && $template = get_single_template() ) {
+		if ( is_attachment() )
+			add_filter('the_content', 'prepend_attachment');
+		include($template);
+		return;
+	} else if ( is_page() && $template = get_page_template() ) {
+		if ( is_attachment() )
+			add_filter('the_content', 'prepend_attachment');
+		include($template);
+		return;
+	} else if ( is_category() && $template = get_category_template()) {
+		include($template);
+		return;		
+	} else if ( is_author() && $template = get_author_template() ) {
+		include($template);
+		return;
+	} else if ( is_date() && $template = get_date_template() ) {
+		include($template);
+		return;
+	} else if ( is_archive() && $template = get_archive_template() ) {
+		include($template);
+		return;
+	} else if ( is_comments_popup() && $template = get_comments_popup_template() ) {
+		include($template);
+		return;
+	} else if ( is_paged() && $template = get_paged_template() ) {
+		include($template);
+		return;
+	} else if ( file_exists(TEMPLATEPATH . "/index.php") ) {
+		if ( is_attachment() )
+			add_filter('the_content', 'prepend_attachment');
+		include(TEMPLATEPATH . "/index.php");
+		return;
+	}
+} else {
+	// Process feeds and trackbacks even if not using themes.
+	if ( is_feed() ) {
+		include(ABSPATH . '/wp-feed.php');
+		return;
+	} else if ( is_trackback() ) {
+		include(ABSPATH . '/wp-trackback.php');
+		return;
+	}
+}
+
+?>
Index: trunk/xpressme_integration_kit/include/oninstall.php
===================================================================
--- trunk/xpressme_integration_kit/include/oninstall.php	(revision 247)
+++ trunk/xpressme_integration_kit/include/oninstall.php	(revision 252)
@@ -126,4 +126,7 @@
 	$pass_md5 = is_object($GLOBALS["xoopsUser"])?$GLOBALS["xoopsUser"]->getVar("pass"):'';
 	
+	if (!function_exists('username_exists')){
+		require_once($mydirpath . '/wp-includes/registration-functions.php');
+	}
 	$user_id = username_exists($user_name);
 	if ( !$user_id ) {
@@ -150,5 +153,10 @@
 	if (!$xoops_config->is_wpmu){	// for WordPress 
 		// make WordPress Default data	
-		wp_install_defaults($user_id);
+		if (function_exists('wp_install_defaults')){
+			wp_install_defaults($user_id);
+		} else {
+			wp_install_old_defaults($user_id);
+		}
+		
 		$ret[] = 'The first sample post & comment was written.';
 		
@@ -210,3 +218,36 @@
 endif;
 
+if( ! function_exists( 'wp_install_old_defaults' ) ) :
+function wp_install_old_defaults($user_id) {
+	global $wpdb;
+
+	// Now drop in some default links
+	$wpdb->query("INSERT INTO $wpdb->linkcategories (cat_id, cat_name) VALUES (1, '".$wpdb->escape(__('Blogroll'))."')");
+	$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://blogs.linux.ie/xeer/', 'Donncha', 1, 'http://blogs.linux.ie/xeer/feed/', '');");
+	$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://zengun.org/weblog/', 'Michel', 1, 'http://zengun.org/weblog/feed/', '');");
+	$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://boren.nu/', 'Ryan', 1, 'http://boren.nu/feed/', '');");
+	$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://photomatt.net/', 'Matt', 1, 'http://xml.photomatt.net/feed/', '');");
+	$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://zed1.com/journalized/', 'Mike', 1, 'http://zed1.com/journalized/feed/', '');");
+	$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://www.alexking.org/', 'Alex', 1, 'http://www.alexking.org/blog/wp-rss2.php', '');");
+	$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://dougal.gunters.org/', 'Dougal', 1, 'http://dougal.gunters.org/feed/', '');");
+
+	// Default category
+	$wpdb->query("INSERT INTO $wpdb->categories (cat_ID, cat_name, category_nicename, category_count, category_description) VALUES ('0', '".$wpdb->escape(__('Uncategorized'))."', '".sanitize_title(__('Uncategorized'))."', '1', '')");
+
+	// First post
+	$now = date('Y-m-d H:i:s');
+	$now_gmt = gmdate('Y-m-d H:i:s');
+	$wpdb->query("INSERT INTO $wpdb->posts (post_author, post_date, post_date_gmt, post_content, post_excerpt, post_title, post_category, post_name, post_modified, post_modified_gmt, comment_count, to_ping, pinged, post_content_filtered) VALUES ('1', '$now', '$now_gmt', '".$wpdb->escape(__('Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!'))."', '', '".$wpdb->escape(__('Hello world!'))."', '0', '".$wpdb->escape(__('hello-world'))."', '$now', '$now_gmt', '1', '', '', '')");
+
+	$wpdb->query( "INSERT INTO $wpdb->post2cat (`rel_id`, `post_id`, `category_id`) VALUES (1, 1, 1)" );
+
+	// Default comment
+	$wpdb->query("INSERT INTO $wpdb->comments (comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_date, comment_date_gmt, comment_content) VALUES ('1', '".$wpdb->escape(__('Mr WordPress'))."', '', 'http://wordpress.org/', '$now', '$now_gmt', '".$wpdb->escape(__('Hi, this is a comment.<br />To delete a comment, just log in and view the post&#039;s comments. There you will have the option to edit or delete them.'))."')");
+
+	// First Page
+
+	$wpdb->query("INSERT INTO $wpdb->posts (post_author, post_date, post_date_gmt, post_content, post_excerpt, post_title, post_category, post_name, post_modified, post_modified_gmt, post_status, to_ping, pinged, post_content_filtered) VALUES ('1', '$now', '$now_gmt', '".$wpdb->escape(__('This is an example of a WordPress page, you could edit this to put information about yourself or your site so readers know where you are coming from. You can create as many pages like this one or sub-pages as you like and manage all of your content inside of WordPress.'))."', '', '".$wpdb->escape(__('About'))."', '0', '".$wpdb->escape(__('about'))."', '$now', '$now_gmt', 'static', '', '', '')");
+}
+endif;
+
 ?>
Index: trunk/xpressme_integration_kit/include/onupdate.php
===================================================================
--- trunk/xpressme_integration_kit/include/onupdate.php	(revision 247)
+++ trunk/xpressme_integration_kit/include/onupdate.php	(revision 252)
@@ -27,4 +27,5 @@
 //XPressME Update
 	global $wpdb,$wp_rewrite, $wp_queries, $table_prefix, $wp_db_version, $wp_roles,$wp_query;
+	global $xoops_db;
 	define('WP_INSTALLING', true);
 	$mydirpath = XOOPS_ROOT_PATH . '/modules/' . $mydirname;
@@ -48,6 +49,6 @@
 	
 	$site_url= XOOPS_URL."/modules/".$mydirname;		
-	update_option("home", $site_url);				// Site_url is set again. 
-	update_option("siteurl", $site_url);
+	xpress_put_siteurl($mydirname,$site_url);				// Site_url is set again. 
+	update_option("home", $site_url);
 
 	require_once($mydirpath . '/wp-admin/upgrade-functions.php');
