WordPress.org

Make WordPress Core

Opened 10 years ago

Closed 5 years ago

#14510 closed enhancement (maybelater)

comment_notes_before does not work.

Reported by: hotforwords Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.0.1
Component: Comments Keywords: needs-patch dev-feedback
Focuses: Cc:

Description

I am unable to get the comment_notes_before to work.

Using the code:

comment_form(array( 'comment_notes_before' => 'some text' ));

... does not work. it just leaves the default text there.

comment_form(array( 'comment_notes_after' => 'some text' ));

... does work. It allows you to put whatever text you want.

Attachments (3)

comment-template.patch (967 bytes) - added by mrmist 10 years ago.
move the comment notes before maybe
Screen shot 2010-12-03 at 11.22.23.png (9.7 KB) - added by westi 10 years ago.
Example of what the change did to P2 while logged in
t14510-comment-notes-before-position-condition.diff (2.3 KB) - added by demetris 10 years ago.
Moves comment_notes_before, and gives it value only if the user is not logged in

Download all attachments as: .zip

Change History (21)

@mrmist
10 years ago

move the comment notes before maybe

#1 @mrmist
10 years ago

I suspect what you're looking at is the logged in view, where comment_notes_before is not shown. However, since this is inconsistent with comment_notes_after, I've added a quick patch which just moves the before bit out of the if test.

There may be a desire to play about with where the field belongs, or debate over whether it should be shown for the logged in user, etc.. (I.E. Is it a bug or not?)

#2 @mrmist
10 years ago

  • Keywords has-patch added; comments removed

#3 @yoavf
10 years ago

  • Cc yoavf added

+1 - the inconsistency with comment_notes_after is confusing and should be fixed

#4 @nacin
10 years ago

  • Milestone changed from Awaiting Review to 3.1

#5 @beaulebens
10 years ago

Patch makes sense to me -- positioning is inconsistent and doesn't make sense for likely use-cases of that text block.

#6 @ryan
10 years ago

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

#7 @westi
10 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

This change breaks the display of the required fields text:

$required_text = sprintf( ' ' . __('Required fields are marked %s'), '<span class="required">*</span>' );

It is now shown whether or not the commenter is logged in rather than only for logged our commenters.

#8 @westi
10 years ago

All the core default comment_notes are for logged out users.

We probably need to add a new action for them if we are going to move this one.

Reverting for now

#9 @westi
10 years ago

(In [16704]) Revert [16649] - The core output on this is for logged out users only - need to rework this if we want to move the output. See #14510

#10 @nacin
10 years ago

  • Component changed from General to Comments
  • Type changed from defect (bug) to enhancement

@westi
10 years ago

Example of what the change did to P2 while logged in

#11 follow-up: @nacin
10 years ago

Punt?

#12 in reply to: ↑ 11 ; follow-up: @westi
10 years ago

  • Keywords needs-patch added; has-patch removed
  • Milestone changed from 3.1 to Future Release

Replying to nacin:

Punt?

I think so - I'm not sure how to do this easily while keeping back compat on the current functionality.

We probably need a new arg rather than moving the current one.

#13 in reply to: ↑ 12 @demetris
10 years ago

Replying to westi:

Replying to nacin:

Punt?

I think so - I'm not sure how to do this easily while keeping back compat on the current functionality.

We probably need a new arg rather than moving the current one.

Maybe give a value to the arg only if the user is not logged in?

Attaching a tentative patch. I don’t like the ternary nesting very much, but that’s the only way I can think of that does not require an extra arg.

@demetris
10 years ago

Moves comment_notes_before, and gives it value only if the user is not logged in

#14 @nacin
10 years ago

This isn't backwards compatible though. One man's broken comment_notes_before (as reported here) is another man's logged-out comment_notes_before.

#15 @demetris
10 years ago

I see.

But now I have another question. Does P2 use comment_form() in an optimal way? Why not do something like the following?

First:

function p2_comment_form_defaults($args)
{
    $args['comment_notes_after']    = '';
    $args['comment_notes_before']   = '<p>' . __('Blah blah') . '</p>';
    # Etc. etc.
        
    return $args;
}

Then:

add_filter('comment_form_defaults', 'p2_comment_form_defaults');

And then simply:

comment_form();

This is a genuine question, not a rhetorical one. :-)

#17 @chriscct7
6 years ago

  • Keywords dev-feedback added

#18 @chriscct7
5 years ago

  • Milestone Future Release deleted
  • Resolution set to maybelater
  • Status changed from reopened to closed

No forward movement in 5 years. Closing as maybe later. Feel free to reopen if someone wants to continue pursuing this.

Note: See TracTickets for help on using tickets.