.
*******************************************************************************/
if( !class_exists( 'WP_Http' ) ) include_once( ABSPATH . WPINC. '/class-http.php' );
/**
*
*/
class ASException extends Exception {
}
/**
*
*/
class AgentStorm {
/**
* Register the Custom CSS Styles and Javascript used on the Admin pages
*/
function adminInit() {
wp_register_script('AgentStormJqueryUI', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/jquery-ui.min.js', array('jquery'));
wp_register_style('AgentStormDefault', WP_PLUGIN_URL . DIRECTORY_SEPARATOR . array_pop(explode('/', dirname(__FILE__))) . '/static/css/default.css');
wp_register_style('AgentStormJqueryUI', WP_PLUGIN_URL . DIRECTORY_SEPARATOR . array_pop(explode('/', dirname(__FILE__))) . '/static/css/custom.css');
wp_enqueue_style('AgentStormDefault');
wp_enqueue_script("thickbox");
$this->detectSEOPlugins();
}
/**
* Register the Admin Menu Item and add the action to load the admin styles when the page is requested
*/
function adminRegisterMenu() {
$page = add_menu_page('Agent Storm', 'Agent Storm', 'administrator', __FILE__, array(&$this, 'displayAdmin'), WP_PLUGIN_URL . DIRECTORY_SEPARATOR . array_pop(explode('/', dirname(__FILE__))) . '/static/images/icon.png');
add_action('admin_print_styles-' . $page, array($this, 'adminLoadStyles'));
}
/**
* Adds the easy insert buttons to the Add Post and Add Page Toolbars
*/
function adminFooter() {
include dirname(__FILE__) . DIRECTORY_SEPARATOR . 'agentstorm_admin_footer.php';
}
/**
* Enqueue the CSS and Javascript used on the admin pages to be loaded.
*/
function adminLoadStyles() {
// Unregister built-in jquery scripts
//
wp_deregister_script('jquery-ui-core'); #wp
wp_deregister_script('jquery-ui-sortable'); #wp
wp_deregister_script('jquery-ui-tabs'); #wp
// Load new scripts
//
wp_enqueue_script("AgentStormJqueryUI");
wp_enqueue_style('AgentStormJqueryUI');
}
/**
* Detect various free SEO Plugins and check they are correctly configured to
* not process generated idx plugins
*/
function detectSEOPlugins() {
// If All In One SEO Pack is detected lets check we are configured not to
// process generate IDX pages
//
if (class_exists('All_in_One_SEO_Pack')) {
$aioseop = get_option('aioseop_options', array());
if (array_key_exists('aiosp_ex_pages', $aioseop)) {
$match = false;
foreach (explode(',', $aioseop['aiosp_ex_pages']) as $item) {
if (!empty($item) && substr(get_option('as_idx_propertyprefix'), 0, strlen($item)) == $item) {
$match = true;
}
}
if (!$match) {
wp_cache_set('agentstorm_admin_notice', 'StormRETS All In One SEO Pack was detected but does not appear to be correctly configured for use with Agent Storm. Search Engine Optimization may be compromized as a result. For more information see http://www.stormrets.com/faqs/wordpress/wordpress-seo-plugin-compatibility');
add_action( 'admin_notices', array(&$this, 'displayAdminNotices'));
}
}
}
}
function displayAdminNotices() {
echo '
' . wp_cache_get('agentstorm_admin_notice') . '
';
}
/**
* Enqueue the CSS and Javascript used on the IDX pages
*/
function loadSiteStyles() {
// Require jQuery
//
wp_enqueue_script("jquery");
// Register the Javascript files
//
wp_register_script('GoogleMaps', 'http://maps.google.com/maps/api/js?sensor=false®ion=US');
wp_register_script('AgentStormMaps', 'http://www.stormrets.com/javascripts/maps/loader.js', array('jquery'));
wp_register_script('AgentStormUndercover', WP_PLUGIN_URL . DIRECTORY_SEPARATOR . array_pop(explode('/', dirname(__FILE__))) . '/static/js/jquery.undercover.js', array('jquery'));
// Register the Site Default Styles
//
wp_register_style('AgentStormSite', WP_PLUGIN_URL . DIRECTORY_SEPARATOR . array_pop(explode('/', dirname(__FILE__))) . '/static/css/site.css');
wp_register_style('AgentStormSiteRed', WP_PLUGIN_URL . DIRECTORY_SEPARATOR . array_pop(explode('/', dirname(__FILE__))) . '/static/css/site-red.css');
wp_register_style('AgentStormSiteBlue', WP_PLUGIN_URL . DIRECTORY_SEPARATOR . array_pop(explode('/', dirname(__FILE__))) . '/static/css/site-blue.css');
wp_register_style('AgentStormSiteGrey', WP_PLUGIN_URL . DIRECTORY_SEPARATOR . array_pop(explode('/', dirname(__FILE__))) . '/static/css/site-grey.css');
wp_register_style('AgentStormSiteBrown', WP_PLUGIN_URL . DIRECTORY_SEPARATOR . array_pop(explode('/', dirname(__FILE__))) . '/static/css/site-brown.css');
// Add the correct built in stylesheets
//
switch (get_option('as_usestyle', '')) {
case '1':
wp_enqueue_style('AgentStormSite');
break;
case '2':
wp_enqueue_style('AgentStormSite');
wp_enqueue_style('AgentStormSiteRed');
break;
case '3':
wp_enqueue_style('AgentStormSite');
wp_enqueue_style('AgentStormSiteBlue');
break;
case '4':
wp_enqueue_style('AgentStormSite');
wp_enqueue_style('AgentStormSiteGrey');
break;
case '5':
wp_enqueue_style('AgentStormSite');
wp_enqueue_style('AgentStormSiteBrown');
break;
}
// Add the required Javascript files
//
wp_enqueue_script('AgentStormUndercover');
wp_enqueue_script('GoogleMaps');
wp_enqueue_script('AgentStormMaps');
wp_enqueue_script('thickbox');
// Add the CSS Files
//
wp_enqueue_style('thickbox.css', '/'.WPINC.'/js/thickbox/thickbox.css', null, '1.0');
}
/**
* Add various SEO headers such as the canonical link if we need to.
*/
function siteHead() {
if (wp_cache_get('agentstorm_canonical')) {
echo '';
}
}
/**
* Helper function to check if we have a valid API key and hostname
*/
function isConfigured() {
return (get_option('as_hostname', false) && get_option('as_apikey', false));
}
/**
* Display the Admin page used to configure the plug-in
*/
function displayAdmin() {
if (!empty($_POST)) {
$this->saveAdmin();
}
include dirname(__FILE__) . DIRECTORY_SEPARATOR . 'agentstorm_admin.php';
}
/**
* Called on Form Postback to save the admin settings
*/
function saveAdmin() {
$as = new AgentStormRequest(get_option('as_hostname'), get_option('as_apikey'));
// Save the Settings Variables
//
if (isset($_POST['as_settings_save'])) {
// Save the Options
//
if (isset($_POST['as_usestyle'])) {
update_option('as_usestyle', $_POST['as_usestyle']);
}
if (isset($_POST['as_hostname'])) {
if (substr($_POST['as_hostname'], -1) !== '/') {
update_option('as_hostname', $_POST['as_hostname'].'/');
} else {
update_option('as_hostname', $_POST['as_hostname']);
}
}
if (isset($_POST['as_pipelining'])) {
update_option('as_pipelining', true);
} else {
update_option('as_pipelining', false);
}
// Force and Update of the Cities database
//
$as_tags = $as->getTags();
update_option('as_tags', $as_tags->Tags);
// Force update of the Property Metadata
//
$as_metadata = $as->getPropertyMetaData();
update_option('as_metadata', $as_metadata->MetaData);
// If we have previously selected a tag and it does not exist in the current
// dataset (maybe we switched hostnames) then reset the flag.
//
if (get_option('as_idx_settings_tag', '') != '') {
$tag_exists = false;
foreach ($as_tags->Tags as $tag) {
if (get_option('as_idx_settings_tag', '') == $tag->Name) {
$tag_exists = true;
}
}
if (!$tag_exists) update_option('as_idx_settings_tag', '');
}
// Get the cities
//
update_option('as_cities', $as->getCities());
// Schedule the Cities and Tags caches to be refreshed hourly
//
agentstorm_hourly();
}
// Save the Contact Manager Settings
//
if (isset($_POST['as_contact_save'])) {
if (isset($_POST['as_contact_loginhook']) && !empty($_POST['as_contact_loginhook'])) {
update_option('as_contact_loginhook', true);
} else {
update_option('as_contact_loginhook', false);
}
if (isset($_POST['as_contact_emailnotification']) && !empty($_POST['as_contact_emailnotification'])) {
update_option('as_contact_emailnotification', true);
} else {
update_option('as_contact_emailnotification', false);
}
if (isset($_POST['as_contact_emaillogin']) && !empty($_POST['as_contact_emaillogin'])) {
update_option('as_contact_emaillogin', true);
} else {
update_option('as_contact_emaillogin', false);
}
if (isset($_POST['as_contact_emailregister']) && !empty($_POST['as_contact_emailregister'])) {
update_option('as_contact_emailregister', true);
} else {
update_option('as_contact_emailregister', false);
}
if (isset($_POST['as_contact_tags'])) {
update_option('as_contact_tags', $_POST['as_contact_tags']);
}
if (isset($_POST['as_contact_source'])) {
update_option('as_contact_source', $_POST['as_contact_source']);
}
if (isset($_POST['as_contact_lightbox_header'])) {
update_option('as_contact_lightbox_header', $_POST['as_contact_lightbox_header']);
}
}
// Save the IDX Data Settings
//
if (isset($_POST['as_idx_save'])) {
if (isset($_POST['as_idx_template_result'])) {
update_option('as_idx_template_result', $_POST['as_idx_template_result']);
}
if (isset($_POST['as_idx_template_property'])) {
update_option('as_idx_template_property', $_POST['as_idx_template_property']);
}
if (isset($_POST['as_idx_template_noresults'])) {
update_option('as_idx_template_noresults', $_POST['as_idx_template_noresults']);
}
if (isset($_POST['as_force_login']) && !empty($_POST['as_force_login'])) {
update_option('as_force_login', true);
} else {
update_option('as_force_login', false);
}
if (isset($_POST['as_requestshowing_button']) && !empty($_POST['as_requestshowing_button'])) {
update_option('as_requestshowing_button', true);
} else {
update_option('as_requestshowing_button', false);
}
if (isset($_POST['as_requestshowing_link'])) {
update_option('as_requestshowing_link', $_POST['as_requestshowing_link']);
} else {
update_option('as_requestshowing_link', '');
}
if (isset($_POST['as_idx_punctuation']) && !empty($_POST['as_idx_punctuation'])) {
update_option('as_idx_punctuation', $_POST['as_idx_punctuation']);
} else {
update_option('as_idx_punctuation', false);
}
if (isset($_POST['as_idx_linkstate']) && !empty($_POST['as_idx_linkstate'])) {
update_option('as_idx_linkstate', $_POST['as_idx_linkstate']);
} else {
update_option('as_idx_linkstate', false);
}
if (isset($_POST['as_idx_schools']) && !empty($_POST['as_idx_schools'])) {
update_option('as_idx_schools', $_POST['as_idx_schools']);
} else {
update_option('as_idx_schools', false);
}
if (isset($_POST['as_idx_gmap']) && !empty($_POST['as_idx_gmap'])) {
update_option('as_idx_gmap', true);
} else {
update_option('as_idx_gmap', false);
}
if (isset($_POST['as_idx_bview']) && !empty($_POST['as_idx_bview'])) {
update_option('as_idx_bview', true);
} else {
update_option('as_idx_bview', false);
}
if (isset($_POST['as_idx_walkscore'])) {
update_option('as_idx_walkscore', $_POST['as_idx_walkscore']);
}
if (isset($_POST['as_idx_searchtxt'])) {
update_option('as_idx_searchtxt', $_POST['as_idx_searchtxt']);
}
}
// Save the IDX Data Settings
//
if (isset($_POST['as_idx_settings_save'])) {
if (isset($_POST['as_idx_settings_field_type']) && !empty($_POST['as_idx_settings_field_type'])) {
update_option('as_idx_settings_field_type', true);
} else {
update_option('as_idx_settings_field_type', false);
}
if (isset($_POST['as_idx_settings_field_suburbzip']) && !empty($_POST['as_idx_settings_field_suburbzip'])) {
update_option('as_idx_settings_field_suburbzip', true);
} else {
update_option('as_idx_settings_field_suburbzip', false);
}
if (isset($_POST['as_idx_settings_field_subdivision']) && !empty($_POST['as_idx_settings_field_subdivision'])) {
update_option('as_idx_settings_field_subdivision', true);
} else {
update_option('as_idx_settings_field_subdivision', false);
}
if (isset($_POST['as_idx_settings_field_price']) && !empty($_POST['as_idx_settings_field_price'])) {
update_option('as_idx_settings_field_price', true);
} else {
update_option('as_idx_settings_field_price', false);
}
if (isset($_POST['as_idx_settings_field_bedrooms']) && !empty($_POST['as_idx_settings_field_bedrooms'])) {
update_option('as_idx_settings_field_bedrooms', true);
} else {
update_option('as_idx_settings_field_bedrooms', false);
}
if (isset($_POST['as_idx_settings_field_bathrooms']) && !empty($_POST['as_idx_settings_field_bathrooms'])) {
update_option('as_idx_settings_field_bathrooms', true);
} else {
update_option('as_idx_settings_field_bathrooms', false);
}
if (isset($_POST['as_idx_settings_field_lotsize']) && !empty($_POST['as_idx_settings_field_lotsize'])) {
update_option('as_idx_settings_field_lotsize', true);
} else {
update_option('as_idx_settings_field_lotsize', false);
}
if (isset($_POST['as_idx_settings_field_size']) && !empty($_POST['as_idx_settings_field_size'])) {
update_option('as_idx_settings_field_size', true);
} else {
update_option('as_idx_settings_field_size', false);
}
if (isset($_POST['as_idx_settings_field_shortsale']) && !empty($_POST['as_idx_settings_field_shortsale'])) {
update_option('as_idx_settings_field_shortsale', true);
} else {
update_option('as_idx_settings_field_shortsale', false);
}
if (isset($_POST['as_idx_settings_field_foreclosure']) && !empty($_POST['as_idx_settings_field_foreclosure'])) {
update_option('as_idx_settings_field_foreclosure', true);
} else {
update_option('as_idx_settings_field_foreclosure', false);
}
if (isset($_POST['as_idx_settings_classes_res']) && !empty($_POST['as_idx_settings_classes_res'])) {
update_option('as_idx_settings_classes_res', true);
} else {
update_option('as_idx_settings_classes_res', false);
}
if (isset($_POST['as_idx_settings_classes_com']) && !empty($_POST['as_idx_settings_classes_com'])) {
update_option('as_idx_settings_classes_com', true);
} else {
update_option('as_idx_settings_classes_com', false);
}
if (isset($_POST['as_idx_settings_classes_lnd']) && !empty($_POST['as_idx_settings_classes_lnd'])) {
update_option('as_idx_settings_classes_lnd', true);
} else {
update_option('as_idx_settings_classes_lnd', false);
}
if (isset($_POST['as_idx_settings_classes_mob']) && !empty($_POST['as_idx_settings_classes_mob'])) {
update_option('as_idx_settings_classes_mob', true);
} else {
update_option('as_idx_settings_classes_mob', false);
}
if (isset($_POST['as_idx_settings_classes_mfh']) && !empty($_POST['as_idx_settings_classes_mfh'])) {
update_option('as_idx_settings_classes_mfh', true);
} else {
update_option('as_idx_settings_classes_mfh', false);
}
if (isset($_POST['as_idx_settings_classes_rnt']) && !empty($_POST['as_idx_settings_classes_rnt'])) {
update_option('as_idx_settings_classes_rnt', true);
} else {
update_option('as_idx_settings_classes_rnt', false);
}
if (isset($_POST['as_idx_settings_classes_con']) && !empty($_POST['as_idx_settings_classes_con'])) {
update_option('as_idx_settings_classes_con', true);
} else {
update_option('as_idx_settings_classes_con', false);
}
if (isset($_POST['as_idx_settings_pagelimit'])) {
update_option('as_idx_settings_pagelimit', $_POST['as_idx_settings_pagelimit']);
}
if (isset($_POST['as_idx_settings_tag'])) {
if (get_option('as_idx_settings_tag') !== $_POST['as_idx_settings_tag']) {
update_option('as_idx_settings_tag', $_POST['as_idx_settings_tag']);
update_option('as_cities', $as->getCities());
}
}
}
// Save the Agent Information
//
if (isset($_POST['as_idx_agent_save'])) {
if (isset($_POST['as_idx_agent_name'])) {
update_option('as_idx_agent_name', $_POST['as_idx_agent_name']);
}
if (isset($_POST['as_idx_agent_phone'])) {
update_option('as_idx_agent_phone', $_POST['as_idx_agent_phone']);
}
if (isset($_POST['as_idx_agent_email'])) {
update_option('as_idx_agent_email', $_POST['as_idx_agent_email']);
}
if (isset($_POST['as_idx_agent_extra'])) {
update_option('as_idx_agent_extra', $_POST['as_idx_agent_extra']);
}
}
// Save the IDX Data Settings
//
if (isset($_POST['as_idx_permalinks_save'])) {
if (isset($_POST['as_idx_searchprefix'])) {
update_option('as_idx_searchprefix', $_POST['as_idx_searchprefix']);
}
if (isset($_POST['as_idx_propertyprefix'])) {
update_option('as_idx_propertyprefix', $_POST['as_idx_propertyprefix']);
}
if (isset($_POST['as_idx_stateurlprefix'])) {
update_option('as_idx_stateurlprefix', $_POST['as_idx_stateurlprefix']);
}
if (isset($_POST['as_idx_cityurlprefix'])) {
update_option('as_idx_cityurlprefix', $_POST['as_idx_cityurlprefix']);
}
}
// Save the Map Search Settings
//
if (isset($_POST['as_idx_mapsearch_save'])) {
if (isset($_POST['as_map_width'])) {
update_option('as_map_width', $_POST['as_map_width']);
}
if (isset($_POST['as_map_height'])) {
update_option('as_map_height', $_POST['as_map_height']);
}
if (isset($_POST['as_map_provider'])) {
update_option('as_map_provider', $_POST['as_map_provider']);
}
if (array_key_exists('as_map_lat', $_POST)) {
update_option('as_map_lat', $_POST['as_map_lat']);
}
if (array_key_exists('as_map_lng', $_POST)) {
update_option('as_map_lng', $_POST['as_map_lng']);
}
if (array_key_exists('as_map_zoom', $_POST)) {
update_option('as_map_zoom', $_POST['as_map_zoom']);
}
}
//
//
if (isset($_POST['as_install_templates'])) {
$this->installTemplates();
}
}
/**
* AJAX function that saves the display fields and their order
*/
function saveResultLayout() {
// Loop through the metadata and for each property type, if it has been passed, save the new order
//
foreach (get_option('as_metadata', array()) as $metadata) {
if (array_key_exists($metadata->id, $_POST)) {
update_option('as_metadata_' . $metadata->id . '_' . $_POST['target'], implode(',', $_POST[$metadata->id]));
foreach ($_POST[$metadata->id] as $field) {
if (!empty($_POST[$metadata->id . '_' . $field])) {
update_option('as_fields_' . $metadata->id . '_' . $field, $_POST[$metadata->id . '_' . $field]);
} else {
delete_option('as_fields_' . $metadata->id . '_' . $field);
}
}
}
}
}
function shortCodeBuilder() {
header('Content-Type: text/html');
include dirname(__FILE__) . DIRECTORY_SEPARATOR . 'agentstorm_shortcode_designer.php';
exit;
}
/**
* Install the default Templates
*/
function installTemplates() {
// Check if the default templates already exist
//
$exists = false;
$d = @dir(TEMPLATEPATH);
while (false !== ($entry = $d->read())) {
if (in_array($entry, array("agentstorm_result.php", "agentstorm_results.php", "agentstorm_noresults.php", "agentstorm_search.php"))) {
$exists = true;
}
}
// If the Templates dont exist install them
//
if (!$exists) {
copy(WP_PLUGIN_DIR . '/agent-storm/agentstorm_result.php', TEMPLATEPATH . '/agentstorm_result.php');
copy(WP_PLUGIN_DIR . '/agent-storm/agentstorm_results.php', TEMPLATEPATH . '/agentstorm_results.php');
copy(WP_PLUGIN_DIR . '/agent-storm/agentstorm_noresults.php', TEMPLATEPATH . '/agentstorm_noresults.php');
copy(WP_PLUGIN_DIR . '/agent-storm/agentstorm_search.php', TEMPLATEPATH . '/agentstorm_search.php');
}
}
/**
*
*/
static function getOneLiner() {
$one_liners = array(
'Our IDX Plugin is causing a storm in Real Estate.',
'Storm Repairs? Check out the Documentation!'
);
return $one_liners[array_rand($one_liners, 1)];
}
function preventFakeStaticRedirect($redirect_url) {
if (substr($redirect_url, -6) == '.html/') {
return false;
}
}
}
class AgentStormLogin extends stdClass {
private $error = '';
function init() {
add_filter('wp_authenticate', array(&$this, 'check_login'), 1, 2);
add_action('profile_update', array(&$this, 'profile_update'));
add_action('user_register', array(&$this, 'user_register'));
add_action('register_form', array(&$this, 'register_form'));
}
function initForceLogin() {
add_action('wp_footer', array(&$this, 'wp_footer'));
}
function check_login($username, $password) {
if ($username && $password) {
$as = new AgentStormRequest(get_option('as_hostname'), get_option('as_apikey'));
$as->format = 'xml';
$as_results = $as->getContactByUsername($username);
// Check the User exists
if ($as_results->Count == 0) {
add_filter('login_errors', array(&$this, 'login_errors'));
$this->error = _('ERROR: Username or Password was incorrect');
return null;
}
// Get the Contact from the Result
$as_user = $as_results->Contacts[0];
// Check the Password is correct
if (wp_hash_password($password) !== $as_user->Meta->Password) {
add_filter('login_errors', array(&$this, 'login_errors'));
$this->error = _('ERROR: Username or Password was incorrect');
return null;
}
// Save the User to the local WP database
if (!get_userdatabylogin($username)) {
$userarray['user_login'] = $as_user->Meta->Username;
$userarray['user_pass'] = $as_user->Meta->Password;
$userarray['first_name'] = $as_user->Meta->FirstName;
$userarray['last_name'] = $as_user->Meta->LastName;
$userarray['user_url'] = '';
$userarray['user_email'] = $as_user->Meta->EmailAddress;
$userarray['display_name'] = $as_user->Name;
$userid = wp_insert_user($userarray);
update_usermeta($userid, 'as_id', $as_user->Id);
}
if (get_option("as_contact_emaillogin", false)) {
wp_mail( get_option( 'admin_email' ), "[ " . get_option( 'blogname' ) . " ] ".__( 'Returning Visitor' ).' '.$as_user->Meta->Username, "" );
}
// Return the WP User object
return get_userdatabylogin($username);
}
}
function user_register($user_id) {
if ($user_id) {
$user = get_userdata($user_id);
// Build the basic document to be posted
//
$xmldoc = new SimpleXMLElement('');
$contact = $xmldoc->addChild("Contact");
$contact->addChild('Name', $_POST['user_first_name'] . ' ' . $_POST['user_last_name']);
$contact->addChild('ContactSource', get_option('as_contact_source'));
// If we have been passed an Email Address add it to the XML to be posted
//
if (isset($_POST['user_email']) && !empty($_POST['user_email'])) {
$email_addresses = $contact->addChild('EmailAddresses');
$email_address_c = $email_addresses->addChild('EmailAddress');
$email_address = $email_address_c->addChild('EmailAddress', $_POST['user_email']);
}
// If we have been passed a Phone Number add it to the XML to be posted
//
if (isset($_POST['as_contact_phone']) && !empty($_POST['as_contact_email'])) {
$phone_numbers = $contact->addChild('PhoneNumbers');
$phone_number_c = $phone_numbers->addChild('PhoneNumber');
$phone_number = $phone_number_c->addChild('Number', $_POST['user_phone']);
}
// If we have been passed a Message add it to the XML to be posted
//
$meta = $contact->addChild('Meta');
$meta_u = $meta->addChild('Username', $user->user_login);
$meta_u = $meta->addChild('Password', $user->user_pass);
$request = new AgentStormRequest(get_option('as_hostname'), get_option('as_apikey'));
$request->format = 'xml';
$as_user = $request->putRemote('contacts', array(), $xmldoc->asXML());
if ($as_user->Contact) {
update_usermeta($user_id, 'as_id', (string) $as_user->Contact->Id);
if (get_option("as_contact_emailregister", false)) {
wp_mail( get_option( 'admin_email' ), "[ " . get_option( 'blogname' ) . " ] ".__( 'Visitor Registered' ).' '.$user->user_login, "" );
}
wp_set_auth_cookie( $user_id, false, is_ssl() );
wp_redirect( $_POST['redirect_to'] );
}
}
}
function register_form() {
echo '
';
echo ' ';
echo '
';
echo '
';
echo ' ';
echo '
';
echo '
';
echo ' ';
echo '
';
}
function profile_update($user_id) {
if ($user_id) {
$user = get_userdata($user_id);
$user_contact_id = get_metadata('user', $user_id, 'as_id', true );
$as = new AgentStormRequest(get_option('as_hostname'), get_option('as_apikey'));
$as->format = 'json';
$as_results = $as->getContactByUsername($user->user_login);
// Get the Contact from the Result
if ($as_results->Count == 1) {
$as_user = $as_results->Contact;
$xmldoc = new SimpleXMLElement('');
$contact = $xmldoc->addChild("Contact");
$contact->addChild('Id', $user_contact_id);
$meta = $contact->addChild('Meta');
$meta_u = $meta->addChild('Username', $user->user_login);
$meta_u = $meta->addChild('Password', $user->user_pass);
$as_user = $as->postRemote('contacts', array(), $xmldoc->asXML());
}
}
}
function login_errors() {
return $this->error;
}
function wp_footer() {
echo '';
echo '';
echo '