2013-08-21, 04:00 PM
I am trying to make a showgroups.php like they have on leakforums. However when I go to my page (http://www.mysite.com/usergroups.php) it just shows the last group created that a user can join.
My Pluginpage (usergroups.php)
The template for usergroups.php:
I know I am doing something wrong but can't figure out what.
My Pluginpage (usergroups.php)
<?php
define("IN_MYBB", 1);
$templatelist = "usergroups, error";
require_once "./global.php";
if ($mybb->user['uid'] == 0){
error_no_permission();
}
$query = $db->simple_select("usergroups", "*", "(type='3' OR type='4')", array('order_by' => 'title'));
while($usergroup = $db->fetch_array($query))
{
$name = $usergroup ['title'];
$description1= $usergroup['description'];
$userbar= $usergroup ['image'];
$number = $gid;
$joinlink = "<a href=\"usercp.php?action=usergroups&joingroup={$usergroup ['gid']}&my_post_key={$mybb->post_code}\">Join Group</a>";
add_breadcrumb("Custom Groups");
$title = "Custom Groups";
eval("\$usergroups = \"".$templates->get("usergroups")."\";");
output_page($usergroups);
?>
The template for usergroups.php:
<html>
<html>
<head>
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="expires" content="0" />
<title>{$mybb->settings[bbname]} - Usergroups</title>
{$headerinclude}
</head>
<body>
{$header}
<br />
<table border="0" cellspacing="{$theme[borderwidth]}" cellpadding="{$theme[tablespace]}" class="tborder">
<tr>
<td class="thead"><strong>Custom User Groups</strong></td>
</tr>
<tr>
<td class="trow1" width="100%">
<div style="width: 48%; min-height:120px; border: 1px #0B61A4 solid; margin: 4px; padding: 2px; border-radius: 5px; float:left;">
<table width="100%" cellspacing="0" cellpadding="5" border="0">
<tr class="trow1">
<td width="75%" border="0">
<span><b>{$name}</b></span><br/>
<span class="smalltext">
{$joinlink}<br/><br/>{$description}</span>
</td>
<td width="25%" align="right" valign="middle">
<img src="{$userbar}"/><br/>
</td>
</tr>
</table>
</div>
<div style="width: 48%; min-height:120px; border: 1px #0B61A4 solid; margin: 4px; padding: 2px; border-radius: 5px; float:right;">
<table width="100%" cellspacing="0" cellpadding="5" border="0">
<tr class="trow1">
<td width="75%" border="0">
<span><b>{$name}</b></span><br/>
<span class="smalltext">
{$joinlink}<br/><br/>{$description}</span>
</td>
<td width="25%" align="right" valign="middle">
<img src="{$userbar}"/><br/>
</td>
</tr>
</table>
</div>
<div style="width: 48%; min-height:120px; border: 1px #0B61A4 solid; margin: 4px; padding: 2px; border-radius: 5px; float:left;">
<table width="100%" cellspacing="0" cellpadding="5" border="0">
<tr class="trow1">
<td width="75%" border="0">
<span><b>{$name}</b></span><br/>
<span class="smalltext">
{$joinlink}<br/><br/>{$description}</span>
</td>
<td width="25%" align="right" valign="middle">
<img src="{$userbar}"/><br/>
</td>
</tr>
</table>
</div>
</td>
</tr>
<tr>
</table>
</form>
{$footer}
</body>
</html>
I know I am doing something wrong but can't figure out what.