[Resolved] Allow guest users to submit Form that posts to landing page owner

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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Author
Posts
#1388987

Christian Cox
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-05:00)

May I log in to your wp-admin area and see how this is set up? I think it will be fastest if I can look at all the configurations there. Please let me know where I can see this Form on the front-end of the site, and provide admin login credentials in the private reply fields here.

#1389013

Christian Cox
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-05:00)

Okay the generic fields here don't have slugs - that's why no fields appear on the front-end. However, I'm not sure I understand why you have chosen to use generic fields. Instead, you would normally create a custom field group and apply it to the Lead-Messages post type. In that custom field group, add a field for phone number and a field for email. Then in the Form, delete the generic fields. Use the "Add field" button to add the post title field (that can be used for the Name input), the phone number custom field, and the email custom field. Now those fields will automatically be saved in the Lead-Message post that is submitted by the User.

I also checked the post relationship field here and there seems to be a problem. None of the Member posts appear as selections in the field. I removed the "hide" class temporarily so you can see what I mean. I'm curious why no parent posts appear here, and I suspect it has something to do with Memberships. Is it okay for me to temporarily disable plugins to determine why this field isn't working as expected?

#1389015

I most likely missed a step where i was setting it up. What are you disabling?

#1389019

Christian Cox
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-05:00)

I want to disable everything except Toolset plugins and activate a default theme like Twenty Nineteen to see if the parent posts begin to show up in that parent select field. If so, then I want to reactivate the theme and plugins one by one until I find the conflicting component.

If that's not okay on the live site, the alternative is I create a clone of the site using the Duplicator plugin, then install the site locally on my own test environment so I can run more tests without breaking the live site. Let me know how you prefer to proceed.

#1389025

I would prefer you clone it as I'm working on this right now as well.

#1389027

Christian Cox
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-05:00)

Okay I'll get started and update you shortly.

#1389041

Christian Cox
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-05:00)

Okay when I deactivate Elementor Pro, the page changes significantly and the Form is no longer displayed. So I added the Form directly to the Member post, and now it's displayed on the Member page successfully. The parent post is selected correctly in the Form, as well. So I'm not sure if this is a conflict with Elementor Pro per se, or a side effect of how this page is modified for Guest Users when Elementor Pro is active. Can you explain briefly how the conditional display is implemented for Guests vs. logged-in Users? Is there a template or post I can check to see how the Lead Message Form is implemented for Guest User display? I'm not seeing anything obvious right now, and I'm not an Elementor or Membership expert so I would appreciate any details you can provide about this setup.

#1389049

Elementor pro is the page builder and fully works with toolset and dynamic content. Of course disabling it will destroy the page layout entirely.

there is no difference in the conditions on the landing page for user logged in or guest it is the same

maybe just create a test-page?

#1389059

Christian Cox
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-05:00)

there is no difference in the conditions on the landing page for user logged in or guest it is the same
The two experiences are different for me. Maybe I used unclear terminology to describe the problem? Let me restate it in different terms.

Please log out and visit this Member post:
hidden link

Then log in using the login criteria you provided for me earlier, and check the same post. They are obviously not the same.

In technical terms, how is this post page displayed differently for Guests vs. how it is displayed when logged in using the account information you provided for me earlier? There's some kind of conditional display logic going on, and I'm not clear how that is accomplished. If this not clear, or if you continue to see no difference between the two experiences, I'll be glad to provide screenshots showing the differences I see on my end.

#1389093

looks the same on both devices

