List Clubs

Post

Posted
Rating:
Item has a rating of 5 (Liked by Chris Graham)
#6185 (In Topic #1510)
Avatar
Standard member
Terry is in the usergroup ‘Fan in action’
A direct approach to listing Clubs (and other things) is the following mini block ( miniblock )
This approach directly accesses the database. After this code is uploaded to your site, then you can add the mini block in the left or right or center panel. My code is usually not very good quality, but it works, so improvements are welcome.
 
<style>
	tr:nth-child(even) {
		background-color: #c2d1e5;
	}

	tr:nth-child(odd) {
		background-color: white;
	}
</style>

<?php

$rows = $GLOBALS['SITE_DB']->query_select('f_groups', // Use this table
	array('id','g_name','g_group_leader'), // Get these fields
	array('g_is_private_club' => 1)); // WHERE this

	if (count($rows) == 0) {
		echo "<p>No Clubs found.</p>";
		return;
	}
	echo "<table><tr><th>Club name</th><th>Owner</th><th>Link</th></tr>";
	foreach ($rows as $row) {
		$club_owner = $GLOBALS['FORUM_DRIVER']->get_username($row["g_group_leader"]);
		$link = "somewebsite/index.php?page=groups&type=view&id=" . str_replace(" ", "-", trim($row["g_name"]));
		echo "<tr><td>" . $row["g_name"] . "</td><td>" . $club_owner . "</td><td><a href='" . $link . "'>" . "Join" . "</a></td></tr>";
	}
	echo "</table>";
?>
Online now: No Back to the top
1 guest and 0 members have just viewed this.

Statistics

Users online:

Manu, Vaiva, starfish, gabriel58, babu, MVLipwig, amit.nigam, John Connor

Forum statistics:
  • 1,132 topics, 5,401 posts, 6,518 members
  • Our newest member is dangtoy
Birthdays:
Back to Top