Opened 10 years ago
Closed 10 years ago
#5853 closed defect (bug) (fixed)
WP Edit button on BuddyPress pages
Reported by: | SGr33n | Owned by: | r-a-y |
---|---|---|---|
Milestone: | 2.1 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Core | Keywords: | has-patch |
Cc: |
Description
Hi,
On same BuddyPress pages, the WP edit button is present. Now, if you click on that button, since that no post is given, you will redirect to the list of posts. I suggest to hide via css that button until it will not be possible to give it the right action. E.g. on the profile page, it should direct to the edit profile in the admin area.
Attachments (3)
Change History (24)
#1
@
10 years ago
- Milestone changed from Awaiting Review to 2.1
- Owner set to r-a-y
- Status changed from new to assigned
- Type changed from enhancement to defect (bug)
#3
@
10 years ago
This looks right to me. Would like verification from SGr33n that it addresses the problem.
This ticket was mentioned in IRC in #buddypress-dev by jjj. View the logs.
10 years ago
#5
@
10 years ago
I don't think this is a new issue; I think I've seen it around for a long time, and vaguely recall asking JJJ about it, around the time theme compat. was introduced.
Looks like a nice way to address this, though if BP ever uses theme compat. templates for something like a widget sidebar (like bbPress does) on a non-BP page, this might end up removing the link on the WordPress content.
#6
@
10 years ago
Just tested; the Edit link doesn't show in 2.0.2, so I must have been remembering from when we've broken/fixed this before.
#7
@
10 years ago
Confirmed that r-a-y's patch fixes the Edit link that appears at (for example) the bottom of the default WordPress themes, but that it also breaks (not removes) the "Edit Page" button's link in the toolbar. Unhooking at least one item from the toolbar is beginning to make this look super messy.
As the "Edit Page" links only appear if you have the appropriate WP role/cap, I'm kinda tempted to suggest we leave this as-is for now and send a patch upstream for this line: https://core.trac.wordpress.org/browser/trunk/src/wp-includes/admin-bar.php?rev=29695#L530
#8
@
10 years ago
Just tested; the Edit link doesn't show in 2.0.2, so I must have been remembering from when we've broken/fixed this before.
See #5241 and r8821, and https://buddypress.trac.wordpress.org/ticket/5241#comment:14 :)
As the "Edit Page" links only appear if you have the appropriate WP role/cap, I'm kinda tempted to suggest we leave this as-is for now and send a patch upstream for this line: https://core.trac.wordpress.org/browser/trunk/src/wp-includes/admin-bar.php?rev=29695#L530
If r-a-y's proposed patch is producing side effects, then I agree with DJPaul that it's better to leave the (harmless) Edit button in place for now and to push for a more general solution. (Not sure what that would be - a filter?)
#9
@
10 years ago
Most themes' templates use edit_post_link
which creates the "Edit" link in the template; internally, it uses get_edit_post_link
to get the link. If get_edit_post_link
returns a falsey value, then edit_post_link
bails out and doesn't do anything (this is how r-a-y's patch work).
The toolbar uses get_edit_post_link
directly and doesn't check the return value from it in the same way that edit_post_link
does.
#10
@
10 years ago
Ah, thanks, DJPaul. https://core.trac.wordpress.org/ticket/29538
#11
@
10 years ago
Confirmed that r-a-y's patch fixes the Edit link that appears at (for example) the bottom of the default WordPress themes, but that it also breaks (not removes) the "Edit Page" button's link in the toolbar. Unhooking at least one item from the toolbar is beginning to make this look super messy.
Thanks for the spot, DJPaul.
02.patch
adds a workaround for the WP Toolbar.
I'll leave it to the consensus if it should be put in for 2.1. Though, I'll note that since it wasn't showing up in 2.0.x, then it's a regression. (Also, when we move to rewrite rules without this patch, this problem will also occur.)
#13
@
10 years ago
r-a-y - .02.patch looks fine for me. Agreed that it's a regression, and your patch looks simple enough. +1 from me.
#15
@
10 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
I think there's a potential issue with filtering get_edit_post_link using '__return_false'
.
If a plugin is using custom post types and is displaying one of its post type entry into a group, it won't be able to use get_edit_post_link(). For instance one of my plugin is failing since this commit.
Would it be possible to create a function a plugin could temporarly neutralize ?
Or best (from my point of view) : check if the post_id is empty and if so return false ?
#16
@
10 years ago
For instance 5853.03.patch is not displaying the edit link on BuddyPress pages but allows a plugin to get the edit link if one of it's post type ID is set (inside a group).
#17
follow-up:
↓ 18
@
10 years ago
Would it be possible to create a function a plugin could temporarly neutralize ?
Or best (from my point of view) : check if the post_id is empty and if so return false ?
I'm fine with this. Maybe add a filter in the new function as well for devs that need more control?
If a plugin is using custom post types and is displaying one of its post type entry into a group, it won't be able to use get_edit_post_link(). For instance one of my plugin is failing since this commit.
Got a link to the plugin so I can test?
#18
in reply to:
↑ 17
@
10 years ago
Replying to r-a-y:
Maybe add a filter in the new function as well for devs that need more control?
I agree, i think it's a very good idea
Got a link to the plugin so I can test?
Unfortunately, the plugin is still in "work in progress". But i've quicky made a new branch on another plugin so that you can test :
https://github.com/imath/altctrl-public-group/tree/r-a-y_tests
Once activated, if you go in the Group's Manage area, "control" subnav, you'll see an editor to create the group's home page. Once created, there will be a new button "Edit in WP Administration". The edit link is empty (unless you apply 5853.03.patch)
#19
follow-up:
↓ 20
@
10 years ago
Very neat plugin, imath!
03.patch
works for me. Make sure to add phpDoc for the filter function and it should be good to go.
Thanks for testing, SGr33n.
I have a feeling it has to do with the patch I made for #5810. Should be easy to fix though.