News:

Want to get involved in developing SMF? Why not lend a hand on our GitHub!

Main Menu

Member Awards (2.0 Compatible!)

Started by Spuds, September 18, 2006, 03:14:03 PM

Previous topic - Next topic

Sudhakar Arjunan

#780
Quote from: YodaOfDarkness on September 05, 2008, 10:23:15 AM
new Profile.template.php is attached.

can you check your database to see if smf_awards has a row named "awardName" in it?
Hi now it shows the profile.php page has error. I have replaced the file you have edited.

Still it shows when i try clicking on profile button on my forum

Fatal error: Cannot redeclare awards() (previously declared in /home/itacumen/public_html/forum/Sources/Profile.php:3839) in /home/itacumen/public_html/forum/Sources/Profile.php on line 4190


-------------------------
updated
-------------------------


Quote from: YodaOfDarkness on September 05, 2008, 10:23:15 AM
can you check your database to see if smf_awards has a row named "awardName" in it?

No such row named awardName inside smf_awards database.
Working on New Mods & Themes for SMF... Will update soon... My Blog page
My Smf forum : Discuss ITAcumens :: My SMF Forum

Fustrate

are there any other rows in smf_awards? and you need to attach Profile.php to a post so I can remove the duplicate code
Steven Hoffman
Former Team Member, 2009-2012

Kimmie

Quote from: YodaOfDarkness on September 05, 2008, 12:59:17 AM
That error's been in there for 2 years, it looks like ;)

attached

just tried to upload the one you posted to the server but its not working. I think its because the file name is ManageAwards[1][1].template.php.txt. I tried renaming it but that didnt work.

Fustrate

Rename it ManageAwards.template.php

Steven Hoffman
Former Team Member, 2009-2012

Kimmie

#784
Quote from: YodaOfDarkness on September 06, 2008, 01:33:01 AM
Rename it ManageAwards.template.php



k I did that, uploaded it, and as soon as I clicked on the Awards link in the admin panel I got these 2 errors in my error log:

8: Undefined offset: 3
File: /home//public_html/Sources/Load.php
Line: 1930

8: Undefined offset: 3
File: /home//public_html/Sources/Load.php
Line: 1927

and this parse error:

