Skip Navigation

[Resolved] CRED edit post links not appearing for drafts and private posts

This thread is resolved. Here is a description of the problem and solution.

Problem:
I have some drafted posts, and the links to the relevant CRED Edit forms for those specific Posts is not showing in a View Loop, when logged in as a custom role.

Published Posts CRED Edit links thou display fine.
What's the issue?

Solution:
In Views 2.4.1 and previous, the View loop did not render those edit post links for posts that where not published.

In any 2.4.1+ version, those links wil be dsplayed for users that *can edit* such posts, using the post preview link as a basis for it.
This means it is expected that you need to activate edit rights for the *post type*, not the CRED form per se, in Toolset Access > your_post_type, when you use a role that has no native rights to preview a post.

This support ticket is created 6 years, 10 months ago. There's a good chance that you are reading advice that it now obsolete.

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.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Tagged: 

This topic contains 20 replies, has 3 voices.

Last updated by Beda 6 years, 10 months ago.

Assisted by: Beda.

Author
Posts
#607829
Edit-Button-Missing.jpg

Is this thread confirmed to be fixed in Views 2.5+??

https://toolset.com/errata/cred-edit-post-links-should-be-available-for-authors-of-drafts-and-private-posts/

I used to use the [cred_link_form...] shortcode, but it broke on the most recent upgrade... so I researched and found that the [toolset-edit-post-link...] shortcode would work much better for me and allow me to place my CRED Post Edit form within a Content Template. Awesome.

However... I have developed my CRED page so that users can "clone" posts that they have previously made. These cloned posts are saved as DRAFTS.

Now, when I use the [toolset-edit-post-link...] shortcode, the EDIT link doesn't display for DRAFTS. It only appears for PUBLISHED posts.

So... can you confirm that the above forum ticket reference has actually been fixed in Views v2.5+ ???

#607889

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Ned

Yes, the fix will be included in Views 2.5

And the errata you linked to includes a patch, so if you want to get this working now with your current version of Views, follow the instructions to apply the patch.

#607954

I guess I am not quite sure of your response...
"Yes, the fix will be included in Views 2.5"

I already have Views v2.5.2

It isn't working.

In addition, if I use the [toolset-edit-post-link...] shortcode when I visit the front-end page and click on the "edit post" link the Content template taht appears looks much better, but it seems to break all of my Custom JS and also sidebars that I had added to the Content Template do not show up (would you prefer I add another Support Ticket for this?)

#607958

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Sorry, yes, it is included in Views 2.5.

If you are finding that it's not working then I'll need to confirm that.

First I'll see if I can reproduce the problem on a local vanilla test site, and if not I'll get more details about your set up.

I'll get back to you when I've tested that.

#608468

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Ned

I set up a local test site with current plugin versions and can confirm that this works as expected, the edit links to draft posts are displayed and work.

So I suspect it is something specific to how you have this set up.

My first question would be how are you displaying the table shown in your screenshot?

Draft posts are not normally included in a View results, and to include them you would need to add a Query Filter for post status, is that what you have done?

What does your Loop Output section look like that generates that table?

#608605

Yes I have confirmed that the view and the filter have been set up properly. Can I send you my credentials so that you can take a look?

The result of the [toolset-edit-post-link...] shortcode isn't displaying properly either. I will include the details inthe next reply

#608622

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Sure, let me set up a private reply to get credentials from you.

Please be sure you have a current backup.

Which is the View I'm looking at?

#608948

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Ned

That was a very comprehensive description, I have all I need, thank you.

I didn't get to this until late in the day and I won't be able to finish looking at it, so I will get back to it first thing in the morning and update you again.

Sorry for the delay.

#609411

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Ned

I was able to see everything you describe on your site, but I'm guessing it is a live site so I don't want to test anything on it directly.

So I'm installing a copy of your site locally to run the tests. I'm currently downloading the backup archive—it's a bit of a monster, your site is one of the largest I've seen—and I'll update you again when I've done that and run some tests.

#609417

Hi Nigel, Yes the site is a live site... but I am not too worried about you making some changes and doing testing at this time. it is the off-season :).... also you are probably doing the work at times when we don't have many visitors. Go ahead and do whatever testing you need to do on the live site.

#609459

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

I can see the issue with the CRED edit links not working, but I'm not sure about the second issue you describe.

I can't see any difference whether I use the toolset-edit-post-link shortcode or the cred_link_form shortcode in the View output but I may have misunderstood what you were describing.

Can you show me screenshots of it working and not working and clarify which is which?

#609539
CRED-User-logged-in-page.jpg
CRED-Insert-edit-post-link.jpg
View-Edit-Button.jpg
Edit-Music-Gig-Page-Not-Working.jpg

Hi Nigel,

Thank you for looking into the [toolset-edit-post-link...] shortcode issue

I will try to explain in more detail the issues I am seeing with the second part of my problem.

Here is the process that I have undergone...

