Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Need Widget to display new users WordPress

  • SOLVED

EDIT: I've increased this to $77 and added a second similar widget that I need

<strong>First Widget</strong>
I need a widget that displays the gravatars of the newest users with at least 1 post in the post_type='products'.

It needs to have a field to select how many users to display, and a title.

<strong>Second Widget</strong>
I'm also now in need of another widget that will display a specified user's gravatar, display name, bio, and link to their author post archive.

Answers (3)

2011-03-26

Denzel Chia answers:

Hi Jake,

<blockquote>
If I need to up it, let me know to how much. I thought this would be a pretty common widget people would have 'laying around'.
</blockquote>

If this is a common widget, you would be able to find it at WordPress Plugins Repository for Free.
Secondly, What you need is for post_type "products", this means it is a custom post type, and custom does not mean common.

My hourly rate is USD$30 per hour.
I should be able to complete it around 2 hours, if your requirement is only those listed in your question. If you have more detail requirements, time will be added.

You can contact me if you are interested.

Thanks.
Denzel


Jake Caputo comments:

I actually did find this: http://wordpress.org/extend/plugins/author-avatars/

It works for everything I need except the custom post type. That's why I thought it would be something more simple than it apparently is.


Denzel Chia comments:

Did you unzip and see the amount of codes inside?
You need time to read and understand the code before you can modify it.

I am sure you will not want to pay my time reading and understanding it.
It could take hours.

It is much easier to create from scratch.

And you did not mention anything about multi site, which the plugin supports.
Do you need it to work for multi site?

Thanks.


Denzel Chia comments:

Hi Jake,

I had finished the two widgets. I had already email the codes to you.
Please refer to my email for farther instructions.

Thanks.
Denzel

2011-03-25

Maor Barazany answers:

And this you want for 7$?


Jake Caputo comments:

If I need to up it, let me know to how much. I thought this would be a pretty common widget people would have 'laying around'.

2011-03-26

AdamGold answers:

