Showgroups.php page
#1
Like you've probably seen on popular forums they may have a custom page to show all the custom groups. Well, here's how it is done.

First make showgroups.php and upload to root. Place the following code in it:
<?php 

define('IN_MYBB', 1); require "./global.php";

add_breadcrumb("Custom Usergroups", "showgroups.php"); 

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

output_page($html);

?>

Once that is done go to ACP > Themes > Templates > Global Templates > New template and make a template called 'showgroups' Place the following code inside making the needed edits for each user group:
<html>
<head>
<title>Current Usergroups</title>
{$headerinclude}
</head>
<body>
{$header}
<table border="0" cellspacing="1" cellpadding="4" class="tborder">
<tr>
<td class="thead"><span class="smalltext"><strong>Current Custom Usergroups</strong></span></td>
</tr>
<tr>
<td class="trow1">

<div style="width: 48%; min-height:120px; border: 1px #0E8104 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>Usergroup</b></span><br />
    <span class="smalltext"><b>Leaders: </b>
     <a href="profile.php"><span style="color: white;">Add username(s) here</span></a><br /><a href="usercp.php?action=usergroups&amp;joingroup=8&my_post_key={$mybb->post_code}">(Join Group)</a><br /><br />Description.</span>
    </td>
    <td width="25%" align="right" valign="middle">   
    <img src="http://resources.mybb.com/images/badges/oct_13/support.png" /><br />
    </td>
    </tr>
    </table>
    </div>

</td></tr></table>
{$footer}
</body>
</html>

If you want to add more than one usergroup, then copy and paste the usergroup box, and paste it and add a line break every time you have two usergroups on the same page. Example coding below

</style>
<html>
<head>
<title>Current Usergroups</title>
{$headerinclude}
</head>
<body>
{$header}
<table border="0" cellspacing="1" cellpadding="4" class="tborder">
<tr>
<td class="thead"><span class="smalltext"><strong>Current Custom Usergroups</strong></span></td>
</tr>
<tr>
<td class="trow1">

<div style="width: 48%; min-height:120px; border: 1px #0E8104 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>Usergroup</b></span><br />
    <span class="smalltext"><b>Leaders: </b>
     <a href="profile.php"><span style="color: white;">Add username(s) here</span></a><br /><a href="usercp.php?action=usergroups&amp;joingroup=8&my_post_key={$mybb->post_code}">(Join Group)</a><br /><br />Description.</span>
    </td>
    <td width="25%" align="right" valign="middle">   
    <img src="http://resources.mybb.com/images/badges/oct_13/support.png" /><br />
    </td>
    </tr>
    </table>
    </div>
<div style="width: 48%; min-height:120px; border: 1px #0E8104 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>Usergroup</b></span><br />
    <span class="smalltext"><b>Leaders: </b>
     <a href="profile.php"><span style="color: white;">Add username(s) here</span></a><br /><a href="usercp.php?action=usergroups&amp;joingroup=8&my_post_key={$mybb->post_code}">(Join Group)</a><br /><br />Description.</span>
    </td>
    <td width="25%" align="right" valign="middle">   
    <img src="http://resources.mybb.com/images/badges/oct_13/support.png" /><br />
    </td>
    </tr>
    </table>
    </div>
<br>
<div style="width: 48%; min-height:120px; border: 1px #0E8104 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>Usergroup</b></span><br />
    <span class="smalltext"><b>Leaders: </b>
     <a href="profile.php"><span style="color: white;">Add username(s) here</span></a><br /><a href="usercp.php?action=usergroups&amp;joingroup=8&my_post_key={$mybb->post_code}">(Join Group)</a><br /><br />Description.</span>
    </td>
    <td width="25%" align="right" valign="middle">   
    <img src="http://resources.mybb.com/images/badges/oct_13/support.png" /><br />
    </td>
    </tr>
    </table>
    </div>
<div style="width: 48%; min-height:120px; border: 1px #0E8104 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>Usergroup</b></span><br />
    <span class="smalltext"><b>Leaders: </b>
     <a href="profile.php"><span style="color: white;">Add username(s) here</span></a><br /><a href="usercp.php?action=usergroups&amp;joingroup=8&my_post_key={$mybb->post_code}">(Join Group)</a><br /><br />Description.</span>
    </td>
    <td width="25%" align="right" valign="middle">   
    <img src="http://resources.mybb.com/images/badges/oct_13/support.png" /><br />
    </td>
    </tr>
    </table>
    </div>
<br>
<div style="width: 48%; min-height:120px; border: 1px #0E8104 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>Usergroup</b></span><br />
    <span class="smalltext"><b>Leaders: </b>
     <a href="profile.php"><span style="color: white;">Add username(s) here</span></a><br /><a href="usercp.php?action=usergroups&amp;joingroup=8&my_post_key={$mybb->post_code}">(Join Group)</a><br /><br />Description.</span>
    </td>
    <td width="25%" align="right" valign="middle">   
    <img src="http://resources.mybb.com/images/badges/oct_13/support.png" /><br />
    </td>
    </tr>
    </table>
    </div>
<div style="width: 48%; min-height:120px; border: 1px #0E8104 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>Usergroup</b></span><br />
    <span class="smalltext"><b>Leaders: </b>
     <a href="profile.php"><span style="color: white;">Add username(s) here</span></a><br /><a href="usercp.php?action=usergroups&amp;joingroup=8&my_post_key={$mybb->post_code}">(Join Group)</a><br /><br />Description.</span>
    </td>
    <td width="25%" align="right" valign="middle">   
    <img src="http://resources.mybb.com/images/badges/oct_13/support.png" /><br />
    </td>
    </tr>
    </table>
    </div>
<br>
</td></tr></table>
{$footer}
</body>
</html>
Make sure you update the join group link.
DEMO: http://www.glitchers.net/showgroupsmybbtut.php
Reply
#2
check your code

Quote: <a href="profile.php"><span style="color: white;">Add username(s) here</span></a><br /><a href="usercp.php?action=usergroups&amp;joingroup=18&amp;my_post_key=6eabd820dea8e97a182603e4b821b528">(Join Group)</a><br /><br />Description.</span>

Quote:<a href="usercp.php?action=usergroups&amp;joingroup=18&amp;my_post_key=6eabd820dea8e97a182603e4b821b528">(Join Group)


it's doesn't work
cuz every member has different my_post_key

anyone help ?
Reply
#3
Use {$mybb->post_code} between = and ".

@Poliwag, please correct this everywhere.
Reply
#4
(2014-06-25, 05:32 AM)Destroy666 Wrote: Use {$mybb->post_code} between = and ".

@Poliwag, please correct this everywhere.

Yeah, I just realized. I got it fixed a few minutes ago. Updating OP.

Sorry for that, I didn't check my code before I posted. XD
Reply
#5
i don't understand 1 thing why make it so difficult,
under your forum shows "Forum team"


go to Home ยป Template Sets > your Templates > header templates > Header
add: <li><a href="{$mybb->settings['bburl']}/showteam.php">show team</a></li>

and done ^^
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)