WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#4153 closed enhancement (fixed)

edit_post_link return/echo

Reported by: christianskarby Owned by: rob1n
Milestone: 2.3 Priority: normal
Severity: normal Version: 2.2
Component: General Keywords: has-patch commit
Focuses: Cc:

Description

I suggest the following API-change to allow for templates to decide whether the text should be displayed from within the edit_post_link function (legacy) or returned back as a string.

from: edit_post_link($link = 'Edit This', $before = '', $after = '')
to:   edit_post_link($link = 'Edit This', $before = '', $after = '', $echo=true)

Attachments (1)

4153.diff (3.0 KB) - added by rob1n 7 years ago.

Download all attachments as: .zip

Change History (22)

comment:1 christianskarby7 years ago

  • Cc christianskarby added
  • Keywords has-patch needs-testing added

comment:2 foolswisdom7 years ago

  • Milestone changed from 2.1.4 to 2.2

comment:3 ryan7 years ago

We can add get_edit_post_link() that returns the bare link. Output should be run through a 'edit_post_link' filter. edit_post_link() would then call get_edit_post_link(). Same can be done for edit_comment_link(). See all of the other get_*_link() functions.

comment:4 rob1n7 years ago

  • Keywords has-patch needs-testing removed
  • Owner changed from anonymous to rob1n

Yeah, having get_edit_post_link() makes sense.

comment:5 rob1n7 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [5275]) Add get_edit_comment_link() and get_edit_post_link(). fixes #4153

comment:6 kkwangen7 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

There was as missing " on line 296 in link-template.php causes the entire page/ post to becoming an edit this link. I've attached the fixed one I made.

comment:7 dpryo7 years ago

  • Priority changed from low to high

Seriously.

Where's the QA team? :)

I attached a patch. You probably understand.

comment:8 westi7 years ago

  • Keywords has-patch commit added
  • Priority changed from high to highest omg bbq
  • Severity changed from minor to normal
  • Status changed from reopened to new
  • Version changed from 2.1.3 to 2.2

/me slaps rob1n - test test test commit ;-)

comment:9 foolswisdom7 years ago

  • Keywords commit removed
  • Priority changed from highest omg bbq to normal
  • Resolution set to fixed
  • Status changed from new to closed

dpryo, no I don't understand, though attaching as a patch is appreciated.
I think this has already been corrected, [5276] (and then also [5277]).

comment:10 foolswisdom7 years ago

  • Keywords commit added
  • Priority changed from normal to highest omg bbq
  • Resolution fixed deleted
  • Status changed from closed to reopened

Nvr mind me.

comment:11 mdawaffe7 years ago

4153.diff

  1. dpryo's quote mark (keeps link from being displayed in browser).
  2. Get rid of unused variable.

comment:12 rob1n7 years ago

  • Severity changed from normal to blocker

comment:13 rob1n7 years ago

I'll tackle this when I get home.

comment:14 ryan7 years ago

get_edit_post_link() shouldn't return an anchor with href, just the link itself as do the other get functions. The link should be passed through a filter for those who want to change the link.

comment:15 ryan7 years ago

(In [5282]) Revert [5275] - [5277]. Fix it later. see #4153

comment:16 foolswisdom7 years ago

  • Priority changed from highest omg bbq to normal
  • Severity changed from blocker to normal

comment:17 rob1n7 years ago

  • Keywords has-patch commit removed

Okay, this time around:

  1. TEST TEST TEST (/me slaps self)
  1. get_edit_*_link() returns URL, not code
  1. Filters, filters, filters.

Working on a patch.

comment:18 rob1n7 years ago

  • Milestone changed from 2.2 to 2.3

rob1n7 years ago

comment:19 rob1n7 years ago

  • Keywords has-patch commit added

comment:20 ryan7 years ago

WP coding style doesn't put braces around one line if statements. Other than that, looks good.

comment:21 rob1n7 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

(In [5302]) get_edit_*_link() functions. fixes #4153

Note: See TracTickets for help on using tickets.