Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Require Name and Email Address #134

Open
robdehaven opened this issue Oct 28, 2015 · 18 comments
Open

Require Name and Email Address #134

robdehaven opened this issue Oct 28, 2015 · 18 comments

Comments

@robdehaven
Copy link

The requirement for a name and email address is not working with epoch. I have verified my settings under discussion and verified it works if I disable the epoch plugin and it does.

My client is a funeral home and the family of the deceased wants to know the names and in some cases get a list of the all email addresses of the "condolences"/comments left on an obituary. Allowing the comment to post without requiring this information is imperative. Plus, I would think you would want to support all the native features of Wordpress comments.

Please check into this.

Thanks!

@robdehaven
Copy link
Author

Oh and one more thing related to this. As you fix this issue, it would be nice to highlight the required fields of the "name" and "email address" fields in red or some other color to bring the commenters attention to them along with a popup error message explaining why the comment submission is not working. The built in Wordpress error that requires the user to use their back button is less than ideal especially on a mobile device.

@Vernal
Copy link
Contributor

Vernal commented Oct 28, 2015

Hey @robdehaven can you point me to the url where this problem is showing up? We do follow the native wp requirements but something must be going wrong. We've heard about it from one other user a few months ago but were unable to replicate. Maybe this will help us get more data....

@robdehaven
Copy link
Author

Oh yes, sorry I should have included that already. http://phelpsfunerals.com Please let me know what else I can do to assist with the resolution.

@Vernal
Copy link
Contributor

Vernal commented Oct 28, 2015

Hrm. This is sensitive. I don't know where I can safely leave a comment. Is there a super old post.. or a staging server? What should I do?

@robdehaven
Copy link
Author

You can test with the staging server. http://phelps.buzonya.net

@Vernal
Copy link
Contributor

Vernal commented Oct 28, 2015

Ok. I can confirm that I see the problem. Would it be possible to get
wp-admin on that staging server? If not, could you give me a list of all
active plugins?

On Wed, Oct 28, 2015 at 1:05 PM, robdehaven [email protected]
wrote:

You can test with the staging server. http://phelps.buzonya.net


Reply to this email directly or view it on GitHub
#134 (comment).

Jason G. Lemieux | Creative Director
Vernal Creative and Strategy
http://www.vernalcreative.com | New Number - 802.821.4059

@robdehaven
Copy link
Author

Yes of course you can have wp-admin access. Can I send you an email with login info?

@Vernal
Copy link
Contributor

Vernal commented Oct 28, 2015

Sweet. Let's use [email protected].

Thanks!
Jason

On Wed, Oct 28, 2015 at 1:14 PM, robdehaven [email protected]
wrote:

Yes of course you can have wp-admin access. Can I send you an email with
login info?


Reply to this email directly or view it on GitHub
#134 (comment).

Jason G. Lemieux | Creative Director
Vernal Creative and Strategy
http://www.vernalcreative.com | New Number - 802.821.4059

@robdehaven
Copy link
Author

You should have received the email with password reset link. Let me know if you didn't get it.

@Vernal
Copy link
Contributor

Vernal commented Oct 28, 2015

Man this is a huge mystery. I firmly narrowed it down to a conflict with something in the wooframework. What it is, I have no idea. But I checked on the other site that was having the same problem and they are on woo as well. Very interesting.

I don't know enough to be able to say if it is our problem, or theirs... but since they have eight gazillions dollars worth of resources maybe you'd have good luck asking them to look into it? I'll alert the other Epoch user that is having the same problem.

One other thing that came of this is I realized that the validation on the scenario when you do not leave a name/email (and your theme is working) could be better. I improved that.

Sorry I can't help more :(

Please do report back if you hear from them?

@robdehaven
Copy link
Author

Awesome Jason! Thanks again for taking a look and glad I could help even a little bit enhance your plugin. :)

