[geeklog-users] remove "past polls"

Daniel Kopp geeklog at daniu.de
Tue Jan 27 19:19:16 EST 2004


Hi!

It's just that I (and probably nobody) like dead links and I guess many
people do not use certain features of geeklog (like polls). At least until a
certain point in time. So before that it would be nice not to see the point
but after that it should be there.

How about exchanging these lines in lib-common:

$header->set_var( 'menuitem_url', $_CONF['site_url'] . '/pollbooth.php' ); 
$header->set_var( 'menuitem_text', $LANG01[73] ); 
$header->parse( 'menu_elements', 'menuitem', true );

with this:

if (!empty ($_USER['username']) ||
   (($_CONF['loginrequired'] == 0) && ($_CONF['pollsloginrequired'] == 0))){
    $sql = "SELECT qid,question,voters FROM {$_TABLES['pollquestions']}"
           . COM_getPermSQL ();
    $result = DB_query($sql);
    $nrows = DB_numRows($result);
    if ($nrows>0){
        $header->set_var( 'menuitem_url', $_CONF['site_url'] .
'/pollbooth.php' );
        $header->set_var( 'menuitem_text', $LANG01[73] );
        $header->parse( 'menu_elements', 'menuitem', true );
    }
}

To be honest - I do not know exactly what I am doing there - I just checked
what makes the message $lang10[17] "it appears ... no polls" appear - so I
would appreciate if someone could doublecheck the code *). (had a look at
the html which seems to be ok)
Is it a good idea to increase the database calls by that? At least I think
common-lib could disable the features that are not allowed for the user, or
does it?

regards
Daniel

*) felt reminded on my digital lecture as I did something that I perfectly
remember but cannot recall the name:
a&&b=!(!b||!a)




More information about the geeklog-users mailing list