Changeset 214456
- Timestamp:
- 03/07/2010 03:00:47 AM (16 years ago)
- Location:
- cross-registration-integration
- Files:
-
- 5 added
- 2 edited
-
tags/1.1 (added)
-
tags/1.1/GNU General Public License.txt (added)
-
tags/1.1/cross-registration-integration.php (added)
-
tags/1.1/readme.txt (added)
-
tags/1.1/screenshot-1.jpg (added)
-
trunk/cross-registration-integration.php (modified) (5 diffs)
-
trunk/readme.txt (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
cross-registration-integration/trunk/cross-registration-integration.php
r213321 r214456 4 4 Plugin URI: http://www.gkauten.com/cross-registration-integration 5 5 Description: Integrates with the WordPress registration process to assist with the registration process for other systems. Meaning, this plugin will simultaneously transmit the user's information entered in to your WordPress registration page to a URL you specify which can then handle creating a duplicate user account within your other systems on your website. 6 Version: 1. 06 Version: 1.1 7 7 Author: GKauten 8 8 Author URI: http://www.gkauten.com … … 26 26 */ 27 27 28 // Used to Define WordPress or BuddyPress in Certain Functions 28 29 global $cri_system; 29 30 … … 408 409 } 409 410 } 411 412 // Check for Extra Profile Fields 413 if(!empty( $_POST['signup_profile_field_ids'])) { 414 $profile_field_ids = explode( ',', $_POST['signup_profile_field_ids'] ); 415 // Loop through the posted fields formatting any datebox values then add to $data 416 $data = ""; 417 foreach((array) $profile_field_ids as $field_id) { 418 if(!isset($_POST['field_' . $field_id])) { 419 if(isset($_POST['field_' . $field_id . '_day'])) { 420 $_POST['field_' . $field_id] = strtotime($_POST['field_' . $field_id . '_day'] . $_POST['field_' . $field_id . '_month'] . $_POST['field_' . $field_id . '_year']); 421 } 422 } 423 $data .= "field_" . $field_id . "=" . $_POST['field_' . $field_id] . "&"; 424 } 425 } 410 426 411 427 // Transmit Information 412 cri_cross_register($user_login, $user_email, $user_pass );428 cri_cross_register($user_login, $user_email, $user_pass, $data); 413 429 } 414 430 … … 422 438 /************************************/ 423 439 424 function cri_cross_register($user_login, $user_email, $user_pass ) {440 function cri_cross_register($user_login, $user_email, $user_pass, $data = null) { 425 441 global $cri_system; 426 442 … … 453 469 454 470 // Begin Cross Registration 455 $params = array( 456 $username_as => $user_login, 457 $email_as => $user_email, 458 $password_as => $user_pass 459 ); 460 471 $params = ""; 472 $params .= $username_as . "=" . $user_login . "&"; 473 $params .= $email_as . "=" . $user_email . "&"; 474 $params .= $password_as . "=" . $user_pass . "&"; 475 476 // Add Extra Data Fields 477 if($data) { 478 $params .= $data; 479 } 480 481 // Add Special Parameters 461 482 if(get_option("cri_special_params") != "") { 462 if(strstr(get_option("cri_special_params"), "&")) { 463 // Found "&" - Assuming Multiple Keys 464 $fields = explode('&', get_option("cri_special_params")); 465 if(count($fields)) { 466 $field_set = array(); 467 foreach($fields as $field) { 468 $field_set = explode("=", $field); 469 $params[$field_set[0]] = $field_set[1]; 470 } 471 } 472 } else { 473 // No "&" but Content Found - Assuming One Key 474 $field_set = explode("=", get_option("cri_special_params")); 475 $params[$field_set[0]] = $field_set[1]; 476 } 477 } 478 479 $r = cri_post(get_option("cri_transurl"), $params); 480 } 481 482 /************************************/ 483 /* Post Registration Method */ 484 /************************************/ 485 486 function cri_post($url, $fields) { 487 return cri_request(true, $url, $fields); 488 } 489 490 /************************************/ 491 /* Request Registration Method */ 492 /************************************/ 493 494 function cri_request($post, $url, $fields) { 495 $postfields = array(); 496 if(count($fields)) { 497 foreach($fields as $i => $f) { 498 $postfields[] = urlencode($i) . '=' . urlencode($f); 499 } 500 } 501 $fields = implode('&', $postfields); 502 return cri_http($post ? 'POST' : 'GET', $url, $fields); 503 $ch = curl_init($url); 504 $ck = array(); 505 $headers = array("User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11", "Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5", "Accept-Language: en-us,en;q=0.5", "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7", "Keep-Alive: 300", "Connection: keep-alive"); 506 curl_setopt($ch, CURLOPT_TIMEOUT, 5); 507 if($post) { 508 curl_setopt($ch, CURLOPT_POST, true); 509 $postfields = array(); 510 if(count($fields)) { 511 foreach($fields as $i => $f) { 512 $postfields[] = urlencode($i) . '=' . urlencode($f); 513 } 514 } 515 $fields = implode('&', $postfields); 516 curl_setopt($ch, CURLOPT_POSTFIELDS, $fields); 517 $headers[] = "Content-Type: application/x-www-form-urlencoded"; 518 $headers[] = "Content-Length: " . strlen($fields); 519 } 520 curl_setopt($ch, CURLOPT_HEADER, $this->headers); 521 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 522 curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); 523 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); 524 $res = curl_exec($ch); 525 curl_close($ch); 526 return $res; 527 } 528 529 /************************************/ 530 /* Registration Process Hooks */ 531 /************************************/ 532 533 function cri_http($method, $url, $data = null) { 534 preg_match('~http://([^/]+)(/.*)~', $url, $subs); 535 $host = $subs[1]; 536 $uri = $subs[2]; 537 $header .= "$method $uri HTTP/1.1\r\n"; 538 $header .= "Host: $host\r\n"; 539 $header .= "Content-Type: application/x-www-form-urlencoded\r\n"; 540 $header .= "Content-Length: " . strlen($data) . "\r\n\r\n"; 541 $fp = fsockopen ($host, 80, $errno, $errstr, 30); 542 if($fp) { 543 fputs($fp, $header . $data); 544 $result = ''; 545 while(!feof($fp)) $result .= fgets($fp, 4096); 546 } 547 fclose($fp); 548 return $result; 483 $params .= get_option("cri_special_params"); 484 } 485 486 $r = cri_http(get_option("cri_transurl") . "?" . $params); 487 } 488 489 /************************************/ 490 /* Registration Post Process */ 491 /************************************/ 492 493 function cri_http($url) { 494 $params = array('http' => array( 495 'method' => 'post', 496 'content' => strstr($url, "?") 497 )); 498 499 $ctx = stream_context_create($params); 500 $fp = @fopen($url, 'rb', false, $ctx); 501 502 if (!$fp) { 503 exit("Problem with $url, $php_errormsg"); 504 } 505 506 $response = @stream_get_contents($fp); 507 508 if ($response === false) { 509 exit("Problem reading data from $url, $php_errormsg"); 510 } 511 512 return $response; 549 513 } 550 514 -
cross-registration-integration/trunk/readme.txt
r213323 r214456 5 5 Requires at least: 2.8.6 6 6 Tested up to: 2.9.2 7 Stable tag: 1. 07 Stable tag: 1.1 8 8 9 9 Integrates with the WordPress registration process to assist with the registration process for other systems. … … 20 20 triggering external functions. 21 21 22 As of version 1.0, Cross Registration Integration is enabled to work with BuddyPress sites as well. Upon enabling22 Version 1.0 is now enabled to work with BuddyPress sites allowing you to maintain the same functionality. Upon enabling 23 23 the plugin, there will be a new set of options within the plugin administration panel allowing you to choose which 24 24 fields are transmitted to the Transaction URL once a user completes the BuddyPress controlled registration page. 25 26 Version 1.1 introduces one new feature and an enhancement to an existing feature. The amount of delay that was 27 previously experienced while waiting for the call to the Transaction URL has been optimized to only add an 28 additional second or two to the overall load time. As for new features, on BuddyPress installations the profile 29 fields will now also be passed along. However, because of the dynamic nature of these fields there is not a 30 feasible way to assign new names to them as they pass so they will maintain their original form names (i.e - 31 field_1, field_2, etc... going down as an ordered list). 25 32 26 33 If you find this plugin useful, please donate. Donations help pay for the massive amount of energy drinks … … 59 66 == Changelog == 60 67 68 = 1.1 = 69 * Reduced the amount of time required to process the Transaction URL transmission on registration. 70 * Added BuddyPress Profile fields to the Transaction URL transmission on registration. 71 61 72 = 1.0 = 62 73 * Added support for the BuddyPress social networking plugin. … … 78 89 == Upgrade Notice == 79 90 91 = 1.1 = 92 This version reduces the amount of time required to process the Transaction URL transmission on registration and includes the Profile fields for BuddyPress installations. 93 80 94 = 1.0 = 81 95 This version added support for the BuddyPress social networking plugin and a new special parameters field.
Note: See TracChangeset
for help on using the changeset viewer.