Beda
Thank you for continuing to look at this for me but I am struggling to get my head around this.
"Out of the box" the Classifieds reference site behaves 'properly'. When you view a listing and you are the owner of it, there is an edit button at the bottom. You click on the edit button and you are taken to a completely fresh screen that shows Edit Ad: %%POSTNAME%% with JUST the form. In other words the whole of the layout for Single Ad is replaced by the CRED form, not just the layout cell where the CRED form is called from.
Attached is a screenshot from my site at discover-wp.com which shows exactly how the screens look. But even when I cut and paste all the code from every cell, all the CSS and JS into my site, I cannot get it to behave this way - either for Member Profiles or for Listings - and the Listings layouts etc are unchanged from when the reference site was installed .
I've also attached screenshots from the Thought4Paws.org site so you can see the different.
Another puzzle is about WHERE on the page the CRED form is displaying. From what you have said, I can guess that the CRED form, if it only replaces the content of the cell from which it is called, should be at the very bottom of the page with the entire listing record above it (because the Edit link was in a cell at the bottom of the page). HOWEVER what has happened is that it has inserted itself in the Description field - you can see the search box, title, featured image and price etc, then the DESCRIPTION field heading THEN the CRED form and then the actual description and remainder of the page (with the description displayed again where the post title was included in the Edit link on the previous page
This suggests to me that there is something wrong beyond just me not having the right code in the right place. The code you have inserted should display the CRED form in place of the Edit link but it doesn't.
The CRED Form is displayed where I inserted the Post Body Call, below the Edit Link.
(Below the About Me cell)
Please try to replace all your Visual Editor Cells with Content Templates, as it is originally done in the Discover Site.
This should solve the problem.
You can then also remove the conditionally displayed Post Body in the Content Tempalte with the CRED Edit link.
Basically if you look at the Discover Site, you will see all cells are Content Templates, which replace the content.
Visual Editors don't.
You would need to adapt this to the given example on the Discover Site.
Hi Beda
I've changed all the Visual Editor cells into Content Templates in my Member Profile layout and still have the same problem - the page displays the post content with the form thrown in the middle of it - in the Description which is the Post Body area, not where the Post Body call is which is where the Edit link is.
I've had a look at the Layout called Ad Single which is the one that is used to display a single Listing post.
With the exception of the "sidebar" widget displaying the parametric search, which is a Widget cell, all other Cells when I edit them say they are already Content Template cells
But the page is displaying as per the screenshots I posted earlier.
I've even tried exporting the Single Ad layout from the Discover site and importing it into my Thought4Paws site, but a) it doesn't display the widget search at the left for some reason and b) the Edit still misbehaves.
So there's definitely still something wrong somewhere and it would appear to be nothing to do with the layout as the identical layout behaves correctly on the Discover site and incorrectly on my site.
I apologize, that was my bad.
Please create (as in the discover site) a Layout that holds a CRED Cell with the Edit form.
Do not assign the layout to anything.
Then when you click the Edit Link that layout will be used.
You can see how it's done here:
hidden link
Access:
beda
$(WfJLfD&*^D
I seriously apologize not having instructed you properly in the beginning.
Hi Beda
Apology accepted - but ultimately unnecessary as my site already has that layout which came as part of the reference site.
In fact I mentioned it in one of my replies further up this thread - https://toolset.com/forums/topic/cred_link_form-not-working/#post-422979
because I had wondered why it was there and had tested whether it was being called somehow by the Single Ad - Ad Tech Info - Edit link by adding some extra text which was displayed.
The layout is still there and isn't assigned to anything
So we still have a problem 🙁
I see the issue and it's reproducible, I tried it on the classifieds site.
1. Create a Custom Post Type "Members"
2. Create one Post in that Type
3. From within the Member Post edit screen create a new Layout (For all Member types, old and new)
4. Add a Content Template to this Layout, insert the Post Body ShortCode only (for test)
5. Go and create a new layout, name it "member edit"
6. In it insert a CRED Cell and choose to create a new CRED Edit Form for Members
Most will be automatic now, the form is automatically created
7. Save that Layout and do not assign it to anything
8. Head back to the Layout assigned to Memebers and open the content template.
9. Insert the CRED Edit SHortCode with the GUI, target _self
(Should be like [cred_link_form form='5923' form_name='Edit content - memebers' text='Edit %TITLE%' target='_self'])
10. Save and visit, when you click on edit, the whole thing is replaced, but the Edit Layout is not used instead
hidden link
I am queriying with our DEV what is wrong here.
Thanks Beda
Having had a browse through toolset-classifieds.class.php I can see the mechanism whereby the Single Ad - Edit layout is called when editing a single ad
/** CRED form handling, use slugs instead of IDS */
/** Check if 'cred-edit-form' is set in $_GET */
if( isset($_GET['cred-edit-form'])) {
/** Set,retrieved */
$cred_edit_form_passed= $_GET['cred-edit-form'];
$cred_edit_form_id =intval($cred_edit_form_passed);
if ($cred_edit_form_id > 0) {
/** let's get the slug of this form ID */
$equivalent_slug_of_form= $this->get_formslug_by_id($cred_edit_form_id);
if ('edit-product' == $equivalent_slug_of_form) {
/** Return copy-of-ad-single Layouts */
$id = $this->layouts_get_id_by_slug('copy-of-ad-single');
$id= intval($id);
}
}
}
so I sort of understand why the edit mechanism might not work properly for my new custom post type/layout etc - I guess I might need to add in the equivalent bit of code to call a Member Profile - Edit layout behind the scenes
BUT what is very peculiar is that the edit mechanism for Listings has stopped working.
I see from my opening post in this thread that my original problem was JUST with the editing of Member Profiles and at that point editing Listings was working fine. So the problem with editing of Listings seems to have crept in at some point while we've all been trying to get the Member Profile side of things to work.
That suggests to me that the problem lies outside of layouts and is somewhere in the classifieds plugin code - but I will leave it to you guys to figure it out.
Thanks
I apologize the inexcusable delay.
No wonder I was going nuts trying to achieve what is done in that Discover Site.
It seems, we used Custom Code to do that.
So, with the below Filter you would be able to use a "standalone" Layout, that includes nothing else but the CRED Edit form, when you edit those Posts.
Replace "WHAT_I_NEED" with your Post Type (slug) and "ID_OF_LAYOUT_I_WANT" with the ID of the Layout that holds your CRED Edit Form.
add_filter('get_layout_id_for_render', function($id, $slug){
global $post;
if( null !== $post && $post->post_type === 'WHAT_I_NEED' && isset($_GET['cred-edit-form']) ){
$id = 'ID_OF_LAYOUT_I_WANT';
}
return $id;
} );
I apologize seriously that I never myself thought we would have used Custom Code there.
So, given this, the possible approaches are as elaborated above, or the Custom Code.