Forum Replies Created

Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter dt60123

    (@dt60123)

    Hi could you help me with the above? Is there a way to do this with javascript?

    add_action(‘site-reviews/review/created’, function ($review) { if ($review->rating > 3) { glsr_log()->info($review->toArray()); } });

    Thread Starter dt60123

    (@dt60123)

    Thanks for this revised code, it works, but I’m still struggling to get my function to work, could you give me a javascript version of this? I don’t get on well with php.

    I’m trying to open a basic html popup if there is a positive review, but I always fail to get things working with php.

    • This reply was modified 3 years, 4 months ago by dt60123.
    Thread Starter dt60123

    (@dt60123)

    Thats great thanks for your help again,

    Unfortunately, I tried both of the following with no success. I added them by putting them in the theme’s functions.php file and I tried using the code snippets plugin. Either way it didn’t work and the submit review button got stuck going in a loop.

    add_action(‘site-reviews/review/created’, function ($review) { if ($review->rating > 3) { glsr_debug()->info($review->toArray()); } });

    add_action(‘site-reviews/review/created’, function ($review) { // Log the created review to the Site Reviews Console. glsr_debug()->info($review); });

    However, I was able to make this javascript version work:

    document.addEventListener(‘DOMContentLoaded’, () => { GLSR.Event.on(‘site-reviews/form/handle’, (response, form) => { if (false !== response.errors) return; console.log(‘review was submitted!’); });

    });

    Could you advise me on how to use javascript to achieve what this code is doing:

    add_action(‘site-reviews/review/created’, function ($review) { if ($review->rating > 3) { glsr_debug()->info($review->toArray()); } });

    Thanks again and sorry for the inconvenience.


    Thread Starter dt60123

    (@dt60123)

    Thanks so much, rookie error!

    could you advise on how to only log a message to the console if the review is positive?

    You have been very helpful, great plugin by the way!

    Thread Starter dt60123

    (@dt60123)

    Hi thanks.

    I found that one actually and it works just fine. I was only looking to redirect as a test to see if the hook is working.

    My actual goal is to trigger something else but the hook doesn’t seem to work. Can you confirm this does work and perhaps include an example where it is doing a simple function such as opening a tab or an echo?

    Thanks again

    Thread Starter dt60123

    (@dt60123)

    Thanks for your help, all done now.

    Thread Starter dt60123

    (@dt60123)

    Thanks so much!

    looking at it, it seems you’ve already thought of this and got it ready, perhaps for a future addon?

    I’m going to dig into this and see what I can do.

    Any other advice for someone who’s an amateur coder at best?

    Thread Starter dt60123

    (@dt60123)

    Not to worry, I needed to reactivate the plugin! Working now.

    thanks

    Thread Starter dt60123

    (@dt60123)

    Thanks for your response! I would like to apply it to an education site for marking exam papers. Lots of the questions are short answer which are great for HD Quiz but the long answer (open ended) questions are preventing me from taking the idea seriously.

    I imagine the process for the quizmaster being as follows:

    1) go to a quiz and click add new question
    2) enter the question and choose question type – long answer
    3) enter a series of points that must be addressed by the quizzer (guidance)
    4) choose the number of available marks

    I imagine the process for the quizzer being as follows:

    1) start a quiz
    2) get to a long answer question
    3) read the question and type a long-form or open-ended answer
    4) unhide the guidance, either at the end of the quiz or just after answering, (depending on what is easier for development)
    5) manually enter the number of points you scored or if tickboxes, tick the boxes
    6) quiz is scored as normal taking into account the self-marked questions.

    Step 7 – what a great quiz, maybe I’ll try another one.

    Thanks again for your help.

Viewing 9 replies - 1 through 9 (of 9 total)