I am trying to:Display Email address in views by using cred form.But when i paste cred short code on page,it display correctly post by auhtor.That means my code is right.But when i use cred shortcode in views,post by author email doesnot fetch.
I visited this URL:https://toolset.com/forums/topic/create-a-contact-form-where-visitor-fills-form-and-details-goes-to-post-creator/
I expected to see:
Instead, I got:
Dear anand,
You can use Views shortcode directly, for example:
[wpv-post-author format="meta" meta="user_email"]
More help:
https://toolset.com/documentation/views-shortcodes/#wpv-post-author
Display details for the author of the current post.
Thank You for the reply Luo Yang,but
I used this code in cred form:
[cred_generic_field field="get_email" type="email" class="" urlparam=""]
{
"required":1,
"validate_format":0,
"persist":1,
"default":"[get_author]"
}
[/cred_generic_field]
I have used below code in function.php
// Add Shortcode
function get_author_email() {
// Code
$user_email = get_the_author_meta( 'user_email' );
return $user_email;
}
add_shortcode( 'get_author', 'get_author_email' );
I have custom post Supplier in which it display details of each supplier.
Now take an example their is supplier Vishal. It shows all detail informations about vishal on front end. I have one tab ( get in touch). In this i hav used shortcode of cred form but by default it deosn't show post author's email. It has to be show vishal's email when i visits his profile.
I don't have email field in custom post type Supplier.It has to be fetch from wordpress which i had enter while registering in first step.
I need detail steps to duplicate same problem, how do you setup the Views? where do you put the CRED shortcode?
Could you take some screenshots for the problem Views and CRED form?
I have used below code in function.php
// Add Shortcode
function get_author_email() {
// Code
$user_email = get_the_author_meta( 'user_email' );
return $user_email;
}
add_shortcode( 'get_author', 'get_author_email' );
i have send you my view code screenshot in which i have used shortcode ultimate plugin for tabs.On tab 7th when i click on get in touch tab it display cred form,i hav also attached cred code.
Thank You.
Dear Luo Yang,
You can refer to my site
hidden link
I did not see how do you entire settings of the problem view:
hidden link
Since it is a custom codes problem, could you duplicate same problem in a test site, and fill below private detail box with login details, also point out the problem page URL, View URL, CRED form URL, I need a live website to test and debug.
I assume we are talking about the supplier:
hidden link
Please check these:
1) It is displaying a 404 error page, see the page title "Page not found"
2) I can not find the "get in touch" tab
3) You are using old version of Toolset plugins, it is recommended to use the latest version of Toolset plugins, you can download them here:
https://toolset.com/account/downloads/
If the problem still exists, please deactivate other plugins, and switch to wordpress default theme file, and test again.
I am really Sorry for this mistake Luo yang. But now you can see page.
Repeat the steps which i have posted in privately. There is supplier name Vishal with comapany name Techberries.Please resolve my issue as soon as possible.
I have modified the PHP codes as below:
// Add Shortcode
function get_author_email() {
// Code
$current_post_id = do_shortcode('[wpv-post-id id="$current_page"]');
$user_email = do_shortcode('[wpv-post-author format="meta" meta="user_email" id=' . $current_post_id . ']');
//$user_email = get_the_author_meta( 'user_email' );
return $user_email;
}
add_shortcode( 'get_author', 'get_author_email' );
Please test again, check if it is fixed
Thank You Luo Yang for quick reply,and yup its works,but the data is not going to author post email.
You can login from vishal's profile and in that there is custom post type message.In that message should receive.At admin's dashboard message all messages receives.please try this problem
Dear anandk,
Your website is very slow, it is hard to debug in your website, here is what I found:
1) You are using old version of Toolset plugins, it is recommended to use the latest version of Toolset plugins, you can download them here:
https://toolset.com/account/downloads/
2) You are using other plugins and custom theme in your website, we need to know if there is any compatibility problem in your website, as I suggest above, please deactivate other plugins and switch to wordpress default theme and test again
3) In the problem page:
hidden link
It is using content template:
hidden link
Please check the codes in your content template, there is a CRED shortcode:
[cred_form form="797" form_name="Get In Touch"]
But this CRED form is correspond to other CRED form:
hidden link
Which is render gravityform shortcode:
[gravityform id="5" title="true" description="false"]
But the problem CRED form is another one "Messaging":
hidden link
I am not sure where do you output the CRED form "Messaging", are you using custom codes to render the CRED form?
And when I trying to open the problem URL:
hidden link
My chrome browser shows status "Waiting for kasa.codebox.org.in" for five minutes, it is not possible to debug in such a slow webserver, and since it is a custom PHP codes problem, according to our new Customer Support Policy,
https://toolset.com/toolset-support-policy/
we do not provide custom codes support, you can check out our certified partners for it:
https://toolset.com/consultant/
In my Case You just focus on cred post form "Messaging".
Content template is useless and also cred form "Get in touch".
i only want when visitor visits suppliers profile like vishal's profile and fill the cred form,then all the details should be receive in backend of vishal's dashboard.In the custom post type i.e "Message"
I checked the "vishal" user's profile, which is using email "vishal@techberries.com"
hidden link
then I modified the problem CRED form, add a hidden field:
hidden link
---------------
[cred_generic_field field="get_email" type="hidden" class="" urlparam=""]
{
"required":0,
"validate_format":0,
"persist":1,
"default":"[get_author]"
}
[/cred_generic_field]
--------------
In the front-end:
hidden link
I can see it does output the correct email "vishal@techberries.com":
<input type="hidden" id="cred_form_779_1-hidden-1-1462781921" name="get_email" value="vishal@techberries.com" class="wpt-form-hidden form-hidden" data-wpt-id="cred_form_779_1_cred_form_779_1-hidden-1-1462781921" data-wpt-name="get_email">
If it is correct email value, please point out where I can find the email value, thanks