Disallow New Users To Cast Vote In Polls »  Show posts from    to     

Icy Phoenix


Old Customizations - Disallow New Users To Cast Vote In Polls



Vortex [ Wed 24 Jan, 2007 21:39 ]
Post subject: Disallow New Users To Cast Vote In Polls
I wanted to post this in "Customization" forum but I can't



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: [Hide]
  1. #  
  2. #-----[ SQL ]-------------------------------------------  
  3. #  
  4.  
  5. INSERT INTO `phpbb_config` ( `config_name` , `config_value` ) VALUES ('vote_min_posts', '10');  
  6.  
  7. #  
  8. #-----[ OPEN ]------------------------------------------  
  9. #  
  10. posting.php  
  11. #  
  12. #-----[ FIND ]------------------------------------------  
  13. #  
  14. // Vote in a poll  
  15. //  
  16. #  
  17. #-----[ BEFORE, ADD ]------------------------------------------  
  18. #  
  19.  
  20. //-- mod : Minimum posts before Vote ------------------------------------------------------------  
  21. //-- add  
  22. // Check if user has enough posts  
  23. $vote_posts = $board_config['vote_min_posts'];  
  24. if ( $userdata['user_posts'] < $vote_posts && $userdata['user_level'] == USER )  
  25. {  
  26. message_die(GENERAL_MESSAGE, sprintf($lang['Vote_min_posts_needed'], $vote_posts));  
  27. }  
  28. //-- fin mod : Minimum posts before Vote --------------------------------------------------------  
  29.  
  30. #  
  31. #-----[ OPEN ]------------------------------------------  
  32. #  
  33. admin/admin_board.php  
  34. #  
  35. #-----[ FIND ]------------------------------------------  
  36. #  
  37. "L_SYSTEM_TIMEZONE" => $lang['System_timezone'],  
  38. #  
  39. #-----[ AFTER, ADD ]------------------------------------------  
  40. #  
  41. //-- mod : Minimum posts before Vote ------------------------------------------------------------  
  42. //-- add  
  43. 'L_VOTE_MIN_POSTS' => $lang['Vote_min_posts'],  
  44. //-- fin mod : Minimum posts before Vote --------------------------------------------------------  
  45. #  
  46. #-----[ FIND ]------------------------------------------  
  47. #  
  48. "TIMEZONE_SELECT" => $timezone_select,  
  49. #  
  50. #-----[ AFTER, ADD ]------------------------------------------  
  51. #  
  52. //-- mod : Minimum posts before Vote ------------------------------------------------------------  
  53. //-- add  
  54. 'VOTE_MIN_POSTS' => $new['vote_min_posts'],  
  55. //-- fin mod : Minimum posts before Vote --------------------------------------------------------  
  56. #  
  57. #-----[ OPEN ]------------------------------------------  
  58. #  
  59. language/lang_english/lang_admin.php  
  60. #  
  61. #-----[ FIND ]------------------------------------------  
  62. #  
  63. ?>  
  64. #  
  65. #-----[ BEFORE, ADD ]------------------------------------------  
  66. #  
  67.  
  68. //-- mod : Minimum posts before Vote ------------------------------------------------------------  
  69. //-- add  
  70. $lang['Vote_min_posts'] = 'Minimum posts to Vote';  
  71. //-- fin mod : Minimum posts before Vote --------------------------------------------------------  
  72.  
  73. #  
  74. #-----[ OPEN ]------------------------------------------  
  75. #  
  76. language/lang_english/lang_main.php  
  77. #  
  78. #-----[ FIND ]------------------------------------------  
  79. #  
  80. ?>  
  81. #  
  82. #-----[ BEFORE, ADD ]------------------------------------------  
  83. #  
  84.  
  85. //-- mod : Minimum posts before Vote ------------------------------------------------------------  
  86. //-- add  
  87. $lang['Vote_min_posts_needed'] = 'You need %s posts to vote.';  
  88. //-- fin mod : Minimum posts before Vote --------------------------------------------------------  
  89.  
  90. #  
  91. #-----[ OPEN ]------------------------------------------  
  92. #  
  93. templates/subSilver/admin/board_config_body.tpl  
  94. #  
  95. #-----[ FIND ]------------------------------------------  
  96. #  
  97. <tr>  
  98. <td class="row1">{L_SYSTEM_TIMEZONE}</td>  
  99. <td class="row2">{TIMEZONE_SELECT}</td>  
  100. </tr>  
  101. #  
  102. #-----[ AFTER, ADD ]------------------------------------------  
  103. #  
  104. <!-- mod : Minimum posts before Vote -->  
  105. <tr>  
  106. <td class="row1">{L_VOTE_MIN_POSTS}</td>  
  107. <td class="row2"><input class="post" type="text" maxlength="255" size="3" name="vote_min_posts" value="{VOTE_MIN_POSTS}" /></td>  
  108. </tr>  
  109. <!-- fin mod : Minimum posts before Vote -->  
  110. #  
  111. #-----[ SAVE/CLOSE ALL FILES ]------------------------------------------  
  112. #  
  113. # EoM  
  114.  



(It needs some little modifications to be applied to XS, but nothing difficult since I have been able to do it )




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