I will check with Woo but since the theme this site is built with is a freebie, I doubt they will be of much assistance. I will post a question in their forums and see what happens. This client wants a redesign anyways, so I will play around with the Woo Canvas theme to see if it is a framework issue or just an issue with that particular theme.

I will certainly report back any and all info I get.

Thanks again!

@robdehaven
Copy link
Author

I just tried it using the canvas theme and it is definitely something with the framework not the theme itself. Since I have paid support for the Canvas theme, I will submit a ticket with them and let you know.

@Vernal
Copy link
Contributor

Vernal commented Oct 28, 2015

Whoohooo nice thinking! They very well may push this back in our court.. in
which case i wouldn't have a quick fix for you :(

On Wed, Oct 28, 2015 at 4:36 PM, robdehaven [email protected]
wrote:

I just tried it using the canvas theme and it is definitely something with
the framework not the theme itself. Since I have paid support for the
Canvas theme, I will submit a ticket with them and let you know.


Reply to this email directly or view it on GitHub
#134 (comment).

Jason G. Lemieux | Creative Director
Vernal Creative and Strategy
http://www.vernalcreative.com | New Number - 802.821.4059

@Arkadian1
Copy link

Well, let me chime in, if I may.
I have the Hustle theme (woo frame) - this is a PAID theme - and I am experiencing the same problem as described by Rob. I have to say it has been driving me demented and the reason why I haven't given up is because I didn't have an alternative (the native comments layout is awful...).

Anyway, I am glad it is not me :) The guys at Postmatic could not reproduce my bug, although they could see it on my computer.
I wonder if there is something amiss with the wooframe, then. I never thought of that...
I shall be monitoring this thread for updates.
My website is www.autosvezzamento.it.

@robdehaven
Copy link
Author

Hey @Vernal Well, as you suspected, Woo pushed it back to you. Here is their response.

Unfortunately there's not much I can do from my side as the commenting system does work as expected when Epoch is disabled. The only suggestion I have would be to forward a copy of the Canvas theme to the developer of that plugin - the WooFramework is contained within the the functions folder of Canvas.

I spent about 2 hours yesterday reading through all the code for the Canvas theme and also Epoch code. Nothing jumped out at me but I know enough to be dangerous. :)

I would be happy to email you a copy of the Canvas theme so you can do as they have suggested and look at the code in the functions folder. If nothing else, I would appreciate it if you could take a 20 minute look just to see if anything jumps out at you. I really love what Epoch does but if this can't get fixed, I will be forced to disable the plugin for now until another solution can be located.

Thanks again for your help.

Happy Friday and Happy Halloween's Eve!

@robdehaven
Copy link
Author

I have narrowed it down but don't know how to fix it. The file /includes/theme-actions.php has some modifications to the comments. I removed the following block of code and it does fix the problem.

/-----------------------------------------------------------------------------------/
/* Modify the default "comment" form field. /
/
-----------------------------------------------------------------------------------/
/
*

  • Modify the default "comment" form field.
    *

  • @Package WooFramework

  • @subpackage Filters
    */

    add_filter( 'comment_form_field_comment', 'woo_comment_form_comment', 10 );

if ( ! function_exists( 'woo_comment_form_comment' ) ) {
function woo_comment_form_comment ( $field ) {
$field = str_replace( '<label ', '<label class="hide" ', $field );
$field = str_replace( 'cols="45"', 'cols="50"', $field );
$field = str_replace( 'rows="8"', 'rows="10"', $field );

return $field;

} // End woo_comment_form_comment()
}

/-----------------------------------------------------------------------------------/
/* Add theme default comment form fields. /
/
-----------------------------------------------------------------------------------/
/
*

  • Add theme default comment form fields.
    *
  • @Package WooFramework
  • @subpackage Filters
    */

add_filter( 'comment_form_default_fields', 'woo_comment_form_fields', 10 );

