Hi -
I'm using a Custom Post Type for descriptions of my products. Each Custom Post Type record contains custom fields. One of these custom fields is a URL of a zip file download of that product (stored in my WordPress media library). I'm using Toolset for my Custom Post Types and Custom Fields. Is there any way for me to require users to provide their name and email address prior to showing them a button for doing the download. I'm guessing that I would need to create a View with some Javascript.
Another approach would be to use a forms plugin like Gravity Forms or Ninja Forms to do this. Are there any forms plugins that integrate with your Custom Fields?
Hello,
There isn't such a built-in feature within Toolset plugins, I suggest you check if current user is a logged-in user:
- if it is a logged-in user, then you can get their name and email address, and display the file URL
- if it is a guest, then display a login URL
For example, use access shortcode [toolset_access] to check the user's role, and display different contents:
https://toolset.com/documentation/user-guides/access-control-texts-inside-page-content/
Access Control for Contents Inside Page Content
Hi Luo -
This isn't really what I'm looking for. I think that I will need to have a developer write some custom code. But I do have a basic question about creating custom code. Here is the scenario ...
1. I build Custom Fields to store a customers name, email, phone, and URL of their website.
2. I build a Custom Post Type that uses these Customer Fields
3. I built a Template in Elementor to display the Custom Post Types
I think that it is possible to add JS code to the Elementor template to make the functionality that I'm looking for. What I need to know is how to access the Custom Fields values (name, email, phone, and URL ) stortedin the Custom Post Type.
Can you point me to any documentation and/or JS code examples?
In front-end, within the single post content, you can use Types shortcode to display the field value, for example:
[types field="my-email" ouput="raw"][/types]
see our document:
https://toolset.com/documentation/customizing-sites-using-php/functions/
And there is Toolset form plugin, you can download it here:
https://toolset.com/download/toolset-cred/
Here is the document about Toolset form plugin:
https://toolset.com/documentation/user-guides/front-end-forms/
For your reference.
This doesn't answer my questions. Can I access a Customer Fields using JavaScript, and if yes, then how to I identify the custom field in the my code?
For example, you can setup your custom JS codes insider post content, like this:
<script type="text/javascript">
var my_var = '[types field='my-field' output='raw'][/types]';
console.log(my_var);
</script>
Test it in front-end, you should be able to see the JS variable outputted in your browser console window.
See our document:
https://toolset.com/documentation/customizing-sites-using-php/functions/
My issue is resolved now. Thank you!