Adding a poll


Going from Social->Polls will take me to the "Poll archive" page, which lists all of the available polls. From here, I am not seeing an option to "Add" (or create) a new poll. I am finding that you need to actually "view" an existing poll in order to see the "Add" option (at the bottom of the form next to View results). That doesn't seem very intuitive to me.
Am I missing something? Is there, perhaps, a way to have the "Add" poll option be available in a more intuitive place (like at the bottom of the Poll archive page, for exampe)?
Thanks in advance for your help!


I'm not going to commit that change for v10 as it's not a bug and we shouldn't actively add features to people's sites that may break people's pre-existing assumptions, but I quickly made a patch you can apply manually, and then you can save your altered version as an override (site/pages/modules_custom/polls.php).
Code (Diff)
index 5f1b4a0cd..22e38ad4d 100644
--- a/site/pages/modules/polls.php
+++ b/site/pages/modules/polls.php
@@ -265,7 +265,14 @@ class Module_polls
{
$content = do_block('main_multi_content', array('param' => 'poll', 'efficient' => '0', 'zone' => get_zone_name(), 'sort' => 'recent', 'max' => '20', 'no_links' => '1', 'pagination' => '1', 'give_context' => '0', 'include_breadcrumbs' => '0', 'block_id' => 'module', 'guid' => 'module'));
- return do_template('PAGINATION_SCREEN', array('_GUID' => 'bed3e31c98b35fea52a991e381e6cfaa', 'TITLE' => $this->title, 'CONTENT' => $content));
+ // Action links
+ if ((has_actual_page_access(null, 'cms_polls', null, null)) && (has_submit_permission('mid', get_member(), get_ip_address(), 'cms_polls'))) {
+ $submit_url = build_url(array('page' => 'cms_polls', 'type' => 'add', 'redirect' => get_self_url(true, false)), get_module_zone('cms_polls'));
+ } else {
+ $submit_url = new Tempcode();
+ }
+
+ return do_template('PAGINATION_SCREEN', array('_GUID' => 'bed3e31c98b35fea52a991e381e6cfaa', 'TITLE' => $this->title, 'CONTENT' => $content, 'ADD_URL' => $submit_url));
}
/**
Become a fan of Composr on Facebook or add me as a friend. Add me on on Mastodon. Follow me on Minds (where I am most active). Support me on Patreon
- If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
- If so, please let others know about Composr whenever you see the opportunity or support me on Patreon.
- If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying Composr on fun personal projects.
- If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.


Chris Graham said
Right, that's how it is, and I agree it's not very good. I just improved it for v11.
I'm not going to commit that change for v10 as it's not a bug and we shouldn't actively add features to people's sites that may break people's pre-existing assumptions, but I quickly made a patch you can apply manually, and then you can save your altered version as an override (site/pages/modules_custom/polls.php).Code (Diff)
diff --git a/site/pages/modules/polls.php b/site/pages/modules/polls.php
index 5f1b4a0cd..22e38ad4d 100644
--- a/site/pages/modules/polls.php
+++ b/site/pages/modules/polls.php
@@ -265,7 +265,14 @@ class Module_polls
{
$content = do_block('main_multi_content', array('param' => 'poll', 'efficient' => '0', 'zone' => get_zone_name(), 'sort' => 'recent', 'max' => '20', 'no_links' => '1', 'pagination' => '1', 'give_context' => '0', 'include_breadcrumbs' => '0', 'block_id' => 'module', 'guid' => 'module'));
- return do_template('PAGINATION_SCREEN', array('_GUID' => 'bed3e31c98b35fea52a991e381e6cfaa', 'TITLE' => $this->title, 'CONTENT' => $content));
+ // Action links
+ if ((has_actual_page_access(null, 'cms_polls', null, null)) && (has_submit_permission('mid', get_member(), get_ip_address(), 'cms_polls'))) {
+ $submit_url = build_url(array('page' => 'cms_polls', 'type' => 'add', 'redirect' => get_self_url(true, false)), get_module_zone('cms_polls'));
+ } else {
+ $submit_url = new Tempcode();
+ }
+
+ return do_template('PAGINATION_SCREEN', array('_GUID' => 'bed3e31c98b35fea52a991e381e6cfaa', 'TITLE' => $this->title, 'CONTENT' => $content, 'ADD_URL' => $submit_url));
}
/**
From “Post #6,663”, 7th May 2020, 3:49 am
Excellent. Thanks Chris.
I'll check this updated code out first thing tomorrow. I agree we don't want to break anybody's pre-existing assumptions. That would not be helpful. But thanks for providing me with an interim fix…since my site members will be new to Composr.


Chris Graham said
Right, that's how it is, and I agree it's not very good. I just improved it for v11.
I'm not going to commit that change for v10 as it's not a bug and we shouldn't actively add features to people's sites that may break people's pre-existing assumptions, but I quickly made a patch you can apply manually, and then you can save your altered version as an override (site/pages/modules_custom/polls.php).Code (Diff)
diff --git a/site/pages/modules/polls.php b/site/pages/modules/polls.php
index 5f1b4a0cd..22e38ad4d 100644
--- a/site/pages/modules/polls.php
+++ b/site/pages/modules/polls.php
@@ -265,7 +265,14 @@ class Module_polls
{
$content = do_block('main_multi_content', array('param' => 'poll', 'efficient' => '0', 'zone' => get_zone_name(), 'sort' => 'recent', 'max' => '20', 'no_links' => '1', 'pagination' => '1', 'give_context' => '0', 'include_breadcrumbs' => '0', 'block_id' => 'module', 'guid' => 'module'));
- return do_template('PAGINATION_SCREEN', array('_GUID' => 'bed3e31c98b35fea52a991e381e6cfaa', 'TITLE' => $this->title, 'CONTENT' => $content));
+ // Action links
+ if ((has_actual_page_access(null, 'cms_polls', null, null)) && (has_submit_permission('mid', get_member(), get_ip_address(), 'cms_polls'))) {
+ $submit_url = build_url(array('page' => 'cms_polls', 'type' => 'add', 'redirect' => get_self_url(true, false)), get_module_zone('cms_polls'));
+ } else {
+ $submit_url = new Tempcode();
+ }
+
+ return do_template('PAGINATION_SCREEN', array('_GUID' => 'bed3e31c98b35fea52a991e381e6cfaa', 'TITLE' => $this->title, 'CONTENT' => $content, 'ADD_URL' => $submit_url));
}
/**
From “Post #6,663”, 7th May 2020, 3:49 am
This worked beautifully. Thank you!
One more quick question. I'm planning on doing a new poll probably once a week. That means the list of polls on the Poll archive page can be quite long. As is, it displays the full results of each Poll…so the page is quite long (even with just 6 polls, at present).
Does this page paginate? Or is there a way to only list the Polls by title/question in order to make the poll list more compact?


Become a fan of Composr on Facebook or add me as a friend. Add me on on Mastodon. Follow me on Minds (where I am most active). Support me on Patreon
- If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
- If so, please let others know about Composr whenever you see the opportunity or support me on Patreon.
- If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying Composr on fun personal projects.
- If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.


Chris Graham said
Paginates to 20 per screen.
From “Post #6,670”, 7th May 2020, 6:36 pm
Okay, still makes for a fairly long page, but definitely works. Thanks Chris.


What would you suggest? Maybe I'll commit the change for v11.
EDIT: If I lowered it it'd be inconsistent with other default paginations. It's very much a preference, some like to scroll without having to keep clicking through, others like quicker loading pages. In v11 the templates can configure this without PHP changes.
Last edit: by Chris Graham
Become a fan of Composr on Facebook or add me as a friend. Add me on on Mastodon. Follow me on Minds (where I am most active). Support me on Patreon
- If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
- If so, please let others know about Composr whenever you see the opportunity or support me on Patreon.
- If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying Composr on fun personal projects.
- If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.


Chris Graham said
If you want to tweak it, you can see it in the code above.
What would you suggest? Maybe I'll commit the change for v11.
EDIT: If I lowered it it'd be inconsistent with other default paginations. It's very much a preference, some like to scroll without having to keep clicking through, others like quicker loading pages. In v11 the templates can configure this without PHP changes.
From “Post #6,674”, 7th May 2020, 6:59 pm
It's important to be consistent. I definitely support that.
Basically, the Poll archive page is a brief list of available polls. It also has a meaningful and unique heading (i.e. the poll question). Seems like just listing the heading/poll question will expedite finding the poll you are interested in and also shorten the page length (or at least allow for more polls to appear on a page, thus shortening the number of pages). Once you find the poll you are looking for (to edit or view results) you can select if from the list. That's just me thinking out loud, anyway.
Hopefully this wouldn't impact your pagination logic, as you are still passing in content. But the content would be a list of poll headings (with associated link to the actual poll) and not the full poll content (i.e. results) for each poll.


Become a fan of Composr on Facebook or add me as a friend. Add me on on Mastodon. Follow me on Minds (where I am most active). Support me on Patreon
- If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
- If so, please let others know about Composr whenever you see the opportunity or support me on Patreon.
- If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying Composr on fun personal projects.
- If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.


Chris Graham said
You'll be able to template that in in v11 if you want. The poll archive template invokes the main_multi_content block, which now supports multiple rendering modes similar to how catalogues currently do.
From “Post #6,682”, 8th May 2020, 7:44 pm
Sounds great. Looking forward to checking out v11.
Thanks Chris.