Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.7 > vBulletin 3.7 Add-ons
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Yet Another Awards System Details »»
Yet Another Awards System
Version: 3.7.4, by Xanlamin Xanlamin is offline
Developer Last Online: Apr 2015 Show Printable Version Email this Page

Category: Miscellaneous Hacks - Version: 3.7.x Rating:
Released: 08-08-2008 Last Update: 11-22-2008 Installs: 511
DB Changes Uses Plugins Auto-Templates
Re-useable Code Code Changes Additional Files  
No support by the author.

A lot of you have been waiting for this forever to work 100% with 3.7 due to the new profile tabs...Well wait no longer, here is the new revises version of HacNho's YAAS (Yet Another Awards System).

DESCRIPTION:
This is a Medals/Awards system. Admin can give members awards, and award icons will be displayed in member's profile, posts, as well as in a award list.

FEATURES:
In AdminCP
- Can Create/Edit/Delete/Reorder categories/sub-categories in ACP (with category name and description)
- Can Create/Edit/Delete awards in ACP (with Award Name, Description, Icon URL, Image URL)
- Can Move one (or all) award(s) from one category to another
- Can set some awards un-classified (not displayed for public)
- Can re-order awards in awards showcase
+ Issue awards to members, based on username or userid, with Issue Reason
+ Remove awards from members

In ModCP
+ Issue awards to members, based on username or userid, with Issue Reason
+ Remove awards from members

Front page
- Display awards list in with: Award Name, Description, Icon, Image, and Members who get each award.
- Display awards showcase in profile, with Award information, Issue time and reason
- Display award icons in postbit (showthread, showpost, announcement, private)

CHANGES/MODIFICATION:
- Tables to add: 3 (award, award_user, award_cat)
- Files to add: 4 (/awards.php, /award_request.php, /admincp/award.php, /admincp/award_cat.php)


DIFFICULTY:

Easy
Time: about 5 minutes
Installer is included (1 product XML)

CREDIT:
Idea has been carried on by many people, here are some:
- Lesane for original Award hack for vB2, eventhough I've never use his hack
- AnimeWebby for Awards/ Medals/ Cards Hack [vB3], which I write new code based on his.
- Mac ycl6 for phpBB Medal System for phpBB forum
- Dr Erwin Loh for FORM TO THREAD/ FORUM/ PM/ EMAIL hack
- Cypher for helping with the tabs in 3.7
- liwo for re-writing plugins
- and all others for supports and ideas

And most of all to HacNho

This MOD is 100% Supported.

Authors of YaAS 3.7:
Xanlamin
CypherSTL

Current Release: v3.7.4

Supporters / CoAuthors

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #512  
Old 04-16-2009, 04:47 PM
RedSpiral RedSpiral is offline
 
Join Date: Apr 2009
Location: England
Posts: 19
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks!

This is exactly what I needed for my forum!
Reply With Quote
  #513  
Old 04-21-2009, 04:42 PM
jcline jcline is offline
 
Join Date: Jul 2004
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

bug with the drop down in the settings... Sorting: Awards Listings always reverts to "Issue Time-Newest First" so if you don't notice, and change a different setting, it changes your sort order back to newest first.
Reply With Quote
  #514  
Old 06-25-2009, 02:33 AM
titodj titodj is offline
 
Join Date: Dec 2005
Posts: 59
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Gandalf-LoJ View Post


On another note, I've also got the award system plugged into the permissions now and when an award is given to a user a scheduled task runs and checks for new awards and assigns them to a usergroup based on the award. There is also a script that checks for removed awards and will remove the relevant usergroup too.
Can you let us know how to do it?
Im trying to have a way for the mods to change a user from groups based on one award.
Reply With Quote
  #515  
Old 06-25-2009, 06:14 AM
Gandalf-LoJ Gandalf-LoJ is offline
 
Join Date: Feb 2005
Location: Sussex, UK
Posts: 15
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by titodj View Post
Can you let us know how to do it?
Im trying to have a way for the mods to change a user from groups based on one award.
Sure. A few things to note. Firstly, this assumes you have a reasonable knowledge of php as they are manual files. Secondly, you need to work out what awards (specifically their ID's) need to belong to what group (again you need to know the ID's)

All the groups are set in the arrays at the top. The first column (value) in the array is the award ID. The second column (value) is the usergroup that you want to assign this award to.

The reason there are two arrays is because we have one particular award that we want to assign to two separate usergroups. This may not apply to you, if it doesn't then you can remove $arr2 and comment out the while loop.

Here is the code. I called it award2group.php and placed it in the modules folder of the forum.

PHP Code:
<?php

// ######################## SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);
if (!
is_object($vbulletin->db))
{
    exit;
}

// ########################### SET VARIABLES ##############################