Logged in as admin and non logged in (only difference in screenshot is the 4k vs 10 screens

it shows a popup first. If you have filled out the elementor popup prior (or perhaps as an admin) you wont see the popup any longer.

the top form IS NOT toolset it is elementor form. The bottom ("NOT SET") is the toolset code sent over

I would ideally love to be able to populate the forms with toolset fields (like you can do dynamically in elementor) might be a good consideration for an update on toolset. I know it is fairly well integrated on the front end side with custom post types (good example of that here - hidden link)

#1389221

I reworked the form with piotnet elementor addon and am able to save the forms data to the toolset custom post type of "lead message" I added this code to the theme and it is now also storing the lead in the members page.

function member_meta_box()
{
add_meta_box( 'lead-messages', 'Lead Messages', 'member_output', 'member' );
}
add_action( 'add_meta_boxes', 'member_meta_box' );

function member_output( $post )
{
$post_id = $post->ID;
$args = array(
'post_type' => 'lead-message',
'meta_key' => 'wpcf-post_id',
'meta_value' => $post_id,
);
$query = new WP_Query( $args );
if($query->have_posts()) :
echo '<table>';
echo '<th style="text-align:left;padding:15px;">Name</th>';
echo '<th style="text-align:left;padding:15px;">Email</th>';
echo '<th style="text-align:left;padding:15px;">Phone</th>';
while($query->have_posts()) : $query->the_post();
$pid = get_the_ID();
echo '<tr>';
echo '<td style="text-align:left;padding:15px;">';
echo get_the_title();
echo '</td>';
echo '<td style="text-align:left;padding:15px;">';
echo get_post_meta( $pid, 'wpcf-lead_email', true);
echo '</td>';
echo '<td style="text-align:left;padding:15px;">';
echo get_post_meta( $pid, 'wpcf-lead_phone', true);
echo '</td>';
echo '</tr>';
endwhile;
echo '</table>';
endif; wp_reset_postdata();
}

I may need some assistance creating the view on the logged in page for the member

thanks

#1390487

Christian Cox
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-05:00)

Okay it looks like you have stored the Member ID in the Lead Messages post as a postmeta value wpcf-post_id. So depending on where you want to display a View of some Member's linked Lead Messages, the process is a bit different. In either case, you will create a View of Lead Messages and add a Query Filter based on the post_id custom field, where the post_id field value is set by a shortcode attribute like "memberid".

Now insert the View wherever you want to display the list of Lead Messages, and supply the Member ID in the shortcode attribute like so:

[wpv-view name="Your Lead Messages View" memberid="12345"]

The 12345 part should be replaced by a Member ID, or a shortcode that supplies a Member ID somehow. For example, if you want to display the Lead Messages list on the Member post itself, you would pass in the current post ID:

[wpv-view name="Your Lead Messages View" memberid="[wpv-post-id item='$current_page']"]

Otherwise, you could create a View of Messages, filtered by post author, where the post author is the same as the current Logged-in User. Then inside the loop of that View of Messages, insert your View of Lead Messages filtered by the current post ID:

[wpv-view name="Your Lead Messages View" memberid="[wpv-post-id]"]

Then insert the View of Messages wherever you want to display the list of related Lead Messages.

#1390735

I'm a little confused with the memberid shortcode?

I want to display the leads on a page (user will be logged in)

example

hidden link

on page it should show <logged in user> the leads that were submitted

in a format like a table

Name | Phone | Email

(with a quick search/filter at the top that allows them to quickly filter the table) by any of the above fields

some users might be looked up by a phone (missed phone call) others by email address (maybe they forgot the name) and obviously a search by (name)

#1391259

Christian Cox
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-05:00)

You need a way to access the logged-in User's Member post ID so you can pass that value into another View using a shortcode attribute. You can do that with another View as explained here:
- Create a View of Member posts, filtered by post author, where the post author is the same as the current logged-in User
- There should be only one Member post, but you can set a limit of 1 if you want to be extra careful
- In the Loop Editor, click "Loop Wizard" and choose the option "List with separators"
- Insert the post ID field in the Loop Wizard and use a comma ( , ) as the separator
- Remove all the extra spaces and line breaks from the Loop Output editor panel, so the code looks like this:

[wpv-layout-start][wpv-items-found]<!-- wpv-loop-start --><wpv-loop>[wpv-item index=other][wpv-post-id],[wpv-item index=last][wpv-post-id]</wpv-loop><!-- wpv-loop-end -->[/wpv-items-found][wpv-no-items-found][/wpv-no-items-found][wpv-layout-end]

- Delete any empty lines after the code ends
- Below the Loop Output panel, be sure the "Disable the wrapping div around the View" checkbox is checked
- Place this View of Members in the memberid attribute of your View of Lead Messages like so:

[wpv-view name="Your Lead Messages View" memberid="[wpv-view name='Your Members View']"]

- This passes the current User's Member post ID into the Lead Messages View's query filter, so it can be used in the custom field filter.

Let me know if you have trouble implementing this and I can take a closer look.

#1391611

I'm still confused. I completed the first part where does the second one go.
You have login credentials, can you just do it?