Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

jaruzelskee on "Saving email-adress to other DB than WP while registering"

$
0
0

I'm trying to save an user email to separate DB while registering and I'm modifying wp-includes/user.php file but I can't make it work.
I will be grateful for your help.

line 1394:

<?php
if ( $update ) {
		$wpdb->update( $wpdb->users, $data, compact( 'ID' ) );
		$user_id = (int) $ID;
	} else {
		$wpdb->insert( $wpdb->users, $data + compact( 'user_login' ) );
		$user_id = (int) $wpdb->insert_id;

	mysql_close($connect);

		$hostname = 'xxx.xxx.xxx';
		$dbname   = 'xxx_xxx';
		$username = 'xxx';
		$password = 'xxx';             

		$new_connect = mysql_connect($hostname, $username, $password) or DIE('Connection to host is failed, perhaps the service is down!');
		mysql_select_db($dbname) or DIE('Database name is not available!');
		mysql_query("SET NAMES 'utf8'");

		$result = mysql_query("SELECT * FROM user WHERE user_email = '$user_email'");
		$num_rows = mysql_num_rows($result);

		if ($num_rows = 0)
		{
		 $qry = "INSERT INTO user (user_email,user_registered) VALUES ('$user_email','$date')";
		}
		mysql_close($new_connect);

	$hostname = 'xxx.xxx.xxx';
	$dbname   = 'xxx_xxx';
	$username = 'xxx';
	$password = 'xxx';              

	$connect = mysql_connect($hostname, $username, $password) or DIE('Connection to host is failed, perhaps the service is down!');
	mysql_select_db($dbname) or DIE('Database name is not available!');
	mysql_query("SET NAMES 'utf8'");

	}

?>

Viewing all articles
Browse latest Browse all 8245

Trending Articles