Avoid multiple duplicate users
-
We dont need same user multiple times registration. How to fix this, can any one help
-
there is really not enough information to understand what the problem is.
User registration where? WordPress? CRM? What kind of registration? Are you using form and duplicates are created? Something else?
Can you describe the process where users are registered and where the duplicates are created?
I am using the Dynamic 365 plugin, recently I switch to OAuth2.0, and Now some issues occur with username and password. I have attached my old custom code, can you please help me, with how to change it as per the latest Oauth method code? This code’s purpose avoid multiple duplicate entries (Email already exists when registered)
use AlexaCRM\CRMToolkit\Settings; use AlexaCRM\CRMToolkit\Client as OrganizationService; //function for processing submitted data add_filter('wordpresscrm_shortcodes', 'changemode', 7, 1); function changemode($shortcodes) { session_start(); if (isset($_SESSION['contactid'])) { $contactid = $_SESSION['contactid']; } if (isset($_POST['entity']) && !empty($_POST['entity']['emailaddress1'])) { $options = [ 'serverUrl' => ASDK()->settings->serverUrl, 'username' => ASDK()->settings->username, 'password' => ASDK()->settings->password, 'authMode' => ASDK()->settings->authMode, ]; $serviceSettings = new Settings($options); $service = new OrganizationService($serviceSettings); $out = $service->retrieveMultiple('<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">' . '<entity name="contact">' . '<all-attributes />' . '<order attribute="fullname" descending="false" />' . '<filter type="and">' . '<condition attribute="emailaddress1" operator="eq" value="' . $_POST['entity']['emailaddress1'] . '" />' . '</filter>' . '</entity>' . '</fetch>'); $count = $out->Count; if ($count) { if (!$contactid) { if (($out->Entities[0]->propertyValues['syn_isdeleted']['Value'] == 0) && ($out->Entities[0]->propertyValues['syn_isvalidated']['Value'] == 1)) { wp_redirect(getHomeUrl() . '/message'); exit; } else { ACRM()->request->query->set('id', $out->Entities[0]->propertyValues['contactid']['Value']); } } } } return $shortcodes; }
- This reply was modified 2 years, 1 month ago by subash1990.
Why are you creating new organization service? You can simply do this
$service = ASDK(); $service->retrieveMultiple(...
- This reply was modified 2 years, 1 month ago by alexacrm.
ok thanks, now it is working fine
Now is form is working, and the Form registration is successful, but I don’t want those who applied repeatedly in the same email. How to fix this, My code is mentioned below.
use AlexaCRM\CRMToolkit\Settings; use AlexaCRM\CRMToolkit\Client as OrganizationService; //function for processing submitted data add_filter('wordpresscrm_shortcodes', 'changemode', 7, 1); function changemode($shortcodes) { session_start(); $contactid=''; if (isset($_SESSION['contactid'])) { $contactid = $_SESSION['contactid']; } if (isset($_POST['entity']) && !empty($_POST['entity']['emailaddress1'])) { $options = [ 'serverUrl' => ASDK()->settings->serverUrl, //'username' => ASDK()->settings->username, //'password' => ASDK()->settings->password, 'authMode' => ASDK()->settings->authMode, ]; // $serviceSettings = new Settings($options); // $service = new OrganizationService($serviceSettings); $service = ASDK(); $out = $service->retrieveMultiple('<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">' . '<entity name="contact">' . '<all-attributes />' . '<order attribute="fullname" descending="false" />' . '<filter type="and">' . '<condition attribute="emailaddress1" operator="eq" value="' . $_POST['entity']['emailaddress1'] . '" />' . '</filter>' . '</entity>' . '</fetch>'); $count = $out->Count; // echo '<pre>';print_r($out);die; if ($count) { if (!$contactid) { if (($out->Entities[0]->propertyValues['syn_isdeleted']['Value'] == 0) && ($out->Entities[0]->propertyValues['syn_isvalidated']['Value'] == 1)) { wp_redirect(getHomeUrl() . '/message'); exit; } else { ACRM()->request->query->set('id', $out->Entities[0]->propertyValues['contactid']['Value']); } } } } return $shortcodes; }
You already doing search based on the email address. The only thing that possibly wouldn’t work is the use of $out->Count – where did you get that from?
Try
$out->TotalRecordCount
instead. (Note: your fetchxml must includereturntotalrecordcount="true"
attribute)I am facing fatal error, can you help this,
PHP Fatal error: Uncaught Error: Call to undefined function ASDK()
How to solve this
@subash1990 do you actually have the plugin loaded? ASDK() is a global function.
- The topic ‘Avoid multiple duplicate users’ is closed to new replies.