• Welcome to ForumKorner!
    Join today and become a part of the community.

[MyBB] Groups page

Kurumi

Onyx user!
Reputation
0
Have fun with a dynamic groups page rather then a HTML page you need to edit 24/7.

Preview: https://realityforum.net/groups.php (The one I made doesn't include amount of users in the group(s), or leaders)

1. Make a template inside Global Templates called: showgroups
2. As code for that template, put:

Code:
<html>
<head>
<title>
{$mybb->settings['bbname']} - {$bread}
</title>
{$headerinclude}
</head>
<body>
{$header}
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tr>
<td class="thead" colspan="5"><strong>{$bread}</strong></td>
</tr>
<tr>
<td class="trow1">{$showgroupsrow}</td>
</tr>
</table>
{$footer}
</body>
</html>

3. Make a template inside Global Templates called: showgroups_row
4. As code for that template, put:
Code:
<div style="width: 48%; min-height: 150px; float: left; border: 1px #303030 solid; margin: 4px; padding: 2px;">
<table width="100%" cellspacing="0" cellpadding="5" border="0">

<tr>
<td class="trow1" width="75%">
<span><strong>{$row['title']}</strong></span><br />
<span class="smalltext">
<a href="usercp.php?action=usergroups&joingroup={$usergroups}&my_post_key={$mybb->post_code}">Join Group</a></br>{$row['description']}
</span>
</td>

<td width="25%" align="right" valign="top">
<img src="{$row['image']}" alt="{$row['title']}" title="{$row['title']}" /><br />
</td>

</tr>
</table>
</div>

5. Make a new file called: showgroups.php & upload it to ROOT afterwards
6. Inside the file, put this PHP code:

Code:
<?php 

/*
 * http://community.mybb.com/user-83692.html ~
 */

define("IN_MYBB", 1);
define("THIS_SCRIPT", "showgroups.php");
require_once "./global.php";

// No guests are allowed to see this page.
if(!$mybb->user['uid']) {
	error("Login or Register to view this page.");
}

// Enter the GIDs you'd like to show up on the page.
$groups = array('4','10','9');

$bread = "Showgroups";
add_breadcrumb($bread, 'showgroups.php');

foreach ($groups as &$usergroups) {
			
$query = $db->write_query("SELECT * FROM ".TABLE_PREFIX."usergroups WHERE gid='$usergroups'");
while($row = $db->fetch_array($query)) {
	
	$row['title'] = htmlspecialchars_uni($row['title']);
	$row['description'] = htmlspecialchars_uni($row['description']);
    $row['image'] = $row['image'];
	
	eval("\$showgroupsrow .= \"".$templates->get("showgroups_row")."\";");
	
	}
}

	eval("\$showgroupsindex = \"".$templates->get("showgroups")."\";"); 

    output_page($showgroupsindex);

7. Save it and visit it at: forumurl.com/showgroups.php

Don't forget to edit the array with your desired GIDs. 

Let me know if you need assistance regarding this.
 
Top