Welcome to Geeklog, Anonymous Friday, March 29 2024 @ 09:21 am EDT

Geeklog Forums

Make Polls List Privs aware..


Anonymous

Anonymous
Currently, all polls show up in the polls list, regardless of the group/s they're intended for. Following a link from the list to a privilleged poll simply yields an empty page. Aside from hiding the polls ppl aren't meant to see, I've also included the hack provided recently by 'amckay', that tags a vote link on the end of each item in the list. You'll need to modify three files for this to work.. --------- FILE: english.php Add: 6 => "Please ensure you are logged in to view all polls applicable to you, or click <a href=\"".$_CONF[site_url]."/users.php?mode=new\">here</a> to register.<br>" After: 5 => "Votes", ----------- FILE: Pollbooth.php REPLACE the polllist function with the following: function polllist() { global $_TABLES, $_CONF, $LANG07; $result = DB_query("SELECT * FROM "Wink; $nrows = DB_numRows($result); $retval = ''; $pollcnt=0; $retval .= COM_startBlock($LANG07[4]).$LANG07[6]; $pollitem = new Template($_CONF['path_layout'] . 'pollbooth'); $pollitem->set_file('pollitem', 'polllist.thtml'); for ($i = 1; $i <= $nrows; $i++) { $Q = DB_fetchArray($result); /// DONT SHOW ITEMS THAT CURRENT USER IS NOT PERMITTED TO VIEW if (SEC_hasAccess($Q['owner_id'],$Q['group_id'],$Q['perm_owner'],$Q['perm_group'],$Q['perm_members'],$Q['perm_anon'])>0) { $pollcnt++; $pollitem->set_var('item_num', $pollcnt); $pollitem->set_var('poll_url', $_CONF['site_url'].'/pollbooth.php?qid=' . $Q['qid'] . '&aid=-1'); $pollitem->set_var('poll_question', stripslashes($Q['question'])); $pollitem->set_var('poll_votes', $Q['voters']); $pollitem->set_var('lang_votes', $LANG07[5]); $pollitem->set_var('vote_url', $_CONF['site_url'].'/pollbooth.php?qid=' . $Q['qid']); $pollitem->set_var('vote_text', $LANG07[3]); if ($i == $nrows) { $pollitem->set_var('ending_br', '<br><br>'); } else { $pollitem->set_var('ending_br', ''); } $pollitem->parse('output', 'pollitem'); $retval .= $pollitem->finish($pollitem->get_var('output')); }else{ if ($i == $nrows) { $retval .='<br><br>'; } } } $retval .= COM_endBlock(); return $retval; } -------------- FILE: Polllist.thtml Include the vote_text and vote_URL vars and you're done. ---------------- Well, that's it. Hope it's not too drawn out - but it should keep your poll list - privs based and voteable.
 Quote

Anonymous

Anonymous
Story submission issue - any valid vars enclosed in curly braces are stripped when submitting a story, so the code in this article needs a tweek... replace (open_curly_braces) and (close_curly_braces) accordingly as below.. Where you see the line: $result = DB_query("SELECT * FROM "Wink; Insert after the word FROM: (open_curly_braces)$_TABLES['pollquestions'](close_curly_braces) That fixes it.. Yes, I tested it this time Smile
 Quote

Status: offline

amckay

Forum User
Full Member
Registered: 03/23/02
Posts: 180
Cool hack! Wanna add privs to static pages, too? ;-) cheers, -Alan
 Quote

Anonymous

Anonymous
I'll see what I can do Smile Cheers.
 Quote

All times are EDT. The time is now 09:21 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