Welcome to Geeklog, Anonymous Friday, March 29 2024 @ 10:40 am EDT

Geeklog Forums

Put a Poll anywhere that accepts Autotags.


Status: offline

Laugh

Site Admin
Admin
Registered: 09/27/05
Posts: 1468
Location:Canada
This hack is only for Geeklog 1.4.1

I always hated how the poll plugin doesn't allow you to stick a poll in a story so your users don't have to go search for it on the front page.

With the autotag plugin

http://www.geeklog.net/filemgmt/index.php?id=850

create a autotag called

poll_show

Make sure PHP is enabled. Then in lib-custom but the following code.


Text Formatted Code

function phpautotags_poll_show($p1, $p2, $fulltext)
{
        global $_TABLES;
       
        $size = $p1;
        $qid = $p2;
       
        // Check poll enabled
        if ($qid != '') {
                if (DB_getItem($_TABLES['pollquestions'], 'display', "qid = '".$qid."'") == 0) {
                        $retval = "This Poll is Closed.<br>" . POLLS_pollResults( $qid, $size );
                } else {
                        $retval = POLLS_showPoll(0, $qid);
                }
        } else {
                $retval = POLLS_showPoll( 0, $qid);
        }
        $retval = '<div class="poll-autotag" style="width: '.$p1.';">'.$retval.'</div>';
        return $retval;
       
}
 


That's it. To use the autotag you pass the size you want and the poll id. If no poll id is passed then it will show all enabled polls at the time.

[poll_show: size poll_id]
One of the Geeklog Core Developers.
 Quote

Status: offline

suprsidr

Forum User
Full Member
Registered: 12/29/04
Posts: 555
Location:Champaign, Illinois
I did the same within the plugin itself
in plugins/polls/functions.inc
Text Formatted Code
function plugin_autotags_polls($op, $content = '', $autotag = '') {
       
        if ($op == 'tagname' ) {
            return 'poll';
        } else if ($op == 'parse') {
               
                $link = POLLS_showPoll( 60 , $autotag['parm1']);
               
                $content = str_replace($autotag['tagstr'], $link, $content);

            return $content;
        }
       
        }
 


-s
FlashYourWeb and Your Gallery with the E2 XML Media Player for Gallery2 - http://www.flashyourweb.com
 Quote

All times are EDT. The time is now 10:40 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content