[CDB] Poll on Index

A place for Extension Authors to post and receive feedback on Extensions still in development. No Extensions within this forum should be used within a live environment!
Get Involved
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: Extensions Development rules

IMPORTANT FOR NEEDED EVENTS!!!
If you need an event for your extension please read this for the steps to follow to request the event(s)
User avatar
kasimi
Former Team Member
Posts: 4900
Joined: Sat Sep 10, 2011 7:12 pm
Location: Germany
Contact:

[CDB] Poll on Index

Post by kasimi »

Extension Name: Poll on Index by kasimi

Extension Description: This extension displays selected polls on the index page.

Extension Version: 1.0.1

Development status: There are no known bugs. Please test, test, test. :)

Requirements:
  • PHP at least 5.5.0
  • phpBB at least 3.2.0
  • prosilver based style
Screenshots:
  • A poll on the index page. Users can vote without having to go to the topic.

    Image
  • The extension adds a new forum permission “Can show poll on index”.

    Image
  • When a users with this permission creates a poll, there is a new option that allows you to choose to display the poll on the index page, either indefinitely or until the poll ends.

    Image

Install path: ext/kasimi/pollonindex

Demo URL: https://kasimi.net

Extension Download: https://github.com/kasimi/phpbb-ext-pol ... master.zip

GitHub Repo: https://github.com/kasimi/phpbb-ext-pollonindex
User avatar
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco
Contact:

Re: [3.2][BETA] Poll on Index

Post by 3Di »

What happens when multiple polls have been selected to be shown on the index page?

I mean, what about the page layout.

Nice idea btw. :)
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Buy me a coffee -> Image
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
User avatar
kasimi
Former Team Member
Posts: 4900
Joined: Sat Sep 10, 2011 7:12 pm
Location: Germany
Contact:

Re: [3.2][BETA] Poll on Index

Post by kasimi »

In that case you will see multiple polls on the index page. The sooner a poll ends the higher it is ranked.

Note that you can achieve a similar result with the SiteMaker extension by blitze. The difference is that this extension is light weight, allows giving users permission to show polls on the index, and displays the polls a bit differently (wrapped in forabg).
User avatar
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco
Contact:

Re: [3.2][BETA] Poll on Index

Post by 3Di »

I see, okay.
I don't know.. I think there should be a sort of limitation like max 3 or so on though.

Ah, may I suggest a three radion buttons instead of the dropdown? :)
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Buy me a coffee -> Image
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
NastyBoy
Registered User
Posts: 137
Joined: Wed May 31, 2017 7:03 pm
Location: Germany
Name: Tim
Contact:

Re: [3.2][BETA] Poll on Index

Post by NastyBoy »

That is a cool ext. thank you for that
User avatar
noth
Registered User
Posts: 2528
Joined: Fri Jan 07, 2005 7:10 pm
Location: North Surrey
Contact:

Re: [3.2][BETA] Poll on Index

Post by noth »

yeah what a great idea! Very nice!

the way the permissions is set up is fine, there is no Ext tab control, instead you go to the specific poll(s) that you want featured on the index and use a drop down at the bottom to flag that that poll will display on the index NOT BAD !! works great !! :D
User avatar
mrgtb
Registered User
Posts: 603
Joined: Wed Oct 03, 2007 10:51 am

Re: [3.2][BETA] Poll on Index

Post by mrgtb »

Very nice, good idea as well to show a vote poll on index page.

I have noticed something though. If you have a guest forum added and allow guests to create and vote on polls on that forum, along with start topics and post replies. While they can cast a vote from the thread itself on the vote poll, or reply to it with a post, they cannot vote from the index page if having permission to vote on polls on the forum its added on as a guest. But members can vote from the index page on the vote poll added on it. Not a biggie, but thought I'd mention it with guests when they have permission to vote on a forum with polls.

I have also noticed looking at my site using Internet Explorer 11 on Windows 7 and not FireFox looking at the Vote Poll. That FA icon used in the header bar is making the header area bigger (taller) than the rest of the other header bars used on index page.

<i class="icon fa-bar-chart fa-fw" aria-hidden="true"></i>

So I would remove the FA icon and not show that in the header bar. I removed it from the poll template testing and now the header bar is the same size as all others on the index page without it displayed before the Poll text in IE
User avatar
kasimi
Former Team Member
Posts: 4900
Joined: Sat Sep 10, 2011 7:12 pm
Location: Germany
Contact:

Re: [3.2][BETA] Poll on Index

Post by kasimi »

mrgtb wrote: Tue Sep 18, 2018 6:51 pm I have noticed something though. If you have a guest forum added and allow guests to create and vote on polls on that forum, along with start topics and post replies. While they can cast a vote from the thread itself on the vote poll, or reply to it with a post, they cannot vote from the index page if having permission to vote on polls on the forum its added on as a guest. But members can vote from the index page on the vote poll added on it. Not a biggie, but thought I'd mention it with guests when they have permission to vote on a forum with polls.
I can't reproduce this with phpBB 3.2.3. I gave the guest group the "Can vote in polls" permission in a forum an existing poll was in and guests were able to vote both in the topic and on the index page.
User avatar
mrgtb
Registered User
Posts: 603
Joined: Wed Oct 03, 2007 10:51 am

