Your cart is currently empty!
Create additional “readonly” fields
โ
by
Hi, I’d like to add a field to the Affiliate Registration Form that is set to readonly.
Ideally, it would display some greyed out text in the input field upon registration for example. Then we could input a value via the users backend which would display on the form once they’re logged in.
Do you know how I can make this happen? ๐
I hope that makes sense!
Posted in Affiliates by Username
Comments
5 responses to “Create additional “readonly” fields”
You are welcome Michael. ๐
Cheers
AMAZING! thanks so much George … it’s exactly what I was after ๐
Hi Michael,
You should add another user meta for your users. If your affiliates are not allowed to access their profile under dashboard( will not be able to edit the user status field ), then you can use this snippet to do the trick.
Simply copy and paste the snippet in your functions.php file in your theme, and then add the shortcode
[affiliate_user_status] in your affiliates area page to display the user status.
This snippet will add a field named User Status under Contact Info section in the user’s profile page.
Hope this is better for your case.
Kind regards,
George
Does that php code make the additional field “readonly”? Also, where do I place the text for the input field? I have added fields to the registration form via the Affiliates settings / Registration and clicking “Add Field”… is adding the php code to the functions.php different?
The registration form doesn’t display after login no, but a summary of the users details does (which is the same fields as the registration form).
What I’m trying to accomplish is a way to give each affiliate a status. This status they can not edit. Upon registration, they would see the field “Status” and an input value saying “Office Use Only”.
Once they are registered as affiliates, I can then go into their user profile on the backend and input something like “Team Rider” or “Ambassador” or “Club” etc. Which they will then see under their user summary shown in their affiliate area.
I hope that helps clear up what I’m trying to do?
Thanks!
Mike
Hi Michael,
You can add an extra field by using the filter affiliates_registration_after_fields.
You can use the filter like this in your theme’s functions.php file.
add_filter( 'affiliates_registration_after_fields', 'gt_add_input_field' );
function gt_add_input_field( $output ) {
$output .= '<input type="text" name="team" value="Team" readonly><br>';
return $output;
}
However, the registration form doesn’t display after registration or login, so if you want to display something after the login, it would depend on what you want to display.
Kind regards,
George