$arr1 = array(    
                
=> 50,
                
=> 38,
                
=> 50,
                
=> 53,
                
12 => 23,
                
13 => 43,
                
14 => 43,
                
17 => 51,
                
18 => 37,
                
20 => 53,
                
21 => 53,
                
24 => 53,
                
25 => 53,
                
29 => 48,
                
31 => 40,
                
32 => 39,
                
38 => 46,
                
39 => 52    
            
);
            
$arr2 = array(    
                
=> 7    
            
);

// ########################################################################
// ######################### USERGROUP UPDATES ############################
// #########################    GIVE ACCESS    ############################
// ########################################################################

$i 1;
while (
$i <= 2)
{
    if (
$i == 1)
    {
        
$arr $arr1;
    }
    else
    {
        
$arr $arr2;
    }
    foreach (
$arr as $awardval => $aw2gr)
    {
        
// check for award and update secondary usergroup if required
        
$giveawards $vbulletin->db->query_read("
            SELECT aw.award_id, us.userid, us.membergroupids 
            FROM " 
TABLE_PREFIX "award_user as aw
            LEFT OUTER JOIN " 
TABLE_PREFIX "user AS us ON us.userid = aw.userid AND (aw.award_id = $awardval)
            WHERE FIND_IN_SET(
$aw2gr, us.membergroupids) = 0
        "
);
        
        if (
$vbulletin->db->num_rows($giveawards) > 0)
        {
            while (
$giveawardsrow $vbulletin->db->fetch_array($giveawards))
            { 
// for each award, check to see if they are a member of the relevant group and update accordingly
                
$userdm =& datamanager_init('User'$vbulletinERRTYPE_ARRAY); 
                
$userinfo fetch_userinfo($giveawardsrow['userid']);
                
$userdm->set_existing($userinfo); 
                
$membergroupids $userdm->fetch_field('membergroupids');
                if (
$membergroupids != "")
                {
                    
// Explode to an array
                    
$mbrgrp_array explode(","$membergroupids);
                    
// Add remove/add group to array
                    
$mbrgrp_array[] = $aw2gr;
                    
// Make it a comma seperated string again
                    
$membergroupids implode(","$mbrgrp_array);  
                }
                else
                {
                    
$membergroupids $aw2gr;
                }
                
$userdm->set('membergroupids'$membergroupids);
                
$userdm->pre_save();
                if (
count($userdm->errors))
                {
                    for (
$i 0$i count($userdm->errors); $i++)
                    {
                        echo 
"ERROR{$i}:{$userdm->errors[$i]}\n";
                    }
                }
                else
                {
                    
// If everything is OK
                    
$userdm->save();
                    unset(
$mbrgrp_array);
                }
            }
            
$vbulletin->db->free_result($giveawardsrow);
        }
    }
    
$i++;
}

// ########################################################################
// ######################### USERGROUP UPDATES ############################
// #########################    GIVE ACCESS    ############################
// ########################################################################

unset($giveawards$giveawardsrow$userdm$userinfo$membergroupids$awardval$aw2gr$mbrgrp_array$i);     

log_cron_action(''$nextitem1);
?>
That will assign anyone who has an award to the relevant usergroup. NOTE: It will assign the group as a SECONDARY group only. It will not change or replace the users primary group membership.

Now for the removing part. If a user has an award taken away, you will need a script to remove that user from the assigned usergroup. This is handled in this script which I called delaward2group.php and placed in the same folder as the above.

You may notice that the arrays at the top of each file matches. This is so it only removes groups that have been assigned by awards. The array could be put in a separate php file and included into the two scripts so you only have one list to maintain but that all depends on your coding method.

PHP Code:
<?php

// ######################## SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);
if (!
is_object($vbulletin->db))
{
    exit;
}

// ########################### SET VARIABLES ##############################

$arr1 = array(    
                
=> 50,
                
=> 38,
                
=> 50,
                
=> 53,
                
12 => 23,
                
13 => 43,
                
14 => 43,
                
17 => 51,
                
18 => 37,
                
20 => 53,
                
21 => 53,
                
24 => 53,
                
25 => 53,
                
29 => 48,
                
31 => 40,
                
32 => 39,
                
38 => 46,
                
39 => 52    
            
);
            
$arr2 = array(    
                
=> 7    
            
);

// ########################################################################
// ######################### USERGROUP UPDATES ############################
// #########################   REMOVE ACCESS   ############################
// ########################################################################

$i 1;
while (
$i <= 2)
{
    if (
$i == 1)
    {
        
$arr $arr1;
    }
    else
    {
        
$arr $arr2;
    }
    foreach (
$arr as $awardval => $aw2gr)
    {
        
// need to get the keys from the array to use as an or in the query. This will make sure that a user that has one award that belongs to a multi award group does not get removed
        
$awardkeys array_keys($arr$aw2gr);
        
$keycount count($awardkeys);
        if (
$keycount == 1)
        { 
// single key then there only needs to be one value for the query
            
$awardor $awardkeys[0];
        }
        else
        {
            for (
$ac 0$ac $keycount$ac++)
            { 
// more than one key then the query OR needs to be constructed here
                
if ($ac $keycount 1)
                {
                    
$awardor .= $awardkeys[$ac] . " OR aw.award_id = ";
                }
                else
                {
                    
$awardor .= $awardkeys[$ac];
                }
            }
        }
        unset(
$awardkeys$ac);
        
// check for groups that no longer have the award and remove them from the secondary user group
        
$delawards $vbulletin->db->query_read("
            SELECT DISTINCT us.userid, us.membergroupids
            FROM " 
TABLE_PREFIX "user AS us
            WHERE NOT EXISTS (
            SELECT aw.userid, aw.award_id
            FROM " 
TABLE_PREFIX "award_user AS aw
            WHERE (aw.award_id = 
$awardor) AND us.userid = aw.userid) AND FIND_IN_SET($aw2gr, us.membergroupids) <> 0
        "
);
        unset(
$awardor); // unset the OR query here or it'll continue to add to it on the next loop
        
if ($vbulletin->db->num_rows($delawards) > 0)
        {
            while (
$delawardsrow $vbulletin->db->fetch_array($delawards))
            { 
// remove group from users that no longer have the award
                
$userdm =& datamanager_init('User'$vbulletinERRTYPE_ARRAY); 
                
$userinfo fetch_userinfo($delawardsrow['userid']);
                
$userdm->set_existing($userinfo); 
                
$membergroupids $userdm->fetch_field('membergroupids');
                if (
$membergroupids != "")
                {
                    
// Explode to an array
                    
$mbrgrp_array explode(","$membergroupids);
                    
// Add remove/add group to array
                    
$key array_search($aw2gr$mbrgrp_array);
                    unset(
$mbrgrp_array[$key]);
                    
// Make it a comma seperated string again
                    
$membergroupids implode(","$mbrgrp_array);
                }
                
$userdm->set('membergroupids'$membergroupids);
                
$userdm->pre_save();
                if (
count($userdm->errors))
                {
                    for (
$i 0$i count($userdm->errors); $i++)
                    {
                        echo 
"ERROR{$i}:{$userdm->errors[$i]}\n";
                    }
                }
                else
                {
                    
// If everything is OK
                    
$userdm->save();
                    unset(
$mbrgrp_array);
                }
            }
            
$vbulletin->db->free_result($delawardsrow);
        }
    }
    
$i++;
}

// ########################################################################
// ######################### USERGROUP UPDATES ############################
// #########################   REMOVE ACCESS   ############################
// ########################################################################

unset($delawards$delawardsrow$userdm$userinfo$membergroupids$awardval$aw2gr$i);     

log_cron_action(''$nextitem1);
?>
All you need to do now is setup two scheduled tasks to call the two scripts. I have the award2group.php running every hour and the delaward2group.php running every 12 hours. You can choose a schedule to suit your particular needs.
Reply With Quote
  #516  
Old 06-25-2009, 01:46 PM
titodj titodj is offline
 
Join Date: Dec 2005
Posts: 59
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you !! Let see if I can figure this out....
Reply With Quote
  #517  
Old 07-13-2009, 05:53 PM
katie hunter's Avatar
katie hunter katie hunter is offline
 
Join Date: May 2007
Posts: 533
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi, I've posted this before but it kinda get forgotten.
i think it will give the award system new look and functions.

https://vborg.vbsupport.ru/showpost....&postcount=373

I've added to new screenshots
Reply With Quote
  #518  
Old 08-11-2009, 08:56 PM
Cadellin's Avatar
Cadellin Cadellin is offline
 
Join Date: Jan 2009
Posts: 160
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

A really useful facility would be the ability to have some awards awarded automatically - e.g based on time since regitation - or if your a member of a certain group (I know you can become a member because of an award I'm after the opposite )

Great mod though
Reply With Quote
  #519  
Old 08-12-2009, 03:59 AM
SBlueman SBlueman is offline
 
Join Date: Jan 2006
Posts: 717
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I am running 3.6.12....is this compatible with that version?
Reply With Quote
  #520  
Old 08-27-2009, 12:02 AM
wapsilog wapsilog is offline
 
Join Date: May 2008
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

unable to set display format to ASC...
anybody ecounter same problem?
Reply With Quote
  #521  
Old 09-17-2009, 11:08 PM
jaderollie jaderollie is offline
 
Join Date: Nov 2008
Posts: 79
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i cant see an awards section in admincp, so how do i give a user a medal??
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:37 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05062 seconds
  • Memory Usage 2,417KB
  • Queries Executed 26 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (2)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (2)pagenav_pagelinkrel
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete