![]() |
|
#Generous - Groups Page - Printable Version +- Sinisterly (https://sinister.ly) +-- Forum: Design (https://sinister.ly/Forum-Design) +--- Forum: Web Design (https://sinister.ly/Forum-Web-Design) +--- Thread: #Generous - Groups Page (/Thread-Generous-Groups-Page) Pages:
1
2
|
#Generous - Groups Page - Jasper - 11-24-2015 Have fun with a dynamic groups page rather then a HTML page you need to edit 24/7. :rly: Preview: https://realityforum.net/groups.php (The one I made doesn't include amount of users in the group(s), or leaders) [hide] 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. :yus: [/hide] Let me know if you need assistance regarding this. RE: #Generous - Groups Page - Para - 11-24-2015 Nice share, I've never done any MyBB plugin coding I will probably use this for some reference. RE: #Generous - Groups Page - Austin_mybb_import6214 - 11-24-2015 Looks promising! thank you Maeko mile:
RE: #Generous - Groups Page - Esoterith - 11-24-2015 Now only if I was smart enough to add auto update leader and members in group XD RE: #Generous - Groups Page - Jasper - 11-25-2015 (11-24-2015, 11:49 PM)Vespei Wrote: Now only if I was smart enough to add auto update leader and members in group XD More code required, hehe. RE: #Generous - Groups Page - Adapt_mybb_import19778 - 11-26-2015 This looks dope! RE: #Generous - Groups Page - Jasper - 11-26-2015 (11-26-2015, 12:23 AM)Adapt Wrote: This looks dope! Doesn't it, Nova? :yus: RE: #Generous - Groups Page - Esoterith - 11-27-2015 Doesnt work sadly Warning [2] require_once(./global.php): failed to open stream: No such file or directory - Line: 9 - File: inc/plugins/showgroups.php PHP 5.5.24 (Linux) File Line Function /inc/plugins/showgroups.php 9 errorHandler->error /inc/plugins/showgroups.php 9 require_once /admin/modules/config/plugins.php 518 require_once /admin/index.php 767 require RE: #Generous - Groups Page - Jasper - 11-27-2015 (11-27-2015, 01:52 AM)Vespei Wrote: Doesnt work sadly The page goes into the root directory (/), not plugins. RE: #Generous - Groups Page - Esoterith - 11-27-2015 I'm so stupid. ... |