• HI all,
    Is there a way to modify a URL including a Tab id PLUS the Comment id in the same url?

    I’m. using the plugin Comment Email Reply
    https://www.ads-software.com/plugins/comment-email-reply/
    After each comment, I receive an email with this URL

    https://www.materassilecco.it/prodotti/materasso-dispositivo-medico-kuschelmed-de-luxe-aquatech/#comment-8

    Do you know guys If there is a possibility to include also the Tab id… something like…
    https://Url /#tab-reviews /#comment-8

    I have tried manually but the URL I generated is not working.
    Any suggestion is more than appreciated.
    Thanks in advance

    The plugin Code is this, any advice is more than appreciated.
    Thanks in advance

    ‘<?php
    /**
    * Plugin Name: Comment Email Reply
    * Plugin URI: https://kilozwo.de/wordpress-comment-email-reply-plugin
    * Description: Simply notifies comment-author via email if someone replies to his comment. Zero Configuration. Available in English and German. More languages welcome.
    * Version: 1.0.4
    * Author: Jan Eichhorn
    * Author URI: https://kilozwo.de
    * License: GPLv2
    */

    load_plugin_textdomain(‘cer_plugin’, false, basename( dirname( __FILE__ ) ) . ‘/languages’ );

    # Fire Email when comments is inserted and is already approved.
    add_action(‘wp_insert_comment’,’cer_comment_notification’,99,2);

    function cer_comment_notification($comment_id, $comment_object) {
    if ($comment_object->comment_approved == 1 && $comment_object->comment_parent > 0) {
    $comment_parent = get_comment($comment_object->comment_parent);

    $mailcontent = __(‘Hello ‘,’cer_plugin’).’ ‘.$comment_parent->comment_author.
    ‘,’.$comment_object->comment_author.’ ‘.__(‘ replied to your comment on’,’cer_plugin’).
    comment_post_ID).'”>’.get_the_title($comment_parent->comment_post_ID).
    :

    ‘.$comment_object->comment_content.’

    ‘.__(‘Go to it or reply:’,’cer_plugin’).
    comment_ID ).'”>’.get_comment_link( $comment_parent->comment_ID ).’‘;

    $headers = ‘MIME-Version: 1.0’ . “\r\n”;
    $headers .= ‘Content-type: text/html; charset=UTF-8’ . “\r\n”;
    $headers .= ‘From: ‘.get_option(‘blogname’).’ <‘.get_option(‘admin_email’).’>’ . “\r\n”;

    wp_mail($comment_parent->comment_author_email,'[‘.get_option(‘blogname’).’] ‘.__(‘New reply to your Comment’,’cer_plugin’),$mailcontent,$headers);
    }
    }

    # Fire Email when comments gets approved later.
    add_action(‘wp_set_comment_status’,’cer_comment_status_changed’,99,2);

    function cer_comment_status_changed($comment_id, $comment_status) {
    $comment_object = get_comment( $comment_id );
    if ($comment_status == ‘approve’) {
    cer_comment_notification($comment_object->comment_ID, $comment_object);
    }
    }
    ?>’

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    The tab ID is not available from a normal comment object such as that passed with the ‘wp_insert_comment’ action, unless some mechanism has been installed that you haven’t mentioned. I think you would likely need to build such a mechanism to pull this off.

    The current tab ID at the time of the comment needs to be saved somehow. The comment form could have a hidden field that passes the tab ID along with the other comment data. The script that manages swapping tabs would also need to update this field every time a new tab is selected.

    When the comment is submitted, the current tab hidden field value can be saved in commentmeta. When the plugin’s comment notification function runs, add code that grabs the tab value from commentmeta and use it to construct the URL in the email.

    Note that changes to plugin code will likely be lost when the plugin is updated. Keep a copy of your changes in a safe place so they can be reapplied after an update.

    Just FYI, it’s not a big deal, but for future reference, always post code between `backticks` or use the code button. Otherwise the forum’s parser could mangle your code. Also, when posting a sizable block of code, it’s preferable to use pastebin.com or similar to make your code accessible without having the bulk of the code distract from you post’s main message. pastebin.com also offers syntax highlighting as an option when publishing, which makes the pasted code much easier to read.

    Finally, you needn’t post code contained in the WP repository at all. Anyone can freely access such code themselves. If you want to make it easier for us, you could post a link to the plugin, even though the correct name alone is enough.

    Thread Starter 989

    (@989-1)

    hi bcworkz
    thanks for your time and kind explanation.

    That’s a pity!
    Unfortunately my programming skills are not so advanced and the mechanism you intend seems to be something too difficult for me.

    I will surely follow your suggestion for further posts, thanks again for any clarification and suggestion.

    all the best
    max

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Add Tab Comment IDs to the URL’ is closed to new replies.