Support Forum

Poll Plugin Error "A Simple press poll can only appear in a forum post"

EL Elsa
Elsa
Member
polls-error-1.jpg

I installed the poll plugin, everything was smooth.
I enabled permissions for all. I tried to post a poll and got this error.

I am not sure what I could be doing wrong.

Thanks!

 

26 Answers

New Answer

YS Yellow Swordfish
Yellow Swordfish
Member

I need to confer with Steve on this one and he will be gone for a few hours but we will get back to you on it…

(Steve: Is this going to be down to the in_the_loop() check? Will that always apply?)

YS Yellow Swordfish
Yellow Swordfish
Member

Excellent. Another voice for the Bronco’s…

MP Mr Papa
Mr Papa
Member

Andy, sorry, dont understand the question…   I too was rooting for the Broncos (not a fan of either though)…  not to be…

YS Yellow Swordfish
Yellow Swordfish
Member

Steve: Talking about the conditions needed to display the message Elsa is seeing. I.e., why is she getting that message?

MP Mr Papa
Mr Papa
Member

guess not connecting the dots on the in the loop question then…   will have to refresh my memory on what causes that error message… are you saying there is an in the loop check?  would be logical…

if so, what is the setting of you in the loop option on forum – integration – page and permalink?  I guess there could be a whacky wp theme displaying the forum outside the loop, but that would be odd..

EL Elsa
Elsa
Member

forum-integration.jpgThanks, Mr. Papa. Are these the settings you’re asking about?

YS Yellow Swordfish
Yellow Swordfish
Member

This was the point I was trying to make to Steve. The message is shown if (a) it is not a forum page and/or (b) not within what is called the WP ‘loop’. Well – clearly it IS a forum page you showed above so that just leaves the loop question. It is possible – but oddly non-standard – to display a page without using the loop. And we can probably test for that in the first instance.

On the above admin panel is the option to ‘Limit forum display to within WP loop’. Could you briefly turn that option on and save the panel and then go and see if the forum disappears when you reload it? (either way – change the option back of course!)

EL Elsa
Elsa
Member
forum-error.jpg

When I clicked “limit…” – this was the effect on the display.

 

Thanks.

YS Yellow Swordfish
Yellow Swordfish
Member

Well – I think that rather proves it. your WP theme is not using the standard routines for displaying a page and not defining the WP ‘loop’ bit working outside of it. It works but it does mean it bypasses WP API standards which means things can be missed so therefore it is marginally questionable.

I am going to have to think about this although, if you want to make a small edit I can show you what to change to enable polls to work for you.

BR Brandon
Brandon
Member

I help Elsa occasionally. If you would post that change I will make them and see what happens.

YS Yellow Swordfish
Yellow Swordfish
Member

Sure, The file is /sp-resources/forum-plugins/poills/library/sp-polls-components.php

At line 92 you will find this line of code:

if (!$spIsForum || !in_the_loop()) {

I suggest changing it to:

if (!$spIsForum) {

which is not perfect long term but good enough for this exercise.

MP Mr Papa
Mr Papa
Member

That code may be a hack for her (if it works), but not a general solution…  if a user puts it in a sidebar and it shows on the forum page, it will cause errors…

** edit…  ah, missed your last line…  so, just more explanation… ;)

BR Brandon
Brandon
Member

Thanks,

Just spit balling but maybe this would do it also?

if (!$spIsForum || !$inTopicLoop()) {