Home › Toolset Professional Support › [Resolved] How can I include a country selection field for user registration?
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
- | 10:00 – 13:00 | 10:00 – 13:00 | 10:00 – 13:00 | 10:00 – 13:00 | 10:00 – 13:00 | - |
- | 14:00 – 18:00 | 14:00 – 18:00 | 14:00 – 18:00 | 14:00 – 18:00 | 14:00 – 18:00 | - |
Supporter timezone: Asia/Kolkata (GMT+05:30)
Related documentation:
This topic contains 36 replies, has 3 voices.
Last updated by Francisco Ramón Molina Busquiel 7 years ago.
Assisted by: Minesh.
I am giving another test to Toolset to see if it has improved its membership management.
I would like to know if there has been any progress in relation to this ticket:
https://toolset.com/forums/topic/how-can-i-include-a-country-selection-field-for-user-registration/
Thanks for your help.
Best regards,
Francisco R.
Hello. Thank you for contacting the Toolset support.
Well - still there is no such feature available but you can add user custom field as select and later you can use Types hook "wpt_field_options" to fill out the dropdown option for your county dropdown box dynamically.
For example:
add_filter( 'wpt_field_options', 'func_dynamic_populate', 10, 3); function func_dynamic_populate( $options, $title, $type ){ switch( $title ){ case 'country': $options = array(); $args = array( 'post_type' => 'countries', 'post_status' => 'publish'); $posts_array = get_posts( $args ); foreach ($posts_array as $post) { $options[] = array( '#value' => $post->ID, '#title' => $post->post_title, ); } break; } return $options; }
Where:
=> You should change 'contry' to your custom field name.
Please note that - to use this field and to reference it with orders etc..etc.. is not included here as its part of custom code which is beyond the scope of our support policy but at least you will know that how you can populate the dropdown field options dynamically.
But then the code you've indicated is useless. Here the important thing is that the user's data are synchronized with those of woocommerce. All member management plugins have this functionality. If Toolset is used to make members management websites, why not have this functionality?
Well - it depends upon our developers and using Toolset you can build and extent all kind of websites. Toolset focus is not only to build membership website(s).
I do not know if you are aware of the following article:
=> https://toolset.com/learn/create-membership-site-wordpress-using-toolset-plugins/
That illustrates whats possible and what is not and how you can build membership websites using Toolset. However I will raise your voice to our Devs and report a feature request to synchronize the user's custom fields with woocommerce. Please note that there is no ETA on that.
I have already seen that article, for that reason I asked about this problem.
Please, I need information about it before 1 month, in case I have to ask for a refund of my money.
Thanks for your help.
As I already inform you that no such feature exist for now to synchronize user data with WooCommerce.
In case of refund - Please contact here:
=> https://toolset.com/buy/refund-policy/
Yes. I know. But I would like to know before 1 month if you are going to include this functionality in Toolset or you will not include it.
I Just talked to our Dev and there is no chance that it will be implemented in coming month(s). Its all depends upon the predefined priorities and we already have predefined list of features to be implemented.
The only possibility is the way I shared by adding custom field and populate it and then use custom programming to reference that field at whatever place you need it.
This is a more serious problem than you think and I am astonished that no other user has told you. ????
After reviewing your document:
https://toolset.com/documentation/user-guides/charging-payments-with-cred-to-register-users/
I have found a problem that does not serve your payment system at all.
In Europe it is essential in the payment process to take into account the country, the region and the VAT of the buyer for the calculation of taxes. According to the document that I indicated before, CRED does not take into account all these details, Woocommerce is taken into account through several plugins that can be installed (WooCommerce EU VAT Assistant - Aelia), but CRED does not make use of these plugins, so the calculation of the payment may be incorrect . This is very serious and can produce many legal problems. ????
Just as you have your system of payment process does not serve for European legislation and therefore can not be employed.
This should be discussed because it is very serious and solve it as soon as possible.
Most member management plugins, for example, WooCommerce Memberships (SkyVerge) solve this problem using the WooCommerce forms themselves to register the user, so they automatically use the technologies of the European tax control of the installed plugins.
Gravity Forms has support through plugins to support the European legislation for tax calculation.
Please tell me something about it as soon as possible.
Thanks for your help.
Best regards,
Francisco R.
Using CRED Commerce we manage events when your place order and payment is completed etc. we do not make anything or support customization on cart/checkout pages. To customize your cart and checkout pages (as billing info is part of checkout process) you need to either use WC hook or any other plugin that suits your requirement.
Also, we offer number of CRED Commerce API hooks that may help you when order is successfully placed:
=> https://toolset.com/documentation/programmer-reference/cred-commerce-api/
I also forward your request to concern department for assessment but please note that there is no ETA on it for now. To manage the taxes there are already number of plugins available for WC as extensions.
=> https://wordpress.org/plugins/search/woocommerce+eu+vat/
The only way you can follow is add fields to CRED form as I suggested and it needs custom programming to sync such user field value at other places at whatever place you need it - you need to manage it using custom programming which is beyond the scope of our support policy.
What is clear is that if you do not solve this problem CRED Commerce and Access are of no use in Europe. If this is not a priority for you, I am sorry for you and your customers, it is a very serious problem that must be solved at the heart of Toolset and should be resolved as soon as possible.
Toolset is supposed to serve to avoid coding with PHP, that's your propaganda.
The topic that I point out is basic and is addressed by all the plugins that exist in the market, but not Toolset. Now you tell me that I must encode this functionality that comes from basic in WooCommerce and in the rest of plugins of the market?
Seriously, you tell me?
Maybe you are not understanding the seriousness of the problem I am telling you.
This completely invalidates the utility of CRED Commerce and Access, many of your customers who are ignoring using these plugins in Europe are committing a serious illegality.
I am amazed that you do not solve this problem.
But I have it very clear, all the good that could have the rest of Toolset is invalidated if your aptitude to this problem is this.
The market plugins for member management do not make any kind of customization of the checkout process, instead they are limited to connecting some roles for the user who have produced the purchase, so they do not have the problem of Toolset. As you have approached this problem, you have complicated it futilely, it is a very bad decision that you have taken. It is not necessary to create a form for the user to register and prevent the process from doing WooCommerce. This is a serious error.
Toolset allows you to automatically connect some roles after the purchase?
If Toolset allows to do this the problem would be solved.
Please talk to your bosses and tell me if this is not going to be solved, if so, I have no choice but to ask for a refund of my money, since Toolset would not work at all.
Best regards,
Francisco R.
Hello Francisco,
I’m Mohammed: the Toolset support team leader.
Minesh has forwarded your complaints to me.So, let me explain some things.
About your first request, Minesh already tried to help you for a feature that doesn't exist for now in Toolset by providing custom code which actually a good effort from him and I encourage him to do that to provide our clients the best support service we can.
The second request, Minesh already forwarded it to the development team which is the proper step we take when we raise a feature request for our product.
As you know, the development team has their schedule and agenda and have their priorities to say what needs to be done first and what needs to be done later.
What we do is to push them forward implementing the features that our clients ask for.
So, the more clients ask for a request, the less time the feature takes to be taken into account and implemented.
I hope I made everything clear.And I will follow your request myself.
Thanks.
Toolset allows you to automatically connect some roles after the purchase?
If Toolset allows to do this the problem would be solved.
===> That is why I shared the CRED commerce API hook Doc:
=> https://toolset.com/documentation/programmer-reference/cred-commerce-api/
Now, if you can review the CRED commerce Doc here:
=> https://toolset.com/documentation/user-guides/charging-payments-with-cred-to-register-users/
[Check section: "Setting the CRED Commerce options to charge for registration"]
See this image:
=> hidden link
As per above setting - the USER will be created when payment is successfully done and purchase is completed at that time user will be created.
Now, You can use CRED Commerce API hook cred_commerce_after_order_completed :
=> https://toolset.com/documentation/programmer-reference/cred-commerce-api/#cred_commerce_after_order_completed
For example:
add_action( 'cred_commerce_after_order_completed', 'my_hook', 10, 1 ); function my_hook( $data ) { //some code here }
Where:
$data is an associative array that holds various information related to the order, with such structure:
$data => array( 'user_id' => $user_id, 'transaction_id' => $transaction_id, 'extra_data' => array( array( 'cred_product_id' => $product_id, 'cred_form_id' => $form_id, 'cred_post_id' => $post_id, ... ) ), ... );
So, as you can see $data contains the $user_id and based on user ID you can assign the role.
For example
$user = new WP_User( $data['user_id'] ); // Remove current subscriber role $user->remove_role( 'subscriber' ); // Upgrade to editor role $user->add_role( 'editor' );
Hello Mohammed,
Make no mistake, I appreciate the support of Minesh and all support members. I thank you very much. Nevertheless, it is a problem that surely many users of your plugins have been able to not realize the serious problem that implies, since they can have serious problems of legal type. I do not know if it will be a feature that you have asked for or not, so I see, a problem so serious if you have not asked for it is that your users do not have sufficient legal knowledge to realize this problem and its severity.
You should have opted for another system to give authorization to users (roles) who buy a service or virtual product. The easiest way I've seen in other plugins on the market is simply to indicate on the product page what roles the buyer user will take when making the purchase. This is the most correct way to do it and I do not think it will take a lot of work to implement it. And you would avoid all the problems I mentioned before, since the user registration processes would be done by Woocommerce and not CRED. Think about it, because it is the logical way to act.
Tell me something about it.
Thanks for your help.
Best regards,
Francisco R.
HI Francisco - I hope you didnt missed the my reply here:
=> https://toolset.com/forums/topic/how-can-i-include-a-country-selection-field-for-user-registration-2/#post-581516
As you wanted to update the User role on fly and you said that will help you to resolve your issue.