PDA

View Full Version : Miscellaneous Hacks - Yet Another Awards System


Pages : 1 2 [3]

merkaz
02-22-2009, 11:34 PM
Very nice mood .

Thanks man.

inciarco
02-23-2009, 03:29 AM
Question:

I'd like the Poll to be Public on the Thread of Award Request for an User. What Code Lines on What Plugins Should I Change (and What Code Should I Use), for the Polls to be Public instead of Private (currently the Polls are Created Private), so that I can see Who Voted Yes or No to the Award Request? :confused:

I think is Important to Know Who Voted Yes and No, when making the Voting Recount, and to Exclude Votes from Users that Voted without any Criteria (Trolls).

(I think that Perhaps Adding a Yes/No Option to Choose to Create the Poll Public would be a Nice Feature on Your Next Update of this Great Mod.) ;)

My Best Regards.

:)

BLykMik
02-24-2009, 11:37 PM
great mod... quick question...

Is there a way to change the column widths on the awards.php page? Specifically the "Name / Description" width is too narrow. We have longer descriptions to our awards and they're getting squeezed pretty bad.

Thanks!

PinkDaisy
02-28-2009, 11:47 AM
I prefer the awards to show up in the signatures area... But it defaults to align to the left. Is there a way to center them?

zombietom
02-28-2009, 06:39 PM
Installed and working fine now..i had a small issue with the "request an award" link as it was not sending the pm and giving the "you don;t have permission" text --but i got past it --seems you need to go to your usergroups and it will kind of refresh and then it should work.

thanks for the great and east to use mod!

The_Rascal
03-11-2009, 10:28 AM
Wrong Mod :$
Oops

KenDude
03-12-2009, 05:47 AM
SAD! There should be some sort of mod support ENFORCEMENT! The author and the person listed for support have not been here since December of last year! So I tried going to CypherSTL's site, guess what it isn't working, email and PM from here are either undeliverable or unreturned. Why should I risk installing this mod and breaking the 3.5 version I currently have had working for 2 years and which keeps working up through vbulletin 3.8.1?

Is anyone EVER going to upgrade this mod AND support it???

BTW there are no install docs or upgrade docs in the ZIP file here, it says nothing about what will happen to my existing awards for members that have been granted in my 3.5 version.

Ugh... FRUSTRATION!

MTGDarkness
03-13-2009, 12:33 PM
The templates on this MOD don't cache right on my forum, and this leads to a lot of extra queries. How can I fix this?

Pocket Aces
03-20-2009, 04:46 AM
How do we increase the width of the name/description column in awards.php page? Which template and particular code to edit?

Makaveli007
03-20-2009, 09:07 PM
thanks, installed

RedSpiral
04-16-2009, 04:47 PM
Thanks!

This is exactly what I needed for my forum!

jcline
04-21-2009, 04:42 PM
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.

titodj
06-25-2009, 02:33 AM
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.

Gandalf-LoJ
06-25-2009, 06:14 AM
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

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

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

$arr1 = array(
3 => 50,
5 => 38,
6 => 50,
9 => 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(
9 => 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', $vbulletin, ERRTYPE_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('', $nextitem, 1);
?>

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

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

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

$arr1 = array(
3 => 50,
5 => 38,
6 => 50,
9 => 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(
9 => 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', $vbulletin, ERRTYPE_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('', $nextitem, 1);
?>

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.

titodj
06-25-2009, 01:46 PM
Thank you !! Let see if I can figure this out....

katie hunter
07-13-2009, 05:53 PM
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.php?p=1665466&postcount=373

I've added to new screenshots

Cadellin
08-11-2009, 08:56 PM
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 :)

SBlueman
08-12-2009, 03:59 AM
I am running 3.6.12....is this compatible with that version?

wapsilog
08-27-2009, 12:02 AM
unable to set display format to ASC...
anybody ecounter same problem?

jaderollie
09-17-2009, 11:08 PM
i cant see an awards section in admincp, so how do i give a user a medal??

Lianelli
10-06-2009, 06:03 PM
Can anyone post the code to make the real awards show up in the postbit, instead of the icons? If not I'll work my way around it, but rather use a good modification instead of messing with templates myself...

jaderollie
10-06-2009, 06:30 PM
Can anyone post the code to make the real awards show up in the postbit, instead of the icons? If not I'll work my way around it, but rather use a good modification instead of messing with templates myself...

thanks,

Lianelli
10-07-2009, 04:16 AM
Jaderollie: did you activate the plugin? It will show at the left admincp menu afterwards.

jaderollie
10-07-2009, 04:22 PM
Jaderollie: did you activate the plugin? It will show at the left admincp menu afterwards.

yes its activated

profanitytalker
10-15-2009, 04:57 PM
Can anyone help me? I'm getting this...


Fatal error: Cannot redeclare construct_depth_mark() (previously declared in /var/www/personalitycafe.com/awards.php:97) in /var/www/personalitycafe.com/includes/adminfunctions.php on line 1825

TheLastSuperman
10-15-2009, 06:02 PM
I am running 3.6.12....is this compatible with that version?

There is a 3.6 version by the previous author, it will still create the thread when requested and has one-click approval (if not PM me for the code) you just have to do the tmeplate edits and you can show what you want that way. Sometimes hand coding is better when you didn't make the mod.. again, sometimes :D

S-MAN

jaderollie
10-15-2009, 06:45 PM
i may unistall this 1, as i cant get it going niether :(

SBlueman
10-17-2009, 08:28 PM
I am running 3.6.12....is this compatible with that version?

anyone?

TheLastSuperman
10-17-2009, 08:49 PM
anyone?



2 Posts up :p

Here it is: https://vborg.vbsupport.ru/showthread.php?t=142487

Or my similar Ranks system for 3.6.x: https://vborg.vbsupport.ru/showthread.php?t=142487

Either mod you can make the titles, images what you want and resize for different uses. Only drawback it has more template edits back then but more flexibilty in terms of how you can display them in certain locations including postbit!

S-MAN

SBlueman
10-17-2009, 09:03 PM
Problem with the 3.6 version is I had to uninstall it due to SQL memory leaks that almost killed my site.

TheLastSuperman
10-17-2009, 10:50 PM
Problem with the 3.6 version is I had to uninstall it due to SQL memory leaks that almost killed my site.

Really? Hmm never had an issue.... I'll check into it in the ranks version as it is very similar to the old Awards system.

kNeeLy
10-19-2009, 11:02 AM
i have had this installed forever now..does anyone know where to get sum new/fresh awards?

TheLastSuperman
10-19-2009, 11:10 AM
i have had this installed forever now..does anyone know where to get sum new/fresh awards?

For what? I have COD4 & BF2142 that are perfect but you said new and those are slightly outdated O.o

Google Icons or icon packs most come w/ png and use them or find a good little ribbon to use as a BG and then overlay the icon or graphic and save ;)

Xanlamin
11-13-2009, 04:39 AM
With 4.0 just around the corner we will no longer be supporting the 3.7 version so we can concentrate on 3.8 and 100% recode for 4.0. If you upgrade your forums to 3.8 or vB4 you can go over to those releases and have continued support.

MarceloS
11-14-2009, 10:43 AM
With 4.0 just around the corner we will no longer be supporting the 3.7 version so we can concentrate on 3.8 and 100% recode for 4.0. If you upgrade your forums to 3.8 or vB4 you can go over to those releases and have continued support.

Excellent news man. I am glad to hear that you will be working on a 4.0 version.

By the way, do you think that most mods will not be compatible with 4.0?

gnagplank6
11-16-2009, 02:45 AM
This mod sounds awesome.

I would very much like to install it, but does anyone know whether it will run with VB 3.8+???

Thanks!!

kNeeLy
11-22-2009, 11:03 PM
For what? I have COD4 & BF2142 that are perfect but you said new and those are slightly outdated O.o

Google Icons or icon packs most come w/ png and use them or find a good little ribbon to use as a BG and then overlay the icon or graphic and save ;)

im terrible at photochopping tho... :-( Is there anywhere that you know that i can DL sum new awards? I run a car forum and need sum more/new ones.

Xanlamin
11-22-2009, 11:22 PM
Excellent news man. I am glad to hear that you will be working on a 4.0 version.

By the way, do you think that most mods will not be compatible with 4.0?

So far there are a lot of mods written for 3.8 that do in fact work without modification with 4.0

This mod sounds awesome.

I would very much like to install it, but does anyone know whether it will run with VB 3.8+???

Thanks!!

We have a 3.8 version of this mod in the 3.8 Mods section.

dfidler
01-05-2010, 08:40 PM
This mod will fail if you try to grant an award to a user by username, if their username has a single quote in it. eg my'name.

The fix is simple.

Edit the following files:

admincp/award.php
modcp/award.php


Now find the code in these files (there are two instances of it in each file for a total of four).


WHERE username = '". $vbulletin->GPC['awardusername']


Change it to:


WHERE username = '". $db->escape_string($vbulletin->GPC['awardusername'])


Note: this bug may be fixed in newer versions or it may already be mentioned here in the mod discussion.. However, it was WAY faster for me to find+fix the bug than to read through the 36 pages of comments on this mod. Apologies if this has already been found. In my defense, the mod download doesn't include this fix in it [yet?].

fishmaster
01-09-2010, 11:28 PM
Any news on the 4.0 version?

CypherSTL
01-10-2010, 09:05 AM
Release 4.0.0 BETA is now available.
https://vborg.vbsupport.ru/showthread.php?t=232684

OurCouponHome
05-12-2010, 10:39 PM
I am a complete tech newbie here so please go easy on me...I uploaded this to my site. Now how do I give out an award?

katie hunter
05-31-2010, 02:27 PM
Hii Xanlamin - CypherSTL,

Do you think you can implant this feature? :0)

https://vborg.vbsupport.ru/showpost.php?p=1665466&postcount=373

Xanlamin
05-31-2010, 05:02 PM
This is being worked on for our 3.8 version and 4.x versions.

CypherSTL
05-31-2010, 07:14 PM
Yep; I am already working on the 'Page Navigation' to add multiple pages for a lot of awards.

katie hunter
05-31-2010, 07:25 PM
Oh!! these are nice news! =) i can't wait to see its layout and how it will look, can we see a version for 3.7.x ? hopefully the 3.8.x should work on the 3.7.x version right ?

profanitytalker
06-28-2010, 04:10 AM
Can anyone help me? I'm getting this...


Fatal error: Cannot redeclare construct_depth_mark() (previously declared in /var/www/personalitycafe.com/awards.php:97) in /var/www/personalitycafe.com/includes/adminfunctions.php on line 1825

Lionel
06-28-2010, 04:24 AM
you probably have another mod using adminfunctions.php

the easiest way to fix that would be to rename the function in the awards mod into
construct_depth_mark_awards and make sure you change the name also when calling that function

katie hunter
07-26-2010, 05:14 PM
This is being worked on for our 3.8 version and 4.x versions.

Yep; I am already working on the 'Page Navigation' to add multiple pages for a lot of awards.

Hi =) is there a release date set for this new update?

Xanlamin
07-26-2010, 05:55 PM
The awards systems for 3.8 and 4.0 has been out for quite awhile now.

katie hunter
07-30-2010, 03:29 PM
Hi Xanlamin,

I mean this update, you said it is being worked on implanting it:
https://vborg.vbsupport.ru/showpost.php?p=2046046&postcount=543

Fahadzor
11-01-2010, 06:28 PM
Thank you very much for the awards system .. I've been asked to install one for a forum I moderate and this seems to have all the options required ..

however, I keep getting a "Database Error" whenever I try to open a member profile. How can I sort the problem ? Is there any 'database' options i need to modify for it to work ?

HS2005
03-14-2011, 05:56 PM
I have a question about the postbit,

I see some members have the awards underneath eachother like
-------------
[4] awards
[4] awards
-------------

image: http://img79.imageshack.us/img79/9459/cocardasml7.jpg

On my forum the awards just kepp building up on one row.
I was wandering if i can put something like this;

if $post[num_awards] == 4
<br>
next awards etc.

Image my forum:
http://img716.imageshack.us/i/issuex.jpg/

Scyther
06-20-2011, 05:09 AM
unstalling as unable to issue award from mod cp.

Says:

Not Found

The requested URL /forum/modcp/award.php was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Can anyone help??

tomrep
06-07-2013, 01:08 AM
why i get error Deprecated: Assigning the return value of new by reference is deprecated in

DEGE
01-11-2014, 04:14 PM
Hi

I couldn't get it working on a vBulletin 3.8.7. Everything works fine until I try to manage, edit, or do anything with the awards, either from admincp or modcp

Does anybody have a clue on that? Is there any 3.8 working version?

Would appreciate any help.