MyBB Community Forums

Full Version: Game section question
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Is it possible to restrict access to the games section until the user has X amount of posts?
What games are you referring to? If it is a plugin you need to sat who made it, and the name of the plugin so everyone can help you even more.
If your referring to forum games (like games within a forum) then you'll just need to find a plugin, or make a user be automatically promoted to a new usergroup to then be allowed access to the forum where the games are located at.
The Plugin that you can download for MyBB Forums, http://w3.gamesection.org/wiki/Downloads
Yes, but not in a pretty way.
Make use of the group promotions system, to move members to group X when they have Y amount of posts.
Install the templates conditionals plugin, and use this in the templates,

<if in_array($GLOBALS['mybb']->user['usergroup'], array(3,4,6,9)) then>
---game section template---
</if>

This will make games visible only to admins, super moderators, moderators and members with Y amount of posts, where 9 is the group ID.
---

Edit: Or maybe this is simpler,

<if in_array($GLOBALS['mybb']->user['postnum'] <not sure what goes here> then>

^ Not sure what you'd use to be exact, someone else will know.
Where you have put ---game section template--- what do I put in there?
That just represents the template for game section in global templates.
OK thanks but where do I put the code?
Post the game section template here.
I'm not sure which one your refering to I think it's this one

<html>
<head>
<title>{$mybb->settings['bbname']} - {$lang->gamesection}</title>
{$headerinclude}
{$rating_stylesheet}
<style type="text/css">
.tournaments a:link, .tournaments a:visited, .tournaments a:hover, .tournaments a:active
{
	color: #000000;
}
</style>
<script type="text/javascript" src="jscripts/games_rating.js?ver=120"></script>
<script type="text/javascript">
<!--
	lang.stars = new Array();
	lang.stars[1] = "{$lang->one_star}";
	lang.stars[2] = "{$lang->two_stars}";
	lang.stars[3] = "{$lang->three_stars}";
	lang.stars[4] = "{$lang->four_stars}";
	lang.stars[5] = "{$lang->five_stars}";
// -->
</script>
</head>
<body>
{$header}
{$games_menu}
{$stats}
{$categories_bar}
{$tournaments_bar}
{$search_bar}
{$multipages}
<br />
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tr>
<td colspan="4" class="thead"><strong>{$lang->gamesection}</strong></td>
</tr>
<tr>
<td class="tcat" width="175" align="center"><strong>{$lang->name}</strong></td>
<td class="tcat" align="center"><strong>{$lang->description}</strong></td>
<td class="tcat" width="250" align="center"><strong>{$lang->menu}</strong></td>
<td class="tcat" width="200" align="center"><strong>{$lang->champion}</strong></td>
</tr>
{$games_bit}
</table>
{$multipages}
{$online}
{$games_footer}
{$footer}
</body>
</html>
{$games_menu}
{$stats}
{$categories_bar}
{$tournaments_bar}
{$search_bar}
{$multipages}
<br />
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tr>
<td colspan="4" class="thead"><strong>{$lang->gamesection}</strong></td>
</tr>
<tr>
<td class="tcat" width="175" align="center"><strong>{$lang->name}</strong></td>
<td class="tcat" align="center"><strong>{$lang->description}</strong></td>
<td class="tcat" width="250" align="center"><strong>{$lang->menu}</strong></td>
<td class="tcat" width="200" align="center"><strong>{$lang->champion}</strong></td>
</tr>
{$games_bit}

replace with,

<if in_array($GLOBALS['mybb']->user['usergroup'], array(3,4,6,9)) then>
{$games_menu}
{$stats}
{$categories_bar}
{$tournaments_bar}
{$search_bar}
{$multipages}
<br />
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tr>
<td colspan="4" class="thead"><strong>{$lang->gamesection}</strong></td>
</tr>
<tr>
<td class="tcat" width="175" align="center"><strong>{$lang->name}</strong></td>
<td class="tcat" align="center"><strong>{$lang->description}</strong></td>
<td class="tcat" width="250" align="center"><strong>{$lang->menu}</strong></td>
<td class="tcat" width="200" align="center"><strong>{$lang->champion}</strong></td>
</tr>
{$games_bit}</if>

Remember to replace the 9 with whatever the group ID is.
You can also use another if statement to display a message to those with less than 10 posts,

<if in_array($GLOBALS['mybb']->user['usergroup'], array(2)) then>
<table border="0" cellspacing="1" cellpadding="4" class="tborder"> 
<tr> 
<td class="thead"><span class="smalltext"><strong>Error</strong></span></td> 
</tr> 
<tr> 
<td class="trow1">
You need 10 posts to play games.
</table></if>
Pages: 1 2