[OzzModz] Latest Poll Widget

[OzzModz] Latest Poll Widget 1.0.0 Release Canadate 2

No permission to download

Ozzy47

Well-known member
Ozzy47 submitted a new resource:

[OzzModz] Latest Poll Widget - Better poll widget

This addon brings a much-needed improvement over the standard poll widget included in Xenforo. Instead of designating a specific thread poll in advance, this addon searches for the latest poll on your forum and displays it automatically in a widget.

In addition, you select specific forums to search for polls, or search from all forums.

This addon also provides new style properties for styling the poll widget, with existing visual improvements out of the box! These style properties also...

Read more about this resource...
 
Looks good, I was wondering if there was a way to get more than 1 latest poll? Also, when I selected 3 separate forums it was still pulling from the latest poll in a different forum node. Any ideas?
 
Looks good, I was wondering if there was a way to get more than 1 latest poll? Also, when I selected 3 separate forums it was still pulling from the latest poll in a different forum node. Any ideas?
Ditto. I'd hoped to be able to perhaps create an unlisted node and point this widget at that node and just put board wide polls in that node. However no matter what nodes I set the widget to look at it seems determined to pull in the latest poll on the board and only the latest poll. Afraid I've not started to look at the code yet to see if it's obvious what's gone wrong.
 
Looks like the code to restrict the thread selection by node was never quite finished up. There is a chunk commented out. Slightly tweaking that gets it to work. Now I'm no PHP person (Ruby by choice), but for what it's worth here is the diff:

Diff:
--- Widget/LatestPoll.php.orig    2024-07-19 22:56:47.952689000 +0100
+++ Widget/LatestPoll.php    2024-07-19 23:25:30.276138000 +0100
@@ -41,11 +41,10 @@
             ->with('Poll', 'Forum', 'Forum.Node', 'Forum.Node.Permissions|' . \XF::visitor()->permission_combination_id)
             ->order('post_date', 'DESC');
 
-        //if ($nodeIds && !in_array(0, $nodeIds))
-        //{
-        //    print("node ids is " . print_r($nodeIds));
-        //    $threadFinder->where('node_id', $nodeIds);
-        //}
+        if (!empty($nodeIds[0]))
+        {
+            $threadFinder->where('node_id', $nodeIds);
+        }
         
         $thread = $threadFinder->fetchOne();
 
Back
Top Bottom