Commit a3788ceb authored by Gudule Lapointe's avatar Gudule Lapointe

* recent users: better display

parent f68a9913
......@@ -18,7 +18,7 @@ function w4os_dashboard_add_widgets() {
);
wp_add_dashboard_widget(
'w4os_dashboard_widget_newusers',
"OpenSimulator: " . __( 'New users', 'w4os' ),
"OpenSimulator: " . __( 'Recent users', 'w4os' ),
'w4os_dashboard_widget_newusers_handler'
);
}
......
......@@ -115,3 +115,15 @@ img.model-picture {
margin-top: 4px;
}
.recent-users li {
clear: both;
}
.recent-users .profilepic {
display: inline-block;
padding-right: 0.5em;
float: left;
}
.recent-users .avatar-name {
font-weight: bold;
}
......@@ -132,15 +132,19 @@ function w4os_newusers() {
return;
}
global $wpdb;
$recentusers = '<ul class="recently-user">';
$recentusers = '<ul class="recent-users">';
$usernames = $wpdb->get_results("SELECT user_nicename, user_url, user_email FROM $wpdb->users ORDER BY ID DESC LIMIT 5");
foreach ($usernames as $username) {
$user = $wpdb->get_row($wpdb->prepare("select * from ".$wpdb->prefix."users where user_email = %s", $username->user_email));
$uuid = get_the_author_meta( 'w4os_uuid', $user->ID );
if($uuid) {
$recentusers .= '<li>' .get_avatar($username->user_email, 32) . "&nbsp;" . get_the_author_meta( 'w4os_firstname', $user->ID ) . " " . get_the_author_meta( 'w4os_lastname', $user->ID ) ."</a></li>";
$recentusers .= '<li><span class=profilepic>' .get_avatar($username->user_email, 32) . "</span>"
. " <span class=avatar-name>" . get_the_author_meta( 'w4os_firstname', $user->ID ) . " " . get_the_author_meta( 'w4os_lastname', $user->ID ) . "</span>"
. " <span class=nicename> ($username->user_nicename)</span>"
. " <span class=email>$username->user_email</span>"
."</li>";
} else if (!$username->user_url) {
$recentusers .= '<li>' .get_avatar($username->user_email, 32) . "&nbsp;" . $username->user_nicename." ($uuid)</a></li>";
$recentusers .= '<li>' .get_avatar($username->user_email, 32) . "&nbsp;" . $username->user_nicename."</a></li>";
} else {
$recentusers .= '<li>' .get_avatar($username->user_email, 32) . "&nbsp;" . '<a href="'.$username->user_url.'">'.$username->user_nicename."</a></li>";
}
......
......@@ -6,7 +6,7 @@
*
* Plugin Name: W4OS OpenSimulator Interface
* Description: WordPress interface for OpenSimulator.
* Version: 0.11.0
* Version: 0.11.1
* Author: Speculoos World
* Author URI: https://speculoos.world
* Plugin URI: https://git.magiiic.com/opensimulator/w4os
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment