2.1.0

  • Make help text sticky
  • Add 'vote' button for multiple votes at once w/o vote change perm
    • This UI only appears if the user cannot change votes & can vote for multiple options, allowing them to select all options they want to vote for before sending the data to Flarum
  • Add poll option to prevent users from changing their vote

NOTE: It seems seeing the options you yourself voted now might be hard - or even impossible - after this change, since it removes the checkboxes. I'll see about making it clearer what you voted for vs others, but I don't have time for it today.

2.1.1

  • Clearly show voted-for options again
  • Use mix-blend-mode to make option text more readable
    • Depending on the primary & secondary colors your forum uses (and light/dark mode), this might make it look better or worse. It can be disabled through a setting in the admin panel.
  • Adjust some other colors to not be hardcoded

Screenshots



Custom Mixing Options

if you wish to select a custom mixing option yourself (because eg. one of them looks better with your setup), you can do so with custom LESS.

.Post-poll .PollOptions .PollAnswer {
    &-checkbox, &-text {
        & when (@config-dark-mode =true) {
            mix-blend-mode: <value in dark mode>;
        }
        & when (@config-dark-mode =false) {
            mix-blend-mode: <value in light mode>;
        }
    }
}

@datitisev

I have a question about 2.1.0

I have a question:

If I put "change votes" permission to members.
If I disable "change votes" option when creating a poll.

Members can change their votes ? As Admin, I can do it.... Is this normal ?

    Hi, I'm trying to upgrade from 1.4 to 2.x. I followed the steps but got some table errors when doing the migration steps with composer (using composer2)

    "Base table or view already exists: 1050 Table "post_mentions_tag"...

    And the Flarum logs say "Can't DROP FOREIGN KEY polls_discussion_id_foreign"

    In my case, I do have users that have posts with Polls. How would I proceed? Or is it a worst case that the polls in the old version will be lost if I want to upgrade?

      MikeLundahl The error Base table or view already exists: 1050 Table "post_mentions_tag" is from a flarum/tags v1.8.0 migration... unrelated to this extension. But if you're having issues there, those might expand to this extension too.

      Is there more in the "Can't DROP FOREIGN KEY" error? I assume it ends with "check that it exists", but I'm not that familiar with SQL errors to know for sure. If it does, could you check the last migration of fof/polls that ran (in migrations table, last entry with extension = 'fof-polls') and also send the table structure? The column discussion_id in polls table should have a foreign key...


      Just to be aware, if you attempt to downgrade to 1.4, your permissions will be messed up, since they were renamed on the migration that probably last succeeded (2023_07_05_000001_rename_permissions). In this case, I'd recommend deleting all discussion.polls.*, tagID.discussion.polls.*, and polls.* permissions in the group_permissions table before downgrading, otherwise you'll encounter errors again when upgrading. Again, only if you plan on downgrading back to a working version and don't have backups available.

        Wlork In Flarum, admins generally have permission to do anything. Members shouldn't be able to change their votes in that poll, but admins will be able to unless explicitly stated. I don't know what option makes the most sense here.

          datitisev Thanks!

          Here's the last row in the migrations table.
          2023_07_05_000001_rename_permissions fof-polls

          and the polls table structure

            MikeLundahl Looks like the foreign key is there... not entirely sure why it would be erroring. Perhaps someone else with more SQL knowledge than me can help.

              datitisev What would happen if I made a clean install of the latest plugin if I have users with old posts that used version 1.4? Will it cause any problems?

              Or should I use 1.4 while trying to solve the migration? This is the only thing I have left besides testing the forum before I launch it.

                datitisev

                You're right. It works very well, I just wanted to understand 🙂

                I've installed the latest update and it doesn't work for me. I mean, using dark gray/black as a secondary color, it makes the answers unreadable, even disabling the option in Admin. I think it would have been better to use the primary color.

                Thanks to CSS, I've fixed it by putting our votes in my primary color

                  Wlork Yeah, it's hard to make it work for everyone. It was already supposed to be using the secondary color as background for voted options, but some update broke the CSS selector. I just fixed it and tried to introduce options to make it work for more people.


                  MikeLundahl You can't import 1.4 data into 2.x directly. You'd have to modify the data before importing it to change from discussion_id to post_id.

                  Was there any more in the error regarding DROP FOREIGN? I feel like there should've been - though if it is what I think it won't be very helpful anyway.

                  ⚠️ NOTE: Read my message datitisev before deciding to continue

                  You could try the following. However, since this migration was erroring, and I'm not entirely sure why, others after might as well. So again, backup beforehand. This performs the failing migration manually:

                  1. Dropping the foreign key yourself (make discussion_id not have a foreign relation)
                  2. Renaming discussion_id column to post_id
                  3. Adding a row to migrations table:
                    INSERT INTO
                        `migrations` (`migration`, `extension`)
                    VALUES
                        (
                            '2023_07_08_000000_rename_polls_discussion_id_column',
                            'fof-polls'
                        );
                  4. Run php flarum migrate to run the remaining migrations

                    datitisev we encountered this issue on Blomstra stack too. Can you perhaps split the migration of dropping the foreign and renaming the column? This is the safer approach when running fault-tolerant migrations, because bundling changes in one migration will cause the install to hang halfway without the ability to rollback or retry.

                      MikeLundahl Based on luceos's recommendation, I'm currently splitting the migrations to see if this resolves some issues. I recommend you hold off until I release this version to allow for less issues in the future & whether it potentially solves your problem.

                        datitisev Yeah, it's hard to make it work for everyone. It was already supposed to be using the secondary color as background for voted options, but some update broke the CSS selector. I just fixed it and tried to introduce options to make it work for more people.

                        Thanks, I'm waiting for the update 🙂

                          Wlork Oh sorry, I don't think I was clear. I meant that update 2.1.1 fixed that not working - I don't have any more changes planned. I don't think primary color would work well for everyone since that might be too much primary.

                          I did forget to mention - you can change the colors easily with the following CSS:

                          :root {
                              --poll-option-color: <color of bar when user did not vote for it>;
                              --poll-option-active-color: <color of bar when user voted for it>;
                          }
                          23 days later

                          I see the option to include an image with the various poll choices, is there a way to include a YouTube video or TikTok video on each poll option? When you paste the TikTok video url or YouTube url it embeds the video so users can vote on videos instead of either text or images?

                          11 days later

                          Is there a way to filter polls in a forum?

                          I was looking for a way to show all polls in a forum, but had no luck with tags and permissions, so I've started a Feature Request.

                          Please let me know if there is another way.

                          a month later

                          SO I had this problem where I couldn't activate the extensions because the tables existed already. I have imported my old PHPBB forum to Flarum using the Nitro Porter tool, include my old phpbb polls. Then I installed the fof-polls extension and activation would work because of conflicting table names (3 tables)... then to activate fof-polls and get it running with all of my old polls data, I needed to rename the imported tables (so that the ext could activate and create its own tables) and then migrate the data from the old tables to the new one. of course some other issues arose (many non compatible settings, column names etc.) and long story short I created a php script to deal with it all and decided to share it for anyone who might face the same issue : you can find it here https://github.com/WalsGit/phpbb_polls_migration (feel free to adapt it to you situation and settings of course)

                          23 days later