Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

User Award System 2.0

Asked Modified Viewed 9,269 times
U
Ugleh
U
Ugleh 10
  • Member, joined since
  • Contributed 160 posts on the community forums.
  • Started 27 threads in the forums
  • Started this discussions
asked
Member

www.php-fusion.co.uk/infusions/marketplace/uploads/image/t_1263.png

This is a one of a kind Award System which allows you to create awards, and then give members these awards either manually or automatic (if you know PHP well).

Full documented read-me with a maincore.php function if you want to expand the use of this infusion.
This infusion comes with a User Field to show a users award on their profile, a Award page to show all the available awards to the public, and customization so you can put it under their name in the forums.



-- View this Addon --
Edited by Ugleh on 23-10-2012 20:55,
0 replies

19 posts

U
Ugleh
U
Ugleh 10
  • Member, joined since
  • Contributed 160 posts on the community forums.
  • Started 27 threads in the forums
  • Started this discussions
answered
Member

Next version should have a log that tells you which admin gave the user that award, as well as a panel for the last 5 awards given out. The SQL is already in there for which admin gave what but I never coded the logs.
0 replies
C
cybernie
C
  • Member, joined since
  • Contributed 90 posts on the community forums.
  • Started 27 threads in the forums
answered
Member

Very good infusion. What is the ideal size of the images should be used?
0 replies
U
Ugleh
U
Ugleh 10
  • Member, joined since
  • Contributed 160 posts on the community forums.
  • Started 27 threads in the forums
  • Started this discussions
answered
Member

Quote

cybernie wrote:

Very good infusion. What is the ideal size of the images should be used?


Ive been using 24x24 and using iconfinder.com, a great site.
0 replies
C
cybernie
C
  • Member, joined since
  • Contributed 90 posts on the community forums.
  • Started 27 threads in the forums
answered
Member

Thanks! I'll be using images of medals. I hope a 45x45px to 50x50px image won't distort the view viewforum.php
0 replies
U
Ugleh
U
Ugleh 10
  • Member, joined since
  • Contributed 160 posts on the community forums.
  • Started 27 threads in the forums
  • Started this discussions
answered
Member

It will just wrap around, but I feel the bigger the images the more sloppy it kind of looks.
0 replies
C
cybernie
C
  • Member, joined since
  • Contributed 90 posts on the community forums.
  • Started 27 threads in the forums
answered
Member

OK, thanks! Reducing the size of the images that I'm going to use actually messes the image that's why I am trying sizes that will keep the view of the images w/out affecting the layout of the site.
0 replies
C
cybernie
C
  • Member, joined since
  • Contributed 90 posts on the community forums.
  • Started 27 threads in the forums
answered
Member

Hello ugleh. How can I put a new line space in the reward images. When the reward images reaches max, it wraps and places the next images to the next line but there is no space between the 1st and 2nd line of images.
0 replies
Z
Zidane55
Z
  • Member, joined since
  • Contributed 90 posts on the community forums.
  • Started 26 threads in the forums
answered
Member

ey. I get an error in my edit_profile.php, when updating something I get this error in /includes/user_fields/user_awards_include.php on line 25 :