Someone who wants to lend a hand?












ICY PHOENIX VERSION:





SQL


Code: [Hide] [Select]
INSERT INTO `ip_config` ( `config_name` , `config_value` ) VALUES ('vote_min_posts', '10');






in posting.php


Code: [Hide] [Select]
#
#-----[ 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 --------------------------------------------------------





in adm/admin_board.php

Code: [Hide] [Select]
#
#-----[ 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 --------------------------------------------------------




in language/lang_english/lang_admin.php

Code: [Hide] [Select]
#
#-----[ 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 --------------------------------------------------------




in language/lang_english/lang_main.php


Code: [Hide] [Select]
#
#-----[ 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 --------------------------------------------------------



in templates/common/acp/board_config_body.tpl



Code: [Hide] [Select]
#
#-----[ FIND ]------------------------------------------
#
<tr>
<td class="row1">{L_ONLINE_TIME} <br /><span class="gensmall">{L_ONLINE_TIME_EXPLAIN}</span></td>
#
#-----[ BEFORE, ADD ]------------------------------------------
#
<!-- mod : Minimum posts before Vote -->
<tr>
<td class="row1">{L_VOTE_MIN_POSTS}</td>
<td class="row2"><input class="post" type="text" maxlength="255" size="3" name="vote_min_posts" value="{VOTE_MIN_POSTS}" /></td>
</tr>
<!-- fin mod : Minimum posts before Vote -->



brandsrus [ Wed 24 Jan, 2007 23:41 ]
Post subject: 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: [Hide]
  1. #  
  2. #-----[ OPEN ]------------------------------------------  
  3. #  
  4. language/lang_dutch/lang_admin.php  
  5. #  
  6. #-----[ FIND ]------------------------------------------  
  7. #  
  8. ?>  
  9. #  
  10. #-----[ BEFORE, ADD ]------------------------------------------  
  11. #  
  12.  
  13. //-- mod : Minimum posts before Vote ------------------------------------------------------------  
  14. //-- add  
  15. $lang['Vote_min_posts'] = 'Minimum aantal berichten om te kunnen stemmen';  
  16. //-- fin mod : Minimum posts before Vote --------------------------------------------------------  
  17.  
  18. #  
  19. #-----[ OPEN ]------------------------------------------  
  20. #  
  21. language/lang_dutch/lang_main.php  
  22. #  
  23. #-----[ FIND ]------------------------------------------  
  24. #  
  25. ?>  
  26. #  
  27. #-----[ BEFORE, ADD ]------------------------------------------  
  28. #  
  29.  
  30. //-- mod : Minimum posts before Vote ------------------------------------------------------------  
  31. //-- add  
  32. $lang['Vote_min_posts_needed'] = 'Je hebt %s berichten nodig om te kunnen stemmen.';  
  33. //-- fin mod : Minimum posts before Vote --------------------------------------------------------  


Mighty Gorgon [ Wed 31 Jan, 2007 02:42 ]
Post subject: 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 ]
Post subject: Re: Disallow New Users To Cast Vote In Polls
For german

Code: [Hide]
  1. #  
  2. language/lang_english/lang_admin.php  
  3. #  
  4. #-----[ FIND ]------------------------------------------  
  5. #  
  6. ?>  
  7. #  
  8. #-----[ BEFORE, ADD ]------------------------------------------  
  9. #  
  10.  
  11. //-- mod : Minimum posts before Vote ------------------------------------------------------------  
  12. //-- add  
  13. $lang['Vote_min_posts'] = 'Min. Anzahl der Beträge um abstimmen zu dürfen.';  
  14. //-- fin mod : Minimum posts before Vote --------------------------------------------------------  
  15.  
  16. #  
  17. #-----[ OPEN ]------------------------------------------  
  18. #  
  19. language/lang_english/lang_main.php  
  20. #  
  21. #-----[ FIND ]------------------------------------------  
  22. #  
  23. ?>  
  24. #  
  25. #-----[ BEFORE, ADD ]------------------------------------------  
  26. #  
  27.  
  28. //-- mod : Minimum posts before Vote ------------------------------------------------------------  
  29. //-- add  
  30. $lang['Vote_min_posts_needed'] = 'Du benötigst mindestens %s Beiträge um abstimmen zu dürfen.';  
  31. //-- fin mod : Minimum posts before Vote --------------------------------------------------------  
  32.  


Zuker [ Sat 07 Apr, 2007 20:51 ]
Post subject: Re: Disallow New Users To Cast Vote In Polls
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.


Vortex [ Sat 07 Apr, 2007 21:05 ]
Post subject: Re: Disallow New Users To Cast Vote In Polls
Zuker wrote: [View Post]
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.



Of course, as I specify in the first post it works on XS. 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 ]
Post subject: Re: Disallow New Users To Cast Vote In Polls
Vortex wrote: [View Post]
Zuker wrote: [View Post]
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.



Of course, as I specify in the first post it works on XS. 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


I'm reviewing all modifications vortex, there is nothing particulary with you.
It would be great if you can review it before final release


Zuker [ Sun 08 Apr, 2007 19:06 ]
Post subject: 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




Powered by Icy Phoenix