Re: [3.2][BETA] Poll on Index

Post by mrgtb »

kasimi wrote: Fri Sep 21, 2018 4:59 pm
mrgtb wrote: Tue Sep 18, 2018 6:51 pm I have noticed something though. If you have a guest forum added and allow guests to create and vote on polls on that forum, along with start topics and post replies. While they can cast a vote from the thread itself on the vote poll, or reply to it with a post, they cannot vote from the index page if having permission to vote on polls on the forum its added on as a guest. But members can vote from the index page on the vote poll added on it. Not a biggie, but thought I'd mention it with guests when they have permission to vote on a forum with polls.
I can't reproduce this with phpBB 3.2.3. I gave the guest group the "Can vote in polls" permission in a forum an existing poll was in and guests were able to vote both in the topic and on the index page.
Visit my forum, the link is my signature below and you can see the vote poll on the index page. I'm also running the very latest phpBB version and you can see in the topic you can vote, but not on the index page as a guest.

I have guests setup to be able to create polls/vote on polls on that guest forum. They can't "change a vote" though, that is set to no for them.

This is the forum permissions I have set for guests on that guest forum:

Can create polls (Yes)
Can show poll on index (No)
Can vote in polls (Yes)
Can change existing vote (No)
User avatar
kasimi
Former Team Member
Posts: 4900
Joined: Sat Sep 10, 2011 7:12 pm
Location: Germany
Contact:

Re: [3.2][BETA] Poll on Index

Post by kasimi »

Does this help?
  • Open ext/kasimi/pollonindex/event/listener.php
  • Find

    Code: Select all

    $cur_voted_id = explode(',', $this->request->variable($cookie_name, '', true, request_interface::COOKIE));
    
  • Replace with

    Code: Select all

    $cur_voted_id = $this->request->variable($cookie_name, '', true, request_interface::COOKIE);
    $cur_voted_id = $cur_voted_id ? explode(',', $cur_voted_id) : [];
    
User avatar
mrgtb
Registered User
Posts: 603
Joined: Wed Oct 03, 2007 10:51 am

Re: [3.2][BETA] Poll on Index

Post by mrgtb »

I just did that edit and replaced the file. Seems okay now
User avatar
kasimi
Former Team Member
Posts: 4900
Joined: Sat Sep 10, 2011 7:12 pm
Location: Germany
Contact:

Re: [3.2][BETA] Poll on Index

Post by kasimi »

I pushed some fixes. You can update the usual way: disable extension, delete old extension folder, upload new extension folder, enable extension.

Changes:
  • Fixed voting for guests
  • Changed poll option's select box to radio buttons
  • Display topic title in the header bar
  • Removed FontAwesome icon from header bar
There is a bug when voting while multiple polls are displayed on the index. In this situation, prosilver animates the results of all polls, not just the one you've voted for. The fix requires a core edit: https://github.com/phpbb/phpbb/pull/5366/files which means the extension eventually will require phpBB 3.2.4 and won't be submitted to the CDB before 3.2.4 is released.
User avatar
mrgtb
Registered User
Posts: 603
Joined: Wed Oct 03, 2007 10:51 am

Re: [3.2][BETA] Poll on Index

Post by mrgtb »

So you have updated the extension on Github now. And you can actually make that CORE file edit to the ajax file with Prosilver theme to work proper with multiple poles displayed on index page before phpBB 3.2.4 comes out, if don't want to wait for it being done in that version later? As phpBB 3.2.4 could possibly be 3-6 months away yet, seeing as 3.2.3 has only just been released this week. Meaning 3.2.4 is not really coming anytime soon.

Anyway, I installed the latest version with your changes and did that core prosilver file edit to ajax file because I've already changed prosilver theme a fair bit. Not an issue for me doing it before 3.2.4 comes, also stuck two vote polls on index now to see what happens
User avatar
kasimi
Former Team Member
Posts: 4900
Joined: Sat Sep 10, 2011 7:12 pm
Location: Germany
Contact:

Re: [3.2][BETA] Poll on Index

Post by kasimi »

Extensions that require core edits to properly function wouldn't pass CDB validation anyway so there really is no point in submitting it before 3.2.4 is out. I understand it could take a while but that's how it is. In the meantime, let's keep testing. :)
User avatar
mrgtb
Registered User
Posts: 603
Joined: Wed Oct 03, 2007 10:51 am

Re: [3.2][BETA] Poll on Index

Post by mrgtb »

Yeah, I understand that. Which is why I made the core edit now to use it proper with two polls on index testing.

When you say there was a problem with "animation", why the core file edit was needed to ajax. Do you mean when you have not voted and click the button to "show results". If you had two polls displayed on index page it was showing the same animation for both?
Locked

Return to “Extensions in Development”