There was a problem loading the /Themes/default/ManageAwards.template.php template or language file. Please check the syntax and try again - remember, single quotes (') often have to be escaped with a slash (\). To see more specific error information from PHP, try accessing the file directly.

You may want to try to refresh this page or use the default theme.

Parse error: syntax error, unexpected T_IF in .../Themes/default/ManageAwards.template.php on line 1
1: <?php/********************************************************************************* ManageAwards.template.php                                                     ** ----------------------------------------------------------------------------- ** This file handles the template side of Awards.                                *********************************************************************************** Software version:               Pogo Game Awards                              ** Software by:                    Juan "JayBachatero" Hernandez                 ** Copyright (c) 2006 by:          Juan "JayBachatero" Hernandez                 ** Contact:                        [email protected]                          ** Website:                        JayBachatero.com                              ** ============================================================================= ** This mod is free software; you may redistribute it and/or modify it as long   ** as you credit me for the original mod. This mod is distributed in the hope    ** that it is and will be useful, but WITHOUT ANY WARRANTIES; without even any   ** implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.      **                                                                               ** All SMF copyrights are still in effect. Anything not mine is theirs. Enjoy!   ** Some code found in here is copy written code by SMF, therefore it can not be  ** redistributed without official consent from myself or SMF.                    *********************************************************************************/if (!defined('SMF')) die ('Hacking attempt...');function template_main(){ global $context, $modSettings, $txt, $settings; // Setup the template echo ' <table border="0" cellspacing="1" cellpadding="4" align="center" width="100%" class="bordercolor"> <tr class="titlebg"> <td colspan="', $modSettings['pa_columns'], '">' ,$txt['pa_title'], '</td> </tr>'; // Check if this memebr has any awards if (empty($context['awards'])) { echo ' <tr class="windowbg2"> <td>', $txt['pa_error_no_badges'], '</td> </tr>'; } else { // Output the results $counter = 0; $alternate = true; $width = 100 / $modSettings['pa_columns']; foreach ($context['awards'] as $award) { // The opening tr tag if ($counter == 0) echo ' <tr class="windowbg', $alternate ? '2' : '', '">'; // The actual award echo ' <td align="center" width="', $width, '%" valign="top"> <table width="100%" height="100%"> <tr> <td width="', $width, '%" class="windowbg3"> <a href="', $award['edit'], '"><img src="', $settings['images_url'], '/icons/modify_inline.gif" alt="', $txt['pa_edit_award'], '" align="left" style="padding: 2px;" /></a> <a href="', $award['delete'], ';sesc=', $context['session_id'], '"><img src="', $settings['images_url'], '/icons/delete.gif" alt="', $txt['pa_delete'], '" align="left" style="padding: 2px;" /></a> <a href="', $award['assign'], '"><img src="', $settings['images_url'], '/icons/profile_sm.gif" alt="', $txt['pa_assign'], '" align="left" style="padding: 2px;" /></a> <a href="', $award['viewAssigned'], '"><img src="', $settings['images_url'], '/icons/members.gif" alt="', $txt['pa_view_assigned'], '" align="left" style="padding: 2px;" /></a> </td> </tr> <tr> <td width="', $width, '%" align="center" valign="bottom"> <br /> <a href="', $award['edit'], '"><img src="', $award['img'], '" width="', $award['width'], '" height="', $award['height'], '" alt="', $award['awardName'], '" /></a><br /> <strong>', $award['awardName'], '</strong><br /> ', $award['gameName'], '<br /> ', $award['time'], '<br /> </td> </tr> </table> </td>'; // Increase the counter. $counter++; // If we have reached the max columsn close it and reset the counter if ($counter == $modSettings['pa_columns']) { echo ' </tr>'; // Reset the counter $counter = 0; $alternate = !$alternate; } } // If $counter is not = 0 then we must close the last tr if ($counter != 0) { if ($modSettings['pa_columns'] - $counter > 0) { for ($i = 0; $i < $modSettings['pa_columns'] - $counter; $i++) echo ' <td class="windowbg', $alternate ? '2' : '', '"> </td>'; } echo ' </tr>'; } // Show the pages echo ' <tr class="catbg"> <td align="left" colspan="', $modSettings['pa_columns'], '"> <b>', $txt[139], ':</b> ', $context['page_index'], ' </td> </tr>'; } // Close the table echo ' </table>';}function template_modify(){ global $context, $txt, $scripturl, $modSettings; // Setup the template echo ' <form action="', $scripturl, '?action=awards;sa=modify" method="post" name="award" id="award" accept-charset="', $context['character_set'], '" enctype="multipart/form-data" style="padding:0; margin: 0;"> <table border="0" cellspacing="0" cellpadding="4" align="center" width="70%" class="tborder"> <tr class="titlebg"> <td colspan="2">', $context['editing'] == true ? $txt['pa_edit_award'] : $txt['pa_add_award'], '</td> </tr>'; // Are we editing?  If so show the actual award if ($context['editing'] == true) echo ' <tr class="windowbg3" align="center"> <td colspan="2"><img src="', $context['award']['img'], '" width="', $context['award']['width'], '" height="', $context['award']['height'], '" alt="', $context['award']['awardName'], '" /></td> </tr>'; // Area to type the name of the award echo ' <tr class="windowbg2"> <th valign="top" align="right" width="40%"> <label for="awardName">', $txt['pa_badge_name'], '</label>: </th> <td> <input type="text" name="awardName" id="awardName" value="', $context['award']['awardName'], '" size="30" /> </td> </tr>'; // Area to type the name of the game echo ' <tr class="windowbg2"> <th valign="top" align="right" width="40%"> <label for="gameName">', $txt['pa_game_name'], '</label>: </th> <td> <input type="text" name="gameName" id="gameName" value="', $context['award']['gameName'], '" sise="30" /> </td> </tr>'; // Now for the upload echo ' <tr class="windowbg2"> <th valign="top" align="right" width="40%"> <label for="awardFile">', $txt['pa_badge_upload'], '</label>: </th> <td> <input type="file" name="awardFile" id="awardFile" size="40" /> </td> </tr>'; // Submit button and a few other hidden fields echo ' <tr class="windowbg2"> <td class="windowbg2" colspan="2" align="right" valign="middle"> <input type="hidden" name="id" value="', $context['award']['id'], '" /> <input type="hidden" name="sc" value="', $context['session_id'], '" /> <input type="submit" name="award_save" value="' ,$context['editing'] ? $txt['pa_save'] : $txt['pa_submit'], '" accesskey="s" /> </td> </tr>'; // Close the table and form. echo ' </table> </form>';}function template_assign(){ global $context, $scripturl, $txt, $modSettings, $settings; // The first step.  This is where you select the membergorups if ($context['step'] == 1) { echo ' <form action="', $scripturl, '?action=awards;sa=assign;step=2', isset($_REQUEST['id']) ? ';id=' . $_REQUEST['id'] : '', '" method="post" accept-charset="', $context['character_set'], '"> <table width="70%" cellpadding="5" cellspacing="0" border="0" align="center" class="tborder"> <tr class="titlebg"> <td>', $txt['pa_mem_group'], '</td> </tr> <tr class="windowbg"> <td class="smalltext" style="padding: 2ex;">', $txt['pa_mem_group_desc'], '</td> </tr> <tr> <td class="windowbg2">'; foreach ($context['groups'] as $group) echo ' <label for="who[', $group['id'], ']"><input type="checkbox" name="who[', $group['id'], ']" id="who[', $group['id'], ']" value="', $group['id'], '" checked="checked" class="check" /> ', $group['name'], '</label> <i>(', $group['member_count'], ')</i><br />'; echo ' <br /> <label for="checkAllGroups"><input type="checkbox" id="checkAllGroups" checked="checked" onclick="invertAll(this, this.form, \'who\');" class="check" /> <i>', $txt[737], '</i></label><br /> </td> </tr> <tr> <td class="windowbg2" style="padding-bottom: 1ex;" align="right"> <input type="submit" value="', $txt[65], '" /> </td> </tr> </table> <input type="hidden" name="sc" value="', $context['session_id'], '" /> </form>'; } // Step 2: Show the awards and members to receive one. elseif ($context['step'] == 2) { // Javascript to change the award on selection echo ' <script language="JavaScript" type="text/javascript"> function showaward() { document.images.awards.src = '' . dirname($scripturl) . '/' . $modSettings['pa_awardsDir'] . '/\' + document.forms.assign.award.options[document.forms.assign.award.selectedIndex].id; } </script>'; // Badge select section echo ' <form action=', $scripturl, '?action=awards;sa=assign;step=3" method="post" name="assign" id="assign" accept-charset="', $context['character_set'], '"> <table width="70%" cellpadding="5" cellspacing="0" border="0" align="center" class="tborder"> <tr class="titlebg"> <td colspan="2">', $txt['pa_select_badge'], '</td> </tr> <td class="windowbg2"> <select name="award" onchange="showaward()" size="10"style=" width: 45%;">'; // Loop and show the drop down. foreach ($context['awards'] as $key => $award) echo ' <option value="', $key, '" id="', $award['filename'], '" ', isset($_REQUEST['id']) &&  $_REQUEST['id'] == $key ? 'selected="selected"' : '', '>', $award['awardName'], '</option>'; echo ' </select> <img id="awards" src="', isset($_REQUEST['award']) ? dirname($scripturl) . '/' . $modSettings['pa_awardsDir'] . '/' . $context['awards'][$_REQUEST['award']]['filename'] : '', '" align="top" /> </td>'; // Close table echo ' </table><br />'; // Select the members to give a award echo ' <table width="70%" cellpadding="5" cellspacing="0" border="0" align="center" class="tborder"> <tr class="titlebg"> <td colspan="', $modSettings['pa_columns'], '" class="windowbg2">', $txt['pa_select_member'], '</td> </tr>'; $counter = 0; $width = 100 / $modSettings['pa_columns']; foreach ($context['members'] as $key => $member) { // Open the tr if ($counter == 0) echo ' <tr>'; // The member echo ' <td class="windowbg2"><label for="member[', $key, ']"><input type="checkbox" name="member[', $key, ']" id="member[', $key, ']" value="', $key, '" checked="checked" class="check" /> ', $member, '</label></td>'; $counter++; // Close the tr if ($counter == $modSettings['pa_columns']) { echo ' </tr>'; // Reset the counter $counter = 0; } } // Make sure the last one is closed if ($counter != 0) { if ($modSettings['pa_columns'] - $counter > 0) { for ($i = 0; $i < $modSettings['pa_columns'] - $counter; $i++) echo ' <td class="windowbg2"> </td>'; } echo ' </tr>'; } // Close the table echo ' <tr> <td  colspan="', $modSettings['pa_columns'], '" align="right" class="windowbg2"> <label for="checkAllGroups"><input type="checkbox" id="checkAllGroups" checked="checked" onclick="invertAll(this, this.form, \'member\');" class="check" /> <i>', $txt[737], '</i></label><br /> </td> <tr> </table><br />'; // Options echo ' <table width="70%" cellpadding="5" cellspacing="0" border="0" align="center" class="tborder"> <tr class="titlebg"> <td colspan="2">', $txt['pa_select_badge'], '</td> </tr> <tr> <th class="windowbg2"> <label for="dateReceived">', $txt['pa_date'], '</label>: </th> <td class="windowbg2">'; // The date echo ' <select name="month">'; foreach ($txt['months'] as $key => $month) echo ' <option value="', $key, '" ', date('F') == $month ? 'selected="selected"' : '', '>', $month, '</option>'; echo ' </select>'; // The date echo ' <select name="day">'; for ($i = 1; $i <= 31; $i++) echo ' <option value="', $i, '" ', date('j') == $i ? 'selected="selected"' : '', '>', $i, '</option>'; echo ' </select>'; // The date echo ' <select name="year">'; for ($i = date('Y') + 5; $i >= date('Y') - 5; $i--) echo ' <option value="', $i, '" ', date('Y') == $i ? 'selected="selected"' : '', '>', $i, '</option>'; echo ' </select>'; // Close it echo ' </td> </tr> <tr> <td class="windowbg2" style="padding-bottom: 1ex;" align="right" colspan="2"> <input type="submit" value="', $txt[65], '" /> </td> </tr> </table> <input type="hidden" name="sc" value="', $context['session_id'], '" /> </form>'; }}function template_view_assigned(){ global $context, $scripturl, $txt; // Make this shorter $award = $context['assignedAward']; // Open the form echo ' <form action=', $scripturl, '?action=awards;sa=viewassigned;id=', $award['id'], '" method="post" name="unassign" id="unassign" accept-charset="', $context['character_set'], '"> <table width="70%" cellpadding="4" cellspacing="1" border="0" align="center" class="bordercolor"> <tr class="titlebg"> <td colspan="2">', $txt['pa_view_assigned'], '</td> </tr> <tr class="windowbg"> <td colspan="2" align="center"> <img src="', $award['img'], '" alt="', $award['awardName'], '" /><br /> <strong>', $award['awardName'], '</strong><br /> ', $award['gameName'], ' </td> </tr> <tr class="titlebg"> <td ', empty($context['assignedMembers']) ? 'colspan="2"' : '', '>', $txt[19], '</td>'; // Show the check call checkbox if there are members if (!empty($context['assignedMembers'])) echo ' <td> <input type="checkbox" id="checkAllGroups" onclick="invertAll(this, this.form, 'member\');" class="check" /> </td>'; echo ' </tr>'; // Check if there are assigned members if (empty($context['assignedMembers'])) { echo ' <tr class="windowbg2"> <td>', sprintf($txt['pa_no_assigned_members'], $scripturl . '?action=awards;sa=assign;id=' . $award['id'] . ';step=1'), '</td> </tr>'; } else { $alternate = true; // Loop through the members foreach($context['assignedMembers'] as $member) { echo ' <tr class="windowbg', $alternate ? '2' : '', '"> <td><label for="member[', $member['id'], ']">', $member['link'], '</label></td> <td width="3%" align="center"><input type="checkbox" name="member[', $member['id'], ']" id="member[', $member['id'], ']" value="', $member['id'], '" /></td> </tr>'; // Change alternate $alternate = !$alternate; } } // Unassign if (!empty($context['assignedMembers'])) echo ' <tr class="windowbg"> <td align="right" colspan="2"> <input type="hidden" name="sc" value="', $context['session_id'], '" /> <input type="hidden" name="id" value="', $award['id'], '" /> <input type="submit" name="unassign" value="', $txt['pa_unassign'], '" accesskey="s" /> </td> </tr>'; // Close the table echo ' </table> </form>';}function template_settings(){ global $context, $txt, $scripturl, $modSettings; // The opening form and table tags. echo ' <form action="', $scripturl, '?action=awards;sa=settings" method="post" name="badge" id="badge" accept-charset="', $context['character_set'], '" enctype="multipart/form-data" style="padding:0; margin: 0;"> <table border="0" cellspacing="0" cellpadding="4" align="center" width="70%" class="tborder"> <tr class="titlebg"> <td colspan="2">' ,$txt['pa_settings'], '</td> </tr>'; // First thing first.  The folder echo ' <tr class="windowbg2"> <td valign="top" align="right" width="50%"> <strong><label for="pa_awardsDir">', $txt['pa_badges_dir'], '</label>:</strong><br /> <span class="smalltext">', $txt['pa_badges_dir_desc'], '</span> </td> <td> <input type="text" name="pa_awardsDir" id="pa_awardsDir" value="', empty($modSettings['pa_awardsDir']) ? '' : $modSettings['pa_awardsDir'], '" size="30" /> </td> </tr>'; // Number of columns echo ' <tr class="windowbg2"> <td valign="top" align="right" width="50%"> <strong><label for="pa_columns">', $txt['pa_columns'], '</label>:</strong><br /> <span class="smalltext">', $txt['pa_columns_desc'], '</span> </td> <td> <input type="text" name="pa_columns" id="pa_columns" value="', empty($modSettings['pa_columns']) ? '' : $modSettings['pa_columns'], '" size="30" /> </td> </tr>'; // Number of rows echo ' <tr class="windowbg2"> <td valign="top" align="right" width="50%"> <strong><label for="pa_rows">', $txt['pa_rows'], '</label>:</strong><br /> <span class="smalltext">', $txt['pa_rows_desc'], '</span> </td> <td> <input type="text" name="pa_rows" id="pa_rows" value="', empty($modSettings['pa_rows']) ? '' : $modSettings['pa_rows'], '" size="30" /> </td> </tr>'; // Allow users to have more than one (1) favorite badge echo ' <tr class="windowbg2"> <td valign="top" align="right" width="50%"> <strong><label for="pa_favorite">', $txt['pa_favorite'], '</label>:</strong><br /> <span class="smalltext">', $txt['pa_favorite_desc'], '</span> </td> <td> <input type="checkbox" name="pa_favorites" id="pa_favorites" ', empty($modSettings['pa_favorites']) ? '' : 'checked="checked"', '" /> </td> </tr>'; // Submit button and a few other hidden fields echo ' <tr class="windowbg2"> <td class="windowbg2" colspan="2" align="right" valign="middle"> <input type="hidden" name="sc" value="', $context['session_id'], '" /> <input type="submit" name="save_settings" value="' ,$txt['pa_save'], '" accesskey="s" /> </td> </tr>'; // Close the table and form. echo ' </table> </form>';}?>
2:
3:

Fustrate

#785
Argh, I saved it with Mac line breaks, and it needs Windows. Just a minute.
Steven Hoffman
Former Team Member, 2009-2012

!Hachi!

YodaOfDarkness will you add links field too?to add threads links where members got his/her award?that will be more helpful.
Happy Ramadan

Fustrate

No, I don't think that will be added any time soon. An award can be given for anything, like "First 100 Members", "Arcade Champion - June 2008", "Most Helpful Member - 2007"... all of which don't necessarily need a post to link to. I might build it into a later version, but for now it's not going to be included.

Oh and I know I said that the updated 1.1.x version would be released yesterday, but I fell asleep around 5 PM because of my leg... so I'll try to get that out in the next few days.
Steven Hoffman
Former Team Member, 2009-2012

Kimmie

Quote from: YodaOfDarkness on September 06, 2008, 12:10:20 PM
Argh, I saved it with Mac line breaks, and it needs Windows. Just a minute.

That got it .. thanks    :D

tk2012

Me again... You can shoot me at any time!

Seriously though.. I got a Critical Error from other members in my Error Log, but haven't received the error myself on my name.  I accidentally deleted the most recent error, but it was the same line # and file.

Can you tell me why this is critical vs undefined?  Also, what do I have to do to correct this?

v2.0 b3.1
default theme (w/ color changes)




Fustrate

Critical is something that can halt the operation of your forum... and unknown is pretty much unknown.

Try replacing on line 1045
if($modSettings['awards_in_post'] > 0){
with
if($modSettings['awards_in_post'] > 0 && !empty($new_loaded_ids)){
Steven Hoffman
Former Team Member, 2009-2012

tk2012

thanks, will see how it goes!

Kimmie

#792
Just modified an award for the first time and got these 2 errors in my log:

8: Undefined variable: boarddir
File: /home//public_html/Sources/ManageAwards.php
Line: 356


8: Undefined variable:
File: /home//public_html/Sources/ManageAwards.php
Line: 356

Fustrate

You had an extra $ before $boarddir
Steven Hoffman
Former Team Member, 2009-2012

Kimmie

Quote from: YodaOfDarkness on September 13, 2008, 04:40:05 PM
You had an extra $ before $boarddir

k now I get this when I click on the awards link in admin CP

Parse error: syntax error, unexpected T_IF in /home//public_html/Sources/ManageAwards.php on line 1

Fustrate

stupid Mac is saving things with mac linebreaks

attached
Steven Hoffman
Former Team Member, 2009-2012

Kimmie

that got it.. once again.. thanks :)

welshdog

This might sound like a stupid question but I can't locate any awards to upload. I'm not artist so creatingthem is out of the question for me.

Is there a url where I might find a bunch I can use??

Fustrate

#798
Mother Goose made some a while back - http://www.simplemachines.org/community/index.php?topic=114701.msg1563310#msg1563310

and you can probably search the internet for "free forum awards" or something like that to find more :)
Steven Hoffman
Former Team Member, 2009-2012


Advertisement: