• bbm2000

    (@bbm2000)


    I’m trying to figure out if I can put the subscription check box before the comment submit button.
    I see that subscribe_reloaded_show() function echoes the check box, but I need a similar function that returns the check box which I can then use in the WordPress comment_form() function.
    Or is there another way to do this?
    Thanks for the great plugin.

    https://www.ads-software.com/plugins/subscribe-to-comments-reloaded/

Viewing 11 replies - 1 through 11 (of 11 total)
  • popsantiago

    (@popsantiago)

    Hello,

    I do some change in the plugin folder >
    subscribe-to-comments-reloaded.php Line 86
    Change
    add_action(‘comment_form’, ‘subscribe_reloaded_show’);
    to
    add_action(‘comment_form_after_fields’, ‘subscribe_reloaded_show’);

    This change put the checkbox after the url field.

    Pop

    Thread Starter bbm2000

    (@bbm2000)

    Thanks Pop, but modifying a plugin code definitely isn’t an option for me, as it’s for a client site.
    Besides, when you do the hack you suggested, you don’t see the manage subscription option when you are logged in…

    Hello, bbm2000 My answer is the same as Pop. Another way will be to change you design code. Let me see if I can come with something to help you ??

    Thread Starter bbm2000

    (@bbm2000)

    Yeah It’s not a deal breaker if it can’t be done at the moment, but ideally, I’d like to put the check box right above the submit button. I just wish there was an intermediate function for subscribe_reloaded_show() that returns the html as a php value…

    Hello Guys version 140128 is now available with new fixes and upgrades.

    Regards !!

    This is still an issue and I agree that the checkbox after the submit button is not perfect.
    I’d like to have the the subscription checkbox between the comment field resp. the comment field notes below it and the submit button. But the WordPress core don’t provide an action hook to achieve this. I created an issue to add a new action hook comment_form_after_comment: https://core.trac.www.ads-software.com/ticket/27080. Let’s see if this will be considered in the future.

    I got a tip from Sergey Biryukov (see https://core.trac.www.ads-software.com/ticket/27080) to adjust the form’s default value of comment_notes_after. This could be a general solution for this plugin.

    I use this plugin now in the following way which is kind of a workaround, but the checkbox is located between comment field and submit button (see https://travel.bjoerne.com/). In the option area of this plugin I set Enable default checkbox to No. In my theme code I replaced

    comment_form();

    with

    $default_comment_notes_after = '<p class="form-allowed-tags">' . sprintf( __( 'You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes: %s' ), ' <code>' . allowed_tags() . '</code>' ) . '</p>';
            ob_start();
            subscribe_reloaded_show();
            $subscribe_reloaded_show = ob_get_clean();
            $comment_notes_after = $default_comment_notes_after.'<p>'.$subscribe_reloaded_show.'</p>';
            comment_form(array('comment_notes_after' => $comment_notes_after));

    It works but it would be glad if there will be a more elegant solution provided by the plugin out-of-the-box.

    Or in a cleaner way according to Sergey’s suggestion:
    Keep comment_form() as it is and add the following code to your theme (e.g. functions.php if it exists):

    function comment_subscription_after_comment_notes( $defaults ) {
        ob_start();
        subscribe_reloaded_show();
        $subscribe_reloaded_show = ob_get_clean();
        $defaults['comment_notes_after'] .= '<p>'.$subscribe_reloaded_show.'</p>';
        return $defaults;
    }
    add_filter( 'comment_form_defaults', 'comment_subscription_after_comment_notes' );

    @bjoerne Thank you very much for sharing your solution! I will add this to the FAQ for the plugin in case others would like to do the same.

    Hi, thanks for the solution Raam Dev, but how would I wrap this in an ‘if function exists’ statement in case the plugin is disabled?

    Thanks
    David

    Hi, also just noticed a ‘.’ before the ‘=’ in this line. Should this be there?

    $defaults[‘comment_notes_after’] .=

    Thanks
    David

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Place it before comment submit button?’ is closed to new replies.