Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
plugins-topic
Poll Plugin Error "A Simple press poll can only appear in a forum post"
Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Feb 4, 2014 - 1:00 pm

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.

andy-signature.png
YELLOW
SWORDFISH
Avatar
Brandon
U.S.
SP Wrangler
Free Members
sp_UserOfflineSmall Offline
Feb 4, 2014 - 4:05 pm

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

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Feb 4, 2014 - 4:21 pm

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.

andy-signature.png
YELLOW
SWORDFISH
Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Feb 4, 2014 - 7:00 pm

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... ;)

Avatar
Brandon
U.S.
SP Wrangler
Free Members
sp_UserOfflineSmall Offline
Feb 4, 2014 - 9:12 pm

Thanks,

Just spit balling but maybe this would do it also?

if (!$spIsForum || !$inTopicLoop()) {
Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Feb 5, 2014 - 4:01 am

This will be the most likely fix. Give it a try perhaps while you are in the code there...

andy-signature.png
YELLOW
SWORDFISH
Avatar
Brandon
U.S.
SP Wrangler
Free Members
sp_UserOfflineSmall Offline
Feb 6, 2014 - 9:00 pm

Changing to !$inTopicLoop() didn't work. Forum page load froze when loading a topic with a poll.

I just went with your example since the site is live and can't really test.

@elsa.. You should be good to go but if not fixed in the next polls plugin update the change will be reverted. So check with the team here before updating that plugin.

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Feb 7, 2014 - 2:43 am

Apologies - i should have pointed out that there is no such function or variable as 'inTopicLoop'. It is a property of the topic view data object. We will sort this before another Polls update.

andy-signature.png
YELLOW
SWORDFISH
Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Feb 12, 2014 - 10:50 pm

The check you will want is:

    if (!$spIsForum || !isset($spTopicView) || !$spTopicView->inPostLoop) {

but be sure to declare $spTopicView global at top of routine...

Avatar
Elsa
Member
Free Members
sp_UserOfflineSmall Offline
Feb 13, 2014 - 3:00 pm

Just saw your warning. Thanks, Brandon, and friends!

 

Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 650
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 619
Members: 17363
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10127
Posts: 79625