if ( ! function_exists( 'woo_comment_form_fields' ) ) {
function woo_comment_form_fields ( $fields ) {
$commenter = wp_get_current_commenter();

$req = get_option( 'require_name_email' );
$aria_req = ( $req ? " aria-required='true'" : '' );

$fields =  array(
'author' => '<p class="comment-form-author"><input id="author" name="author" type="text" class="txt" tabindex="1" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . ' />' .
            '<label for="author">' . __( 'Name', 'woothemes' ) . ( $req ? ' <span class="required">(' . __( 'required', 'woothemes' ) . ')</span>' : '' ) . '</label> ' . '</p>',
'email'  => '<p class="comment-form-email"><input id="email" name="email" type="text" class="txt" tabindex="2" value="' . esc_attr(  $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . ' />' .
            '<label for="email">' . __( 'Email (will not be published)', 'woothemes' ) . ( $req ? ' <span class="required">(' . __( 'required', 'woothemes' ) . ')</span>' : '' ) . '</label> ' . '</p>',
'url'    => '<p class="comment-form-url"><input id="url" name="url" type="text" class="txt" tabindex="3" value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" />' .
            '<label for="url">' . __( 'Website', 'woothemes' ) . '</label></p>',

);

return $fields;

} // End woo_comment_form_fields()
}

/-----------------------------------------------------------------------------------/
/* Add theme default comment form arguments. /
/
-----------------------------------------------------------------------------------/
/
*

  • Add theme default comment form arguments.
    *
  • @Package WooFramework
  • @subpackage Filters
    */

add_filter( 'comment_form_defaults', 'woo_comment_form_args', 10 );

if ( ! function_exists( 'woo_comment_form_args' ) ) {
function woo_comment_form_args ( $args ) {
// Add tabindex of "field count + 1" to the comment textarea. This lets us cater for additional fields and have a dynamic tab index.
$tabindex = count( $args['fields'] ) + 1;
$args['comment_field'] = str_replace( '<textarea ', '<textarea tabindex="' . $tabindex . '" ', $args['comment_field'] );

    // Adjust tabindex for "submit" button.
    $tabindex++;

    $args['label_submit'] = __( 'Submit Comment', 'woothemes' );
    $args['comment_notes_before'] = '';
    $args['comment_notes_after'] = '';
    $args['cancel_reply_link'] = __( 'Click here to cancel reply.', 'woothemes' );

    return $args;
} // End woo_comment_form_args()

}

Now the really big question, can I just leave this stuff out and will it break anything long term? If you want to test it, the staging server still has this modification applied.

@Vernal
Copy link
Contributor

Vernal commented Nov 2, 2015

This is super helpful, Rob. I'm going to try to find someone to help with it (it's over my head). I'll keep it open until it gets resolved.

Jason

@wturrell
Copy link

wturrell commented Mar 29, 2017

Isn't this just a case of epoch looking for an HTML5 'required' attribute on the relevant form fields and submitting the comment regardless if there isn't one? i.e. in your hook for comment_form_default_fields you need to add required to the author and email.

e.g. this is what I have:


$fields = [
	'author' => '<div class="form-group comment-form-author"><label for="author">Name <span class="required">*</span></label> <input class="form-control" id="author" name="author" type="text" value="" size="30" required aria-required="true" /></div>',
	'email'  => '<div class="form-group comment-form-email"><label for="email">Email <span class="required">*</span></label> <input class="form-control" id="email" name="email" type="email" value="" size="30" required aria-required="true" /></div>',
	'url'    => '<div class="form-group comment-form-url"><label for="url">Website</label> <input class="form-control" id="url" name="url" type="url" value="" size="30" /></div>'
];

See also #234 re: validation, which I just opened.

What I can't understand is why the comment form fields have a required attribute on, say, twentysixteen - I see nothing in my own theme that would have removed them - it didn't have this hook before, or anything in twentysixteen that explicitly adds them (it still works in twentysixteen with the plugin active).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants