Can you please explain why this conditional display doesn't work in a CRED edit post form?
It ignores the id='$organizer'.
I use it in layouts without issues.
[wpv-conditional if="('[wpv-current-user info='id']' ne '[wpv-post-author format='meta' meta='ID' id='$organizer']') AND ( '[wpv-current-user info='role']' ne 'administrator' )"][/wpv-conditional]
These conditionals work on my end.
Here an example, used in a CRED Edit Form, that is inserted to a Post which has a parent Assigned:
[wpv-conditional if="( '[wpv-current-user info='id']' eq '[wpv-post-author format='meta' meta='ID' id='$package']' )"]
Here
[/wpv-conditional]
There can be several issues here:
- the post has no parent
- there is a typo in the parent slug
- the form is not an edit form
Can you try to output just the part "[wpv-post-author format='meta' meta='ID' id='$organizer']" to see what it Outputs?
Please let me know.
I added this to both the edit form and to the single post layout.
<p>[wpv-current-user info='id'] = [wpv-post-author format='meta' meta='ID' id='$organizer'] OR user-role = [wpv-current-user info='role']</p>
On the single post it outputs correctly but in the cred edit form parameter id='$organizer' is ignored. I only get the post-author from current post.
Maybe it is because I use the "new" way to edit-post-links? I assigned a layout to the edit post link.
[toolset-edit-post-link layout_slug="redigera-bokning" target="blank"]Redigera Bokning[/toolset-edit-post-link]
I also tested to add another field to the form. The parent parameter is ignored for post-title as well.
[wpv-post-title id="$organizer"]
The last test was to add a field to another row in the edit post layout. I works, but not in the form.
see image.
In my local test, this works as well fine with the Layouts edit mode.
Is it possible to provide to me a small snapshot of this site?
Thanks!
OK, I tested this.
I used the User provided by you.
This User (User149) is not the author of the Current Post we are editing with CRED here (Post 10468).
Post 10468 is authored by User 166.
The parent of this post is as well authored by User 166.
I used your CRED form and removed the long list of Post fields to address just the output of current user, current post author and parent post author IDs
The output is correct.
These conditionals work perfectly fine for me on your Duplicator:
[wpv-conditional if="('[wpv-user field='ID']' ne '[wpv-post-author format='meta' meta='ID' id='$organizer']') AND ( '[wpv-current-user info='role']' ne 'administrator' )"]
You are neither admin nor author of parent post
[/wpv-conditional]
Does it work for you too, after copy paste this?
The author of the current post is 166
The author of the parent post is 149 (id=organizer)
The output is incorrect. Parameter for parent post is ignored.
Try to put this in the form, outside any other condition. You will see that the parameter for organizer is ignored.
The output should not be the same for both short-codes.
[wpv-post-title id="$organizer"], [wpv-post-title]
The post bookings/bokning-nr-10468/ is authored by User 166.
I log in as User 149.
I used this ShortCodes in the CRED Form:
Current user ID:[wpv-user field="ID"]<br>
Current Post Author ID: [wpv-post-author format="meta" meta="ID"]<br>
Parent $organizer Author ID: [wpv-post-author format="meta" meta="ID" id="$organizer"]<br>
I see on the front end:
Current user ID:149
Current Post Author ID: 166
Parent $bookings Author ID: 166
Hence, you are right, the $bookings is not respected. I confused the output earlier.
I could still not replicate this on a clean install.
So I started to deactivate and remove things from the Duplicator.
After I removed all the Plugins and the add-on files from the FTP the issue was gone on your site.
Now, the correct IDs are shown.
I also changed the theme in this process.
Something is resetting the Post Object on your Website.
I deployed the package again and tried to narrow down the culprit, so I also had the chance to test directly with your original Form.
- Use Twenty Seventeen Theme ==> Issue is solved.
I should have seen that earlier in the process, I apologise.
Can you confirm that switching the Theme solves the issue?
First test:
Switching to Toolset Starter theme 1.4.2 (don't have any other installed)
Leaving plugins active
Problem REMAINS
Second test:
Toolset Starter theme 1.4.2
Deactivating all except toolset (Access, Cred, Layout, Types, Views, Maps)
Problem REMAINS
Third test
Twenty Seventeen theme
All plugins except toolset active
Problem GONE
So whatever my theme is doing so is Toolset Starter theme.???? (Weird)
haha, some text changes to the third test.
Only toolset active others disabled ...
I discovered that this happens in all themes where Toolset Layouts is integrated with the_ddlayout() function.
As soon you remove that and use the_content() (which Toolset Layouts now replaces natively) then things work.
I will escalate this, but I need to update you about Layouts:
Meanwhile, Layouts is mainly intended as a Content Template Editor, not anymore an Editor for Header, Footer, etc.
Nonetheless, we need to look into this issue.
I will keep you updated here.
Meaning that I will have to rebuild my entire theme?
Confirmed. I changed the template to the_content()
But I must ask, why this is not informed with BIG LETTERS to users
You do not need to change this. It is a BUG which I reported already and we will solve this ASAP.
I have not yet any news to provide to you, but I have pushed for a fast solution.
Please stand by while I await news.
Thank you very much for your patience.
Hello Tina.
I believe this is solved in the current stable Toolset releases.
I tried hard to replicate it again but I cannot see this problem anymore.
Can you confirm that the problem is solved?