Fatal error: Cannot redeclare grabaward() (previously declared

how can this be solved?
0 replies
C
cybernie
C
  • Member, joined since
  • Contributed 90 posts on the community forums.
  • Started 27 threads in the forums
answered
Member

Everything works fine in me.

Here's the content of my /includes/user_fields/user_awards_include.php

[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false]<?php
/*-------------------------------------------------------+
| PHPFusion Content Management System
| Copyright © 2002 - 2008 Nick Jones
| http://www.php-fu...
+--------------------------------------------------------+
| Filename: user_awards_include.php
| Author: Ugleh
| Site: http://www.ugleh.com
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licen... Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
function grabaward($awards_id){
$result = dbquery("SELECT * FROM ".DB_PREFIX."award_system"." WHERE awards_id = '$awards_id' LIMIT 1"wink;
$data = dbarray($result);
return "<td width='1%' class='tbl2' style='white-space:nowrap'><strong>".$data['awards_title']."</strong></td>\n
<td width='1%' class='tbl2' style='white-space:nowrap'><strong><img src=\"".IMAGES."awards/".$data['awards_imageurl']."\" alt=\"".$data['awards_title']."\" title=\"".$data['awards_title']."\"></strong></td>\n
<td class='tbl2'>".$data['awards_description']."</td>";
}

if (!defined("IN_FUSION"wink) { die("Access Denied"wink; }

if ($profile_method == "input"wink {
//Nothing here
} elseif ($profile_method == "display"wink {
echo "</table>";
echo "<table cellpadding='0' cellspacing='1' width='400' class='profile_category tbl-border center'>";

echo "<tr>";
echo "<td colspan=\"2\" class=\"tbl2\"><strong>".$locale['user_awards_name']."</strong></td>\n";
echo "</tr>\n";

$user_id = $user_data['user_id'];
$result = dbquery("SELECT * FROM ".DB_PREFIX."award_users"." WHERE user_id = '".$user_id."' ORDER BY award_time"wink;
if (dbrows($result)) {
echo "<tr>\n";
echo "<td width='1%' class='tbl2' style='white-space:nowrap'><strong>".$locale['user_awards_002']."</strong></td>\n";
echo "<td width='1%' class='tbl2' style='white-space:nowrap'><strong>".$locale['user_awards_003']."</strong></td>\n";
echo "<td class='tbl2'><strong>".$locale['user_awards_004']."</strong></td>\n";
echo "</tr>\n";

while ($data = dbarray($result)) {
echo "<tr>";
echo "".grabaward($data['awards_id'])."";
echo "</tr>\n";
}

}else{

echo "<tr><td class='tbl2' >".$locale['user_awards_005']."</td>";
echo "</tr>\n";

}

} elseif ($profile_method == "validate_insert"wink {
//Nothing here
} elseif ($profile_method == "validate_update"wink {
//Nothing here
}
?>
[/syntaxhighlighter]
0 replies
A
Acert
A
Acert 10
  • Member, joined since
  • Contributed 54 posts on the community forums.
  • Started 13 threads in the forums
answered
Member

installed, but when i go to Admin Award it shows an Error.. "Table 'db_name.prfx_award_system' doesn't exist"

7.02.05
0 replies
H
Homdax
H
Homdax 10
  • Fusioneer, joined since
  • Contributed 2,247 posts on the community forums.
  • Started 108 threads in the forums
answered
Fusioneer

Please change the term "grammar nazi" for something else.
It may be considered offensive using that word.
0 replies
C
cybernie
C
  • Member, joined since
  • Contributed 90 posts on the community forums.
  • Started 27 threads in the forums
answered
Member

When a user has no award and you look at the profile, the "User currently has no awards." message goes out of the layout.

This is the user_awards_include.php that I am using now and it fixed the problem.

[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false]<?php
/*-------------------------------------------------------+
| PHPFusion Content Management System
| Copyright © 2002 - 2008 Nick Jones
| http://www.php-fu...
+--------------------------------------------------------+
| Filename: user_awards_include.php
| Author: Ugleh
| Site: http://www.ugleh.com
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licen... Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
function grabaward($awards_id){
$result = dbquery("SELECT * FROM ".DB_PREFIX."award_system"." WHERE awards_id = '$awards_id' LIMIT 1"wink;
$data = dbarray($result);
return "<td width='1%' class='tbl2' style='white-space:nowrap'><strong>".$data['awards_title']."</strong></td>\n
<td width='1%' class='tbl2' style='white-space:nowrap'><strong><img src=\"".IMAGES."awards/".$data['awards_imageurl']."\" alt=\"".$data['awards_title']."\" title=\"".$data['awards_title']."\"></strong></td>\n
<td class='tbl2'>".$data['awards_description']."</td>";
}

if (!defined("IN_FUSION"wink) { die("Access Denied"wink; }

if ($profile_method == "input"wink {
//Nothing here
} elseif ($profile_method == "display"wink {
echo "</table>";
echo "<table cellpadding='0' cellspacing='1' width='400' class='profile_category tbl-border center'>";

echo "<tr>";
echo "<td colspan=\"2\" class=\"tbl2\"><strong>".$locale['user_awards_name']."</strong></td>\n";
echo "</tr>\n";

$user_id = $user_data['user_id'];
$result = dbquery("SELECT * FROM ".DB_PREFIX."award_users"." WHERE user_id = '".$user_id."' ORDER BY award_time"wink;
if (dbrows($result)) {
echo "<tr>\n";
echo "<td width='1%' class='tbl2' style='white-space:nowrap'><strong>".$locale['user_awards_002']."</strong></td>\n";
echo "<td width='1%' class='tbl2' style='white-space:nowrap'><strong>".$locale['user_awards_003']."</strong></td>\n";
echo "<td class='tbl2'><strong>".$locale['user_awards_004']."</strong></td>\n";
echo "</tr>\n";

while ($data = dbarray($result)) {
echo "<tr>";
echo "".grabaward($data['awards_id'])."";
echo "</tr>\n";
}

}else{

echo "<tr><td class='tbl2' >".$locale['user_awards_005']."</td>";
echo "</tr>\n";

}

} elseif ($profile_method == "validate_insert"wink {
//Nothing here
} elseif ($profile_method == "validate_update"wink {
//Nothing here
}
?>
[/syntaxhighlighter]
0 replies
C
cybernie
C
  • Member, joined since
  • Contributed 90 posts on the community forums.
  • Started 27 threads in the forums
answered
Member

When a user has no award and you look at the profile, the "User currently has no awards." message goes out of the layout.

This is the user_awards_include.php that I am using now and it fixed the problem.

[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false]<?php
/*-------------------------------------------------------+
| PHPFusion Content Management System
| Copyright © 2002 - 2008 Nick Jones
| http://www.php-fu...
+--------------------------------------------------------+
| Filename: user_awards_include.php
| Author: Ugleh
| Site: http://www.ugleh.com
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licen... Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
function grabaward($awards_id){
$result = dbquery("SELECT * FROM ".DB_PREFIX."award_system"." WHERE awards_id = '$awards_id' LIMIT 1"wink;
$data = dbarray($result);
return "<td width='1%' class='tbl2' style='white-space:nowrap'><strong>".$data['awards_title']."</strong></td>\n
<td width='1%' class='tbl2' style='white-space:nowrap'><strong><img src=\"".IMAGES."awards/".$data['awards_imageurl']."\" alt=\"".$data['awards_title']."\" title=\"".$data['awards_title']."\"></strong></td>\n
<td class='tbl2'>".$data['awards_description']."</td>";
}

if (!defined("IN_FUSION"wink) { die("Access Denied"wink; }

if ($profile_method == "input"wink {
//Nothing here
} elseif ($profile_method == "display"wink {
echo "</table>";
echo "<table cellpadding='0' cellspacing='1' width='400' class='profile_category tbl-border center'>";

echo "<tr>";
echo "<td colspan=\"2\" class=\"tbl2\"><strong>".$locale['user_awards_name']."</strong></td>\n";
echo "</tr>\n";

$user_id = $user_data['user_id'];
$result = dbquery("SELECT * FROM ".DB_PREFIX."award_users"." WHERE user_id = '".$user_id."' ORDER BY award_time"wink;
if (dbrows($result)) {
echo "<tr>\n";
echo "<td width='1%' class='tbl2' style='white-space:nowrap'><strong>".$locale['user_awards_002']."</strong></td>\n";
echo "<td width='1%' class='tbl2' style='white-space:nowrap'><strong>".$locale['user_awards_003']."</strong></td>\n";
echo "<td class='tbl2'><strong>".$locale['user_awards_004']."</strong></td>\n";
echo "</tr>\n";

while ($data = dbarray($result)) {
echo "<tr>";
echo "".grabaward($data['awards_id'])."";
echo "</tr>\n";
}

}else{

echo "<tr><td class='tbl2' >".$locale['user_awards_005']."</td>";
echo "</tr>\n";

}

} elseif ($profile_method == "validate_insert"wink {
//Nothing here
} elseif ($profile_method == "validate_update"wink {
//Nothing here
}
?>
[/syntaxhighlighter]


Here's another problem that I have seen even in v1.0. After editing a member's profile, I get this error:

Quote

Fatal error: Cannot redeclare grabaward() (previously declared in /home/tubignon/public_html/includes/user_fields/user_awards_include.php:19) in /home/tubignon/public_html/includes/user_fields/user_awards_include.php on line 25


How can we fix that? Please refer to the PHP code above as it is the file that is being referred to by the error message.

Thanks!
0 replies
P
PolarFox
P
  • Veteran Member, joined since
  • Contributed 1,633 posts on the community forums.
  • Started 29 threads in the forums
answered
Veteran Member

Untested! Make a backup first.

Replace
function grabaward($awards_id){
   $result = dbquery("SELECT * FROM ".DB_PREFIX."award_system"." WHERE awards_id = '$awards_id' LIMIT 1");
   $data = dbarray($result);
return "<td width='1%' class='tbl2' style='white-space:nowrap'><strong>".$data['awards_title']."</strong></td>\n
<td width='1%' class='tbl2' style='white-space:nowrap'><strong><img src=\"".IMAGES."awards/".$data['awards_imageurl']."\" alt=\"".$data['awards_title']."\" title=\"".$data['awards_title']."\"></strong></td>\n
<td class='tbl2'>".$data['awards_description']."</td>";
}

with
if(!function_exists('grabaward')){
   function grabaward($awards_id){
      $result = dbquery("SELECT * FROM ".DB_PREFIX."award_system"." WHERE awards_id = '$awards_id' LIMIT 1");
      $data = dbarray($result);
   return "<td width='1%' class='tbl2' style='white-space:nowrap'><strong>".$data['awards_title']."</strong></td>\n
   <td width='1%' class='tbl2' style='white-space:nowrap'><strong><img src=\"".IMAGES."awards/".$data['awards_imageurl']."\" alt=\"".$data['awards_title']."\" title=\"".$data['awards_title']."\"></strong></td>\n
   <td class='tbl2'>".$data['awards_description']."</td>";
   }
}
0 replies
C
cybernie
C
  • Member, joined since
  • Contributed 90 posts on the community forums.
  • Started 27 threads in the forums
answered
Member

Thanks! That worked!
0 replies
— 1 month later —
M
masterronnow
M
  • Newbie, joined since
  • Contributed 3 posts on the community forums.
answered
Newbie

Didnt work for me. Is there another way to fix it?
0 replies
P
PolarFox
P
  • Veteran Member, joined since
  • Contributed 1,633 posts on the community forums.
  • Started 29 threads in the forums
answered
Veteran Member

Fix what?
0 replies
M
masterronnow
M
  • Newbie, joined since
  • Contributed 3 posts on the community forums.
answered
Newbie

Quote

cybernie wrote:

When a user has no award and you look at the profile, the "User currently has no awards." message goes out of the layout.

0 replies
M
masterronnow
M
  • Newbie, joined since
  • Contributed 3 posts on the community forums.
answered
Newbie

can anybody help please?
0 replies

Labels

None yet

Statistics

  • Views 0 views
  • Posts 19 posts
  • Votes 0 votes
  • Topic users 7 members

0 participants

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet