Posted by poopertropper on November 4, 2010 at 11:28pm
4 followers
Jump to:
| Project: | User Badges |
| Version: | 6.x-1.5 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | poopertropper |
| Status: | postponed (maintainer needs more info) |
Issue Summary
Is there anyway to use the Badges module to send out achievement badges much like Xbox 360 does in its games?
Instead of being based on a points structure it would be nice to assign a badge based on a milestone reached. There is currently a dead mod called Achievements over at http://drupal.org/project/achievements that was starting to do this. This type of system would work a lot better by being flexible and based on admin created milestones.
Just wondering if this was ever a thought of the Badges mod. Thanks!
Comments
#1
Rules could be used for this, unfortunately, it's not implemented yet.
#2
Huge bummer
#3
I have no idea what Xbox does. Please describe your request more fully.
This module does not assign badges automatically; someone or some module has to trigger it to happen (such as a role change). So, in that respect the Auto Assign Roles module might help to make this happen.
#4
The Xbox basically hands out an achievement (Badges) for every time a user accomplishes something in a game. So milestones are set up and once a user passes that milestone they would receive the achievement (Badges).
I notice a module that does just this over at http://drupal.org/project/issues/achievements but it seems to be abandon. The idea I would like to create is to have badges be assigned each time a member passes a milestone on the site. Milestones could be set up in the modules interface and allow the admin total control of how they look and are assigned. For example...
User comments 30 times in a month and is assigned a new badge called "Power Comments!"
User becomes a "friend" of another member of the site and is assigned a new badge called "Thats what friends are for"
User has been a part of the site for 3 years and is assigned a badge called "3 Year Anniversary"
So for the 3 examples an admin can create a milestone to occur when a user reaches the milestone. The badge is then assigned to the member automatically without the admin having to do so. This means people can receive badges just by interacting with the site. It creates a community within the community and helps members to find new ways to contribute to the site they love. Hope this helps.
#5
That kind of stuff is way out of scope for this module. You need something like the achievements module (you can always resurrect it yourself). It could even be an add-on for this module.
Likeless is free to override me, but my inclination is to mark this "won't fix."
#6
You can always set it by external script. For example, I'm using PHP script which is updating Badges table according to XML data on another site. There is basicly one table with defined badges and another with user IDs and assigned badges. All you need to do is to add ID of user and ID of badge and it's done. Requires only a simple query. (Using stable version, dunno about dev).
#7
Thanks for reply Ill look to find a programmer who can help.
#8
This is not terribly difficult. For example, I set up a "Top Tweeter" badge yesterday (about an hour):
function mysite_badges_top_tweeters() {
// Get the badge id.
$bname = variable_get('mysite_badges_top_tweeter', 'Top Tweeter');
$bid = db_result(db_query("SELECT bid FROM {user_badges_badges} WHERE name = '%s'", $bname));
if (!$bid) {
return t('The "@badge_name" badge could not be located.', array('@badge_name' => $bname));
}
// Delete all current badge holders.
db_query("DELETE FROM {user_badges_user} WHERE bid = %d", $bid);
$rows_per_page = isset($_REQUEST['rows']) ? $_REQUEST['rows'] : 2 * variable_get('default_nodes_main', 10);
$query = "SELECT u.uid, rn.realname, twu.screen_name, COUNT(tw.twitter_id) AS tweets "
. "FROM users u "
. "INNER JOIN users_roles ur ON ur.uid=u.uid "
. "INNER JOIN realname rn ON rn.uid=u.uid "
. "LEFT JOIN twitter_user twu ON twu.uid=u.uid "
. "LEFT JOIN twitter tw ON tw.screen_name=twu.screen_name "
. "WHERE ur.rid = 3 "
. "GROUP BY u.uid "
. "ORDER BY tweets DESC"
;
$result = db_query_range($query, 0, $rows_per_page);
$rows = array();
$header = array(t('Name'), t('Screen Name'), t('Tweets'));
while ($row = db_fetch_object($result)) {
$rows[] = array(
l($row->realname, "blog/$row->uid"),
check_plain($row->screen_name),
array('data' => ($row->tweets ? number_format($row->tweets) : ''), 'class' => 'right'),
);
user_badges_user_add_badge($row->uid, $bid, 'user');
}
return theme('table', $header, $rows);
}
This is fancier than it needs to be, but not as fancy as it could be. While we still do it manually (we haven't decided if this will be useful yet), it could easily be set up on a cron run.
#9
Very cool. Wish I had the programming skills to build it out myself. At least I have the money for it. :)
#10
I have a few days to spare and could use some cash. My contact form is enabled; please send the specs.
#11
One might want to look at Achievements for Drupal 7 too: http://drupal.org/project/achievements