[UPDATE] adding if user was invited and inviter to registered users

This commit is contained in:
iAmShorty 2014-02-23 22:30:52 +01:00
parent 23afae0aaf
commit d0a82be11b
2 changed files with 57 additions and 46 deletions

View File

@ -122,7 +122,13 @@ class User extends Base {
**/
public function getLastRegisteredUsers($limit=10) {
$this->debug->append("STA " . __METHOD__, 4);
$stmt = $this->mysqli->prepare("SELECT * FROM " . $this->getTableName() . " ORDER BY id DESC LIMIT ?");
$stmt = $this->mysqli->prepare("
SELECT a.id,a.username as mposuser,a.email,a.signup_timestamp,u.username as inviter FROM " . $this->getTableName() . " AS a
LEFT JOIN invitations AS i
ON a.email = i.email
LEFT JOIN " . $this->getTableName() . " as u
ON i.account_id = u.id
ORDER BY a.id DESC LIMIT ?");
if ($this->checkStmt($stmt) && $stmt->bind_param("i", $limit) && $stmt->execute() && $result = $stmt->get_result()) {
return $result->fetch_all(MYSQLI_ASSOC);
}

View File

@ -1,51 +1,56 @@
<article class="module width_full">
<header><h3>Registrations</h3></header>
<article class="module width_quarter">
<header><h3>by time</h3></header>
<table class="tablesorter" cellspacing="0">
<thead>
<tr>
<th align="center">24 hours</th>
<th align="center">7 days</th>
<th align="center">1 month</th>
<th align="center">6 months</th>
<th align="center">1 year</th>
</tr>
</thead>
<tbody>
<tr>
<td align="center">{$USER_REGISTRATIONS.24hours}</td>
<td align="center">{$USER_REGISTRATIONS.7days}</td>
<td align="center">{$USER_REGISTRATIONS.1month}</td>
<td align="center">{$USER_REGISTRATIONS.6month}</td>
<td align="center">{$USER_REGISTRATIONS.1year}</td>
</tr>
</tbody>
</table>
</article>
<article class="module width_quarter">
<header><h3>by time</h3></header>
<table class="tablesorter" cellspacing="0">
<thead>
<tr>
<th align="center">24 hours</th>
<th align="center">7 days</th>
<th align="center">1 month</th>
<th align="center">6 months</th>
<th align="center">1 year</th>
</tr>
</thead>
<tbody>
<tr>
<td align="center">{$USER_REGISTRATIONS.24hours}</td>
<td align="center">{$USER_REGISTRATIONS.7days}</td>
<td align="center">{$USER_REGISTRATIONS.1month}</td>
<td align="center">{$USER_REGISTRATIONS.6month}</td>
<td align="center">{$USER_REGISTRATIONS.1year}</td>
</tr>
</tbody>
</table>
</article>
<article class="module width_half" style="min-height: 350px">
<header><h3>Last 10 registered Users</h3></header>
<div>
<table class="tablesorter" cellspacing="0">
<thead>
<tr>
<th align="center">ID</th>
<th>Username</th>
<th align="left">eMail</th>
<th align="center">Reg. Date</th>
</tr>
</thead>
<tbody>
<article class="module width_3_quarter" style="min-height: 350px">
<header><h3>Last 10 registered Users</h3></header>
<div>
<table class="tablesorter" cellspacing="0">
<thead>
<tr>
<th align="center">ID</th>
<th>Username</th>
<th align="left">eMail</th>
<th align="center">Reg. Date</th>
<th align="center">Invite</th>
<th align="center">Invited from</th>
</tr>
</thead>
<tbody>
{section user $LASTREGISTEREDUSERS}
<tr class="{cycle values="odd,even"}">
<td align="center">{$LASTREGISTEREDUSERS[user].id|escape}</td>
<td>{$LASTREGISTEREDUSERS[user].username|escape}</td>
<td align="left">{$LASTREGISTEREDUSERS[user].email}</td>
<td align="center">{$LASTREGISTEREDUSERS[user].signup_timestamp|date_format:"%d/%m %H:%M:%S"}</td>
</tr>
<tr class="{cycle values="odd,even"}">
<td align="center">{$LASTREGISTEREDUSERS[user].id|escape}</td>
<td>{$LASTREGISTEREDUSERS[user].mposuser}</td>
<td align="left">{$LASTREGISTEREDUSERS[user].email}</td>
<td align="center">{$LASTREGISTEREDUSERS[user].signup_timestamp|date_format:"%d/%m %H:%M:%S"}</td>
<td align="center">{if !$LASTREGISTEREDUSERS[user].inviter}NO{else}YES{/if}</td>
<td align="center">{$LASTREGISTEREDUSERS[user].inviter}</td>
</tr>
{/section}
</tbody>
</table>
</article>
</tbody>
</table>
</article>
</article>