-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
does not pick up readonly fields #20
Comments
sorry, can you give me an example? |
Hi Christine - sorry for my late reply!
I have a contact form made using your plugin.
I have these fields on the form:
- Your Name
- Your ID
- Your Email Address
- Alternate Email Address
- Message
This goes on a page thus: [acf_contact id="1"]
In the functions.php I have this function:
function my_acf_load_values( $value, $post_id, $field )
{
if( $field['_name'] == 'user_email' ) {
$current_user = wp_get_current_user();
$value = $current_user->user_email;
} else if ( $field['_name'] == 'user_name' ) {
$current_user = wp_get_current_user();
$value = $current_user->display_name;
} else if ( $field['_name'] == 'user_id' ) {
$value = get_current_user_id();
};
return $value;
}
add_filter('acf/load_value', 'my_acf_load_values', 10, 3);
function acf_set_readonly($field) {
if( ( $field['_name'] == 'user_name' ) || ( $field['_name'] ==
'user_id' ) || ( $field['_name'] == 'user_email' ) )
$field['readonly'] = 1;
return $field;
}
add_filter('acf/load_field', 'acf_set_readonly');
The function automatically fills in the field names for the first 3 fields
(name, id, email) and makes them read only so that the user cannot change
them.
When this happens the email which is sent to me does NOT include those 3
fields, only the non-readonly fields.
So any email just includes the alternate email address and the message.
I'd like to know if it's possible to have the read-only fields also sent in
the body of the email.
Many thanks for your help!
Sean
…On 20 December 2016 at 18:35, Christine Pham ***@***.***> wrote:
sorry, can you give me an example?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#20 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AWNwO_6X65xVoHUkvwwm3DzsHsp1pDW_ks5rKBHUgaJpZM4Kqj8Z>
.
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
Is there a way I can set this up so that it will include readonly fields in messages sent to the admin & customer?
At the moment whilst all other fields are included, readonly fields are ignored and not sent on.
Many thanks!
The text was updated successfully, but these errors were encountered: