Welcome to Geeklog Tuesday, December 12 2017 @ 05:20 am EST


Status: offline

Laugh

Site Admin
Admin
Registered: 27/09/2005
Posts: 1244
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.


PHP 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.

Status: offline

suprsidr

Forum User
Full Member
Registered: 29/12/2004
Posts: 555
Location:Champaign, Illinois
I did the same within the plugin itself
in plugins/polls/functions.inc
PHP 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

All times are EST. The time is now 05:20 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