• Alex Stine

    (@alexstine)


    Hello,

    I would like to see a feature where if the “Not Useful” link is clicked, it would show a box with something asking “Why was this (post type) not useful to you?”, something along those lines. Any plans to add this? It would really help the collection of feedback and how to improve content.

    Thanks.

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Takahashi Fumiki

    (@takahashi_fumiki)

    Hi, @alexstine.

    I have no plan to add such feature because it’ll become very heavy. It requires form design, feedback list page for admin panel, custom message feature and so on.

    But you can catch the event with javascript. In plugin’s assets/js/anyway-feedback-handler.js, an event will triggered like below:

    target.trigger('feedback.afb', [( data.post_type === 'comment' ? 'comment' : 'post' ), data.object_id, data.class_name === 'good']);
    

    So, you can handle it with javascript like this.

    jQuery(document).on('feedback.afb', '.afb_container', function(event, type, postId, isGood){
        if(!isGood){
            // Do something to collect the reason.
        }
    });
    
    Thread Starter Alex Stine

    (@alexstine)

    Hey @takahashi_fumiki

    Alright, fair enough. Hopefully you will keep it on the list for a potential feature in the future.

    Is there anyway via PHP to hook in to the “Not Useful” link and once clicked it will redirect to a page with a form so the user can say why? If at all possible, it would be great to grab the current post URL and insert it in the form field.

    Thanks.

    Plugin Author Takahashi Fumiki

    (@takahashi_fumiki)

    @alexstine

    The straight way is like below:

    • Listen trigger when user click ‘no’, trigger AJAX action with data postId.
    • The Ajax endpoint returns URL of post.
    • Redirect user to the URL.

    But as my opinion, it’s not recommended because single click redirect will surprise your user. Showing confirm dialog is better.

    Thread Starter Alex Stine

    (@alexstine)

    Hello @takahashi_fumiki

    Would it be possible to open a modal after “Not Useful” is clicked with a ContactForm7 form inside? Then the form itself will auto grab the URL through the submissions section.

    So now all I need is the modal and to embed the form.

    Thanks.

    Plugin Author Takahashi Fumiki

    (@takahashi_fumiki)

    Hi, @alexstine

    Read this article to pass URL to ContactForm 7.

    Modal is javascript matter and it’s beyond my support for this plugin. It depends on your theme and there are many library to make modal component.

    Thread Starter Alex Stine

    (@alexstine)

    @takahashi_fumiki

    Thanks, got the basic functionality, this will be good for now.

    Thread Starter Alex Stine

    (@alexstine)

    Hello

    I’m revisiting this now that I have more php knowledge. Can you help me out with where I went wrong with the jQuery? Basically what should happen with my setup is if the “Bad” link is clicked, it should open a page in a new tab which contains the form from ContactForm7. I then use some additional php in a custom template to pass the referring URL in a hidden form field. I just can’t get the jQuery to open the new tab. Here’s what I have in footer.php

    <?php
    /*Only load on posts*/
    if(is_single() ) { ?>
    <script type="text/javascript">
    jQuery(document).on('feedback.afb', '.afb_container', function(event, type, postId, isGood){
    	if(!isGood){
    		window.open("https://thenewstriangle.com/feedback/");
    	}
    }
    </script>
    <?php } ?>

    Test Post URL: https://thenewstriangle.com/blog/2017/01/29/testing/
    Password: test123

    Thanks for any assistance you’re able to provide.

    Plugin Author Takahashi Fumiki

    (@takahashi_fumiki)

    @alex Hi, it’s been ages ??

    At first, you have syntax error.

    jQuery(document).on('feedback.afb', '.afb_container', function(event, type, postId, isGood){
    	if(!isGood){
    		window.open("https://thenewstriangle.com/feedback/");
    	}
    } );
    </script>
    

    misses ); just before closing script tags.

    You should check your browser’s console window. There is a syntax error.

    Thread Starter Alex Stine

    (@alexstine)

    Hello @takahashi_fumiki,

    Yes it’s been a minute. ?? I just updated the code you gave me and it does not seem to work, please check the test post.

    I cannot use my browser console because of accessibility issues with my screen reader.

    Further help would be much appreciated.

    Thanks.

    Plugin Author Takahashi Fumiki

    (@takahashi_fumiki)

    Hi, @alextine.
    I’ll try to write the simplest code for event handling.
    Please be patient.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Collect Negative Feedback’ is closed to new replies.