I think it should be something like this: (I hope you don't expect the full code for 7$)

global $wpdb;

global $wp_post_types;

$blogusers = get_users_of_blog();

if ($blogusers) {

foreach ($blogusers as $bloguser) {

$sql = <<<SQL

SELECT

post_type,

post_author,

COUNT(*) AS post_count

FROM

{$wpdb->posts}

WHERE post_type = 'products'

AND post_author = '{$bloguser->ID}'

GROUP BY

post_type,

post_author

SQL;

$posts = $wpdb->get_results($sql);

foreach( $posts as $user_posts ) {

if( $user_posts['post_count'] > 0 ) {

$user = get_userdata($bloguser->ID);

echo "<img src='http://www.gravatar.com/avatar/" . md5( strtolower( trim( " $user->user_email " ) ) )."?s=125' /><li>".$user->user_nicename."</li>";

}

}

}

}


AdamGold comments:

Well 77$ is something else :D Contact me through my profile for further help.


AdamGold comments:

Okay, first install the author-avatars plugin and replace the following code in lib/UserList.class.php:
$query = "SELECT user_id, user_login, display_name, user_email, user_url, user_registered, meta_key, meta_value FROM $wpdb->users, $wpdb->usermeta".
" WHERE " . $wpdb->users . ".ID = " . $wpdb->usermeta . ".user_id AND ". $blogs_condition . " AND user_status = 0";


with:

$query = "SELECT user_id, user_login, display_name, user_email, user_url, user_registered, meta_key, meta_value FROM $wpdb->users, $wpdb->usermeta".
" INNER JOIN " . $wpdb->posts . " ON " . $wpdb->posts . ".post_type='products' AND " . $wpdb->posts . ".post_author=" . $wpdb->users . ".ID WHERE " . $wpdb->users . ".ID = " . $wpdb->usermeta . ".user_id AND ". $blogs_condition . " AND user_status = 0";


AdamGold comments:

Okay first plugin is done. Create a new file under "plugins" folder named "gravatar-widget.php", and paste this code into it:

<?php
/*
Plugin Name: Gravatar Widget
Plugin URI: http://themeforest.net/AdamGold/portfolio?ref=AdamGold
Description: Gravatar widget
Author: AdamGold
Version: 1
Author URI: http://themeforest.net/AdamGold/portfolio?ref=AdamGold
*/

function gravatarList($data)
{
global $wpdb, $wp_post_types;
$blogusers = get_users_of_blog();
if ($blogusers) {
foreach( $data as $key => $value ) {
${$key} = get_option($key);
}
foreach( $blogusers as $bloguser ) {

$sql = <<<SQL
SELECT post_type, post_author, COUNT(*) AS post_count FROM {$wpdb->posts} WHERE post_type = 'products' AND post_author = '{$bloguser->ID}' GROUP BY post_type,post_author LIMIT 0, {$gravatar_users_to_display}
SQL;

$posts = $wpdb->get_results($sql);
foreach( $posts as $user_posts ) {
if( $user_posts->post_count > 0 ) {
$user = get_userdata($bloguser->ID);
echo "<img src='http://www.gravatar.com/avatar/" . md5( strtolower( trim( " $user->user_email " ) ) )."?s=80' /><li>".$user->user_nicename."</li>";
}
}
}
}


}

function widget_gravatarList($args) {
extract($args);
$data = array( 'gravatar_widget_title' => 'Gravatar Users', 'gravatar_users_to_display' => 'Users to display',
);
foreach( $data as $key => $value ) {
${$key} = get_option($key);
}
echo $before_widget;
echo $before_title; echo $gravatar_widget_title; echo $after_title;
gravatarList($data);
echo $after_widget;
}

function gravatarList_control(){
$data = array( 'gravatar_widget_title' => 'Gravatar Users', 'gravatar_users_to_display' => 'Users to display',
);
foreach( $data as $key => $value )
{
${$key} = get_option($key);
}
?>
<p>Widget title:<br />
<input class="widefat" type="text" name="gravatar_widget_title" value="<?php echo $gravatar_widget_title; ?>" /></p>
<p>Users to display:<br />
<input class="widefat" type="text" name="gravatar_users_to_display" value="<?php echo $gravatar_users_to_display; ?>" /></p>
<?php
if( isset($_POST['gravatar_widget_title']) )
{
foreach( $data as $key => $value )
{
update_option($key , $_POST[ $key ]);
}
}

}

function gravatarList_init()
{
register_sidebar_widget(__('Users Gravatar list'), 'widget_gravatarList');
register_widget_control( 'Users Gravatar list', 'gravatarList_control' );
}
add_action("plugins_loaded", "gravatarList_init");
?>

After pasting the code, go to your plugins page in WP admin control panel and enable the plugin "Gravatar widget".

Now, go to your widgets page in the WP control panel (Appearance -> Widgets) and just use the widget named "Users Gravatar list". You can choose how many users to display and what is the title of the widget.

About the second widget you would like to have, I didn't fully understand what you want. Can you please re-explain?

Thanks,
Adam.


AdamGold comments:

Sorry, forgot to style the list in my last code. So if you want to style it a bit more, replace:

echo "<img src='http://www.gravatar.com/avatar/" . md5( strtolower( trim( " $user->user_email " ) ) )."?s=80' /><li>".$user->user_nicename."</li>";

With:

echo "<img style='float: left' src='http://www.gravatar.com/avatar/" . md5( strtolower( trim( " $user->user_email " ) ) )."?s=80' /><div style='float: left; margin-left: 10px; font-size: 16px; font-weight:bold'>".$user->user_nicename."</div><div style='clear:both'></div>";


To edit the size of the Gravatar, change the "?s=80" to your desired width & height. (Although I recommend 80px)


Jake Caputo comments:

Hi Adam,
This wasn't really working the way I needed it to, and I didn't want a plugin. Denzel got both of the plugins done pretty quick. I assumed you gave up when I didn't hear from you for 9 hours.