• Resolved mzudemd

    (@mzudemd)


    We recently discovered that the correct answer of a linked question is not displayed anymore. I use a freshly updated version of Football Pool and no extensions (at least while testing).

    The question is closed and has the answer set.

    Is there anything I’m doing wrong? Have you got any idea of what to check to fix this?

    • This topic was modified 4 months, 1 week ago by mzudemd.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author AntoineH

    (@antoineh)

    Looking at the code, I see that the admin answer can only be shown on the user page (where it shows the predictions for a single user), not on the prediction form. I am not entirely sure it this was different in earlier versions (can’t remember).

    All I know is that I, at some point, combined some code because it is easier to maintain only one template for the bonus questions instead of two different ones. There is of course a possibility that I forgot something and introduced some regression while combining the two parts. I will have look and investigate if I can easily add this (again) in a future version (v2.12.0).

    Thread Starter mzudemd

    (@mzudemd)

    I managed to find out that I need to use the hook footballpool_print_bonus_question_template and it seems that the parameter is %admin_answer%, but this one is just empty while the corresponding %user_answer% displays the label “my answer” plus the value (by the way: is there any way to translate or tweak that “my answer”? Only way I found is changing it right in the original plugin source code, which obviously isn’t best practice).

    I’ll keep trying!

    Plugin Author AntoineH

    (@antoineh)

    The %admin_answer% parameter is empty because there is some logic in the code that prevents the answer to be shown on the prediction form. The templates themselves do not contain logic, they’re simple text replaces when being outputted; any logic has to be done while defining the parameters array.

    As mentioned, I’ll fix this in a future version. But if you already want to do it in your extension, then you can use the footballpool_print_bonus_question_params filter to simply overwrite the $params['admin_answer'] value. Some lines above this filter (in the plugin code) show how the admin_answer is set up.

    Thread Starter mzudemd

    (@mzudemd)

    Yeah! Overwriting the params was the key, fixes multiple of my issues at once. Thanks! ??

    Plugin Author AntoineH

    (@antoineh)

    Good to hear that you found the correct filters to change what you wanted.

    Regarding:

    is there any way to translate or tweak that “my answer”?

    Is this question still relevant? And if so, do you only want to change the text? In that case you can, of course, make it part of your template changes, but another approach would be to create a custom translation file (MO file) with this one string translated and load this via an extension. All translatable strings in the plugin can get a custom translation with this technique; also the ones that are not part of a changeable template. The FAQ contains some more info about this.

    Thread Starter mzudemd

    (@mzudemd)

    That’s actually what we are doing with Loco Translate, but for some reason “my answer” and “correct answer” do not seem to be translatable, which is why I replace those parts in my extension now.

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.