https://www.icyphoenix.com/viewtopic.php?f=28&t=1006 ----------------------------------- Vortex Wed 24 Jan, 2007 21:39 Disallow New Users To Cast Vote In Polls ----------------------------------- I wanted to post this in "Customization" forum but I can't :D This is a mod (tested, it works on XS, see below for Icy's version) that prevents new users (users with less than $n posts) to vote polls: [code]# #-----[ SQL ]------------------------------------------- # INSERT INTO `phpbb_config` ( `config_name` , `config_value` ) VALUES ('vote_min_posts', '10'); # #-----[ OPEN ]------------------------------------------ # posting.php # #-----[ FIND ]------------------------------------------ # // Vote in a poll // # #-----[ BEFORE, ADD ]------------------------------------------ # //-- mod : Minimum posts before Vote ------------------------------------------------------------ //-- add // Check if user has enough posts $vote_posts = $board_config['vote_min_posts']; if ( $userdata['user_posts'] < $vote_posts && $userdata['user_level'] == USER ) { message_die(GENERAL_MESSAGE, sprintf($lang['Vote_min_posts_needed'], $vote_posts)); } //-- fin mod : Minimum posts before Vote -------------------------------------------------------- # #-----[ OPEN ]------------------------------------------ # admin/admin_board.php # #-----[ FIND ]------------------------------------------ # "L_SYSTEM_TIMEZONE" => $lang['System_timezone'], # #-----[ AFTER, ADD ]------------------------------------------ # //-- mod : Minimum posts before Vote ------------------------------------------------------------ //-- add 'L_VOTE_MIN_POSTS' => $lang['Vote_min_posts'], //-- fin mod : Minimum posts before Vote -------------------------------------------------------- # #-----[ FIND ]------------------------------------------ # "TIMEZONE_SELECT" => $timezone_select, # #-----[ AFTER, ADD ]------------------------------------------ # //-- mod : Minimum posts before Vote ------------------------------------------------------------ //-- add 'VOTE_MIN_POSTS' => $new['vote_min_posts'], //-- fin mod : Minimum posts before Vote -------------------------------------------------------- # #-----[ OPEN ]------------------------------------------ # language/lang_english/lang_admin.php # #-----[ FIND ]------------------------------------------ # ?> # #-----[ BEFORE, ADD ]------------------------------------------ # //-- mod : Minimum posts before Vote ------------------------------------------------------------ //-- add $lang['Vote_min_posts'] = 'Minimum posts to Vote'; //-- fin mod : Minimum posts before Vote -------------------------------------------------------- # #-----[ OPEN ]------------------------------------------ # language/lang_english/lang_main.php # #-----[ FIND ]------------------------------------------ # ?> # #-----[ BEFORE, ADD ]------------------------------------------ # //-- mod : Minimum posts before Vote ------------------------------------------------------------ //-- add $lang['Vote_min_posts_needed'] = 'You need %s posts to vote.'; //-- fin mod : Minimum posts before Vote -------------------------------------------------------- # #-----[ OPEN ]------------------------------------------ # templates/subSilver/admin/board_config_body.tpl # #-----[ FIND ]------------------------------------------ # {L_SYSTEM_TIMEZONE} {TIMEZONE_SELECT} # #-----[ AFTER, ADD ]------------------------------------------ # {L_VOTE_MIN_POSTS} # #-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ # # EoM [/code] (It needs some little modifications to be applied to XS, but nothing difficult since I have been able to do it :D ) I'd like to add a feature to this mod, in order to make it check not only the number of posts, but also the registration date. To make it short, I'd like to allow users to vote polls only if they have MORE than $n posts and are registered since MORE than $x days... I don't think it would be difficult... if I was able to code... :D Someone who wants to lend a hand? [hr] [b][align=center][size=18][color=red]ICY PHOENIX VERSION:[/color][/size][/align][/b] SQL [code linenumbers=false]INSERT INTO `ip_config` ( `config_name` , `config_value` ) VALUES ('vote_min_posts', '10'); [/code] in [b]posting.php[/b] [code linenumbers=false] # #-----[ FIND ]------------------------------------------ # // Vote in a poll // # #-----[ BEFORE, ADD ]------------------------------------------ # //-- mod : Minimum posts before Vote ------------------------------------------------------------ //-- add // Check if user has enough posts $vote_posts = $board_config['vote_min_posts']; if ( $userdata['user_posts'] < $vote_posts && $userdata['user_level'] == USER ) { message_die(GENERAL_MESSAGE, sprintf($lang['Vote_min_posts_needed'], $vote_posts)); } //-- fin mod : Minimum posts before Vote -------------------------------------------------------- [/code] in [b]adm/admin_board.php[/b] [code linenumbers=false] # #-----[ FIND ]------------------------------------------ # 'L_SYSTEM_TIMEZONE' => $lang['System_timezone'], # #-----[ AFTER, ADD ]------------------------------------------ # //-- mod : Minimum posts before Vote ------------------------------------------------------------ //-- add 'L_VOTE_MIN_POSTS' => $lang['Vote_min_posts'], //-- fin mod : Minimum posts before Vote -------------------------------------------------------- # #-----[ FIND ]------------------------------------------ # 'TIMEZONE_SELECT' => $timezone_select, # #-----[ AFTER, ADD ]------------------------------------------ # //-- mod : Minimum posts before Vote ------------------------------------------------------------ //-- add 'VOTE_MIN_POSTS' => $new['vote_min_posts'], //-- fin mod : Minimum posts before Vote -------------------------------------------------------- [/code] in [b]language/lang_english/lang_admin.php[/b] [code linenumbers=false] # #-----[ FIND ]------------------------------------------ # $lang['Session_length'] = 'Session length [ seconds ]'; # #-----[ AFTER, ADD ]------------------------------------------ # //-- mod : Minimum posts before Vote ------------------------------------------------------------ //-- add $lang['Vote_min_posts'] = 'Minimum posts to Vote'; //-- fin mod : Minimum posts before Vote -------------------------------------------------------- [/code] in [b]language/lang_english/lang_main.php[/b] [code linenumbers=false]# #-----[ FIND ]------------------------------------------ # //==================================================== // Do not insert anything below this line //==================================================== ?> # #-----[ BEFORE, ADD ]------------------------------------------ # //-- mod : Minimum posts before Vote ------------------------------------------------------------ //-- add $lang['Vote_min_posts_needed'] = 'You need %s posts to vote.'; //-- fin mod : Minimum posts before Vote -------------------------------------------------------- [/code] in [b]templates/common/acp/board_config_body.tpl[/b] [code linenumbers=false] # #-----[ FIND ]------------------------------------------ # {L_ONLINE_TIME}
{L_ONLINE_TIME_EXPLAIN} # #-----[ BEFORE, ADD ]------------------------------------------ # {L_VOTE_MIN_POSTS} [/code] ----------------------------------- brandsrus Wed 24 Jan, 2007 23:41 Re: Help With Mod (Disable New Users To Vote Polls) ----------------------------------- Nice feature maybe that Mighty Gorgon it can added into Icy Phoenix in the next release. The Dutch translation for this mod for people that will be added this to the own board [code] # #-----[ OPEN ]------------------------------------------ # language/lang_dutch/lang_admin.php # #-----[ FIND ]------------------------------------------ # ?> # #-----[ BEFORE, ADD ]------------------------------------------ # //-- mod : Minimum posts before Vote ------------------------------------------------------------ //-- add $lang['Vote_min_posts'] = 'Minimum aantal berichten om te kunnen stemmen'; //-- fin mod : Minimum posts before Vote -------------------------------------------------------- # #-----[ OPEN ]------------------------------------------ # language/lang_dutch/lang_main.php # #-----[ FIND ]------------------------------------------ # ?> # #-----[ BEFORE, ADD ]------------------------------------------ # //-- mod : Minimum posts before Vote ------------------------------------------------------------ //-- add $lang['Vote_min_posts_needed'] = 'Je hebt %s berichten nodig om te kunnen stemmen.'; //-- fin mod : Minimum posts before Vote -------------------------------------------------------- [/code] ----------------------------------- Mighty Gorgon Wed 31 Jan, 2007 02:42 Re: Help With Mod (Disable New Users To Vote Polls) ----------------------------------- Nice addon... added to customizations... and I'll consider to add it to Icy Phoenix. Thanks. ----------------------------------- TheSteffen Wed 31 Jan, 2007 11:34 Re: Disallow New Users To Cast Vote In Polls ----------------------------------- For german [code] # language/lang_english/lang_admin.php # #-----[ FIND ]------------------------------------------ # ?> # #-----[ BEFORE, ADD ]------------------------------------------ # //-- mod : Minimum posts before Vote ------------------------------------------------------------ //-- add $lang['Vote_min_posts'] = 'Min. Anzahl der Beträge um abstimmen zu dürfen.'; //-- fin mod : Minimum posts before Vote -------------------------------------------------------- # #-----[ OPEN ]------------------------------------------ # language/lang_english/lang_main.php # #-----[ FIND ]------------------------------------------ # ?> # #-----[ BEFORE, ADD ]------------------------------------------ # //-- mod : Minimum posts before Vote ------------------------------------------------------------ //-- add $lang['Vote_min_posts_needed'] = 'Du benötigst mindestens %s Beiträge um abstimmen zu dürfen.'; //-- fin mod : Minimum posts before Vote -------------------------------------------------------- [/code] ----------------------------------- Zuker Sat 07 Apr, 2007 20:51 Re: Disallow New Users To Cast Vote In Polls ----------------------------------- [b]This modification is only for php XS and maybe is not working with IcyPhoenix. If you are the author or are able to make them icy compatible, please feel free to post it. Thanks for your time and the good work so far.[/b] ----------------------------------- Vortex Sat 07 Apr, 2007 21:05 Re: Disallow New Users To Cast Vote In Polls ----------------------------------- [quote user="Zuker" post="11518"][b]This modification is only for php XS and maybe is not working with IcyPhoenix. If you are the author or are able to make them icy compatible, please feel free to post it. Thanks for your time and the good work so far.[/b][/quote] Of course, as I specify in the first post it [color=red]works on XS[/color]. When Icy will be officially released I will install it again on my site (once updated to Icy, obviously) and will say if it will work or eventually make needed modifications ;) ----------------------------------- Zuker Sat 07 Apr, 2007 21:54 Re: Disallow New Users To Cast Vote In Polls ----------------------------------- [quote user="Vortex" post="11524"][quote user="Zuker" post="11518"][b]This modification is only for php XS and maybe is not working with IcyPhoenix. If you are the author or are able to make them icy compatible, please feel free to post it. Thanks for your time and the good work so far.[/b][/quote] Of course, as I specify in the first post it [color=red]works on XS[/color]. When Icy will be officially released I will install it again on my site (once updated to Icy, obviously) and will say if it will work or eventually make needed modifications ;)[/quote] I'm reviewing all modifications vortex, there is nothing particulary with you. It would be great if you can review it before final release :P ----------------------------------- Zuker Sun 08 Apr, 2007 19:06 Re: Disallow New Users To Cast Vote In Polls ----------------------------------- Great work vortex I've splitted your message and moved the new version into customization forum