Login Register


#Generous - Groups Page filter_list
Author
Message
#Generous - Groups Page #1
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.

Reply

RE: #Generous - Groups Page #2
Nice share, I've never done any MyBB plugin coding I will probably use this for some reference.
#LeSquad #Satellite

Reply

RE: #Generous - Groups Page #3
Looks promising! thank you Maeko Confusedmile:

Reply

RE: #Generous - Groups Page #4
Now only if I was smart enough to add auto update leader and members in group XD

Reply

RE: #Generous - Groups Page #5
(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.

Reply

RE: #Generous - Groups Page #6
This looks dope!

Reply

RE: #Generous - Groups Page #7
(11-26-2015, 12:23 AM)Adapt Wrote: This looks dope!

Doesn't it, Nova? :yus:

Reply

RE: #Generous - Groups Page #8
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

Reply

RE: #Generous - Groups Page #9
(11-27-2015, 01:52 AM)Vespei Wrote: 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

The page goes into the root directory (/), not plugins.

Reply

RE: #Generous - Groups Page #10
I'm so stupid. ...

Reply







Users browsing this thread: 1 Guest(s)