Mod, if you could change the title of this post to remove the PRO tag at the end I can provide the solution for those of you on the FREE edition as well. I’m sure a lot of other people have struggled with similar problems due to the lack of options even the paid version doesn’t support as well as a way to prevent their emails from being blocked by strict firewalls.
TO RESOLVE THE USERNAME EMAIL FIRSTNAME LASTNAME
Conundrum and Still Allow the User’s Name to be their First and Last name and not their Email Address TWICE a quick fix without having to make any conditional statements is just to hardcode the $username to be the $email.
Open up your plugin folder in wp-content > plugins > frontend-registration-contact-form-7 and you will see only 2 php files.
Resolution to this problem is to navigate to line 31 of frontend-registration-opt-cf7.php (this fix is the same on both the PRO and the FREE versions except for the line number).
And find the following:
$username = strtolower(str_replace(' ', '', $name));
(line 31 in FREE and line 37 in PRO)
Replace the value of the variable with the $email variable to ensure all usernames are derived from the email address rather than removing the spaces in the $name string.
$username = $email;
Your code should look something like this…
// Construct a username from the user's email
$username = $email;
$name_parts = explode(' ',$name);
This works best if you have the your-name option set in the wp-admin under “Selected Field for User Name” so that the plugin knows to use the $name variable as $name_parts to explode into ‘first_name’ and ‘last_name’ during the user creation process.
Ideally you would want to code it to have a dropdown for username and a dropdown for User’s Name (first and last) or User’s First Name and User’s Last Name individually. Then point the input of those values directly into the $userdata.
THEN TO ALLOW SENT MAILS TO SUPPORT DKIM (PRO Only)
You simply need to add a $header value for ‘Reply-To’ in the plugin file you just had open: frontend-registration-opt-cf7.php
On line 183 add the new $header value like so as to include the same “sender” email as the reply-to email since there is only one field in the plugin. It doesn’t entirely fix the problem that the feature isn’t available, but it resolves the issue of authentication without having to modify the plugin’s interface as not many people have a custom reply-to and sender on email messages sent from their mail server on wordpress unless they’re actually being sent from a physical person to you.
//Add Reply-To Header for DKIM Auth to be Successful Above the From: $header
$headers .= 'Reply-To: '.$blogname.' <'.$_cf7frfrom_.'>' . "\r\n";
$headers .= 'From: '.$blogname.' <'.$_cf7frfrom_.'>' . "\r\n";
-
This reply was modified 7 years, 10 months ago by leaninonlife.
-
This reply was modified 7 years, 10 months ago by leaninonlife.
-
This reply was modified 7 years, 10 months ago by leaninonlife.
-
This reply was modified 7 years, 10 months ago by leaninonlife.