1) When a user logs in they end up on this page... hidden link
2) This page is simply assigned to a Content Template called PAGE TEMPLATE - CRED - User Admin Home Page
3) It is a simple 2-column layout with a sidebar menu on the left (which is simply another Content Template called...." CRED - Left Sidebar User Menu)" and a main BODY shortcode on the right [wpv-post-body view_template="None"]
4) You can see this simple layout in the screenshot provided.... "CRED-User-logged-in-page.jpg"
5) This is a nice, desirable layout so I wanted users to see a very similar layout whenever they were going to EDIT one of their Music gigs
6) So I duplicated the Content Template mentioned above and I created a new Content Template called... "PAGE TEMPLATE - CRED - Edit Music Gig"
7) This new Content Template has the same sidebar menu on the left... but obviously since it is going to be for CRED forms, I couldn't leave the BODY shortcode onthe right side... so I replaced the page BODY shortcode with the Shortcode for the CRED form that allows users to Edit their Music Gigs. That CRED form is called.... "Edit a Music Gig (By User)". So the shortcode on the right side is... [cred_form form="edit-a-music-gig-by-user"]
8) This is all per your documentation on this page... https://toolset.com/documentation/user-guides/displaying-cred-editing-forms/
9) So then I went and created the View to display all of the Music Gigs. This View is called... "CRED - Users Music Gigs (UPCOMING)"
10) Inside that View on line 43 I did the following....
a) Clicked the "Fields and Views" button
b) Clicked the "CRED Editing" link
c) Clicked the "CRED edit-post link" button
d) Selected the "PAGE TEMPLATE - CRED - Edit Music Gig" Content Template from the selection Menu (see screenshot "CRED-Insert-edit-post-link.jpg")
e) Clicked the "Insert Shortcode" button
f) That created the shortcode... [toolset-edit-post-link content_template_slug="page-template-cred-edit-music-gig" class="btn btn-warning btn-xs" style="font-size: 11px; padding:2px 5px; line-height:1; margin:2px 0 0 0;"]Edit[/toolset-edit-post-link]
11) This is the shortcode that produces the EDIT button on the user's list of Music Gigs ( see screenshot ... "View-Edit-Button.jpg")

So far so good... Then the problems start....

12) That "Edit" button doesn't seem to appear for DRAFTS (that is the initial problem that started this ticket. You alredy recognize this issue).
13) The other problem occurs when the user clicks on any of the EDIT buttons for any of the existing Music Gigs.
14) The user is taken the the appropriate Content Template.... "PAGE TEMPLATE - CRED - Edit Music Gig"
15) However, when the page appears there are several problems
a) The left sidebar is missing
and
b) None of the Javascript is working on the right side (see the screenshot....Edit-Music-Gig-Page-Not-Working.jpg)

So that is basically the steps needed to be able to reproduce my issue.

Now.... just so you can see the difference.....
If you go back the View called.... "CRED - Users Music Gigs (UPCOMING)" and go to line 43 and comment it out.... and then uncomment line 45 and use the [cred_link_form...] shortcode, you will get an EDIT link that directs you to a workable page and allows users to edit their Music Gigs and all of the JS works... but the layout is terrible.

I am seeking a good layout for all of this.

Where have I gone wrong?

New threads created by Nigel and linked to this one are listed below:

https://toolset.com/forums/topic/split-content-template-issues-when-editing-posts/

#609728

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Ned

I'm going to re-assign this to Beda from second tier who has a copy of your site and is looking into the issue to try and determine why the edit links at not working correctly.

I have split this ticket so I can take another look at the second issue separately, and I'll update you there.

#609729

Hi, this is Beda.

I will help you here from now on.

We will focus on this issue only:

I used to use the [cred_link_form...] shortcode, but it broke on the most recent upgrade... so I researched and found that the [toolset-edit-post-link...] shortcode would work much better for me and allow me to place my CRED Post Edit form within a Content Template. Awesome.

Nigel already has split your ticket to handle the rest.

I am still waiting for the package to fully deploy, it is rather large.

Then I will start to debug this and either provide you the solution directly here in the forum or if needed, escalate this to the Developers directly.

Please allow me an hour or two to get back here.

#609752
Bildschirmfoto 2018-01-25 um 10.20.59.png

The Website features at least 2 PHP Errors:

( ! ) Notice: Use of undefined constant WP_ENV - assumed 'WP_ENV' in .../mu-plugins/disallow-indexing.php on line 12
( ! ) Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; DisableTrackbacks has a deprecated constructor in .../plugins/disable-trackbacks/disable-trackbacks.php on line 31

I disabled both Plugins before any other step.
Usually you do that by appending something to the Plugin's name folder, but in the case of disallow-indexing this seems not to work, so I needed to fully delete it.

When I logged in as the test user provided it redirects me to "hidden link", where firstly I saw above Errors (Since I debug with WP Debug active) and after I removed those errors, the page will not load, with the message "ERR_CONNECTION_REFUSED"
Note that the administrator can not see this page as well.

Anyway, it is reported to navigate to hidden link as the second user and use the CRED Edit Button.
However, there it tells "If you have an account with yoursite.COM".

I see your step #3 in your private reply above thou says:
"3) After logging in, click on My Music Gigs on the left on this page... hidden link"

I have no such link on the hidden link page
On this page there is the exact same login as on hidden link

I was able to log in with the provided WordPress Admin Login details, but that redirects me to your live site.

So, I cannot proceed at this step.

Can you help me?