News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Simple Awards System

Started by Windy, November 14, 2006, 09:01:54 PM

Previous topic - Next topic

ReRobot

Quote from: Yiorgos on September 04, 2011, 06:45:02 AM
Quote from: ReRobot on September 03, 2011, 12:10:23 PM
While attempting to install, this package encountered an issue with the pre-existing "awards" table, if you wish to proceed with the installation, you will be required to remove or rename the offending "awards" table.

@ ReRobot
The attached file here, will install Simple Awards System on SMF 2.0 Gold.
In case there is an Awards table in the database from a previous installation,  will drop (eliminate) that table and procced with the new installation.
All awards given (set) to members in the past, will be lost.
It is strongly recomended to backup your database and forum files prior to any mod installation.

Parse error: syntax error, unexpected T_STRING in /home/a3982053/public_html/Packages/temp/AwardSystemdb2.php on line 99

Yiorgos

Quote from: ReRobot on September 06, 2011, 07:25:01 AM
Parse error: syntax error, unexpected T_STRING in /home/a3982053/public_html/Packages/temp/AwardSystemdb2.php on line 99

I'm sorry ReRobot
Try this file

www.sdtv.gr


Abandoned modifications that I corrected to apply on SMF 2.0 Gold
Simple Awards System  To award good members
Limit Posts Per Day  for over-posting members

ReRobot


JohnWayne999

Hello. I successfully applied Simple Awards System (SimpleAwardSystem_1_3_1.zip) to SMF version 1.1.15. Just briefly explain what I did, in case someone also using SMF 1.1.15 is having difficulty. For a start the mod website ( http://custom.simplemachines.org/mods/index.php?mod=539 ) won't even show you Manual Install Instructions if you select 1.1.15 for your SMF forum. In fact, it won't show you anything unless you select version of 1.1.4 or below (talking about SMF 1.1x here, not 2.x) even though compatability section says it supports up to 1.1.10 for people using SMF 1.1.x. So I chose 1.1.4 and pressed "Parse" button which showed me what files to modify.

I downloaded the zip file (SimpleAwardSystem_1_3_1.zip). Unzipped it and edited package-info.xml. Change the version in

<install for= 1.1.x

to <install for= 1.1.15

This would stop PackageManager from complaining on unsupported version. Save and zipped up the whole thing again.
Uploaded to Package Manager. Passed version check. Ran the simulation, which complained about one failure to "execute modification" on ./Themes/default/Display.template.php. Not to worry. Just proceed with the installation.

Next I opened up Themes/default/Display.template.php manually on the server and per instruction from Manual Install Instructions, I am suppose to look for this landmark:
// Show how many posts they have made.
echo '
', $txt[26],
and insert after it this piece of code:
if(!empty($message['member']['awards']))
{
// Show the Awards they have.
echo 'Awards:', '<br />';
foreach($message['member']['awards'] as $award)
{
echo '<img src="', $boardurl, '/awards/', $award['fileName'], '" alt="', $award['title'], '" title="', $award['title'], '"/>';
}
echo '<br />';
}


For some reason Package Manager did not do this insertion for me. Maybe there were some minor discrepancies eg. an extra space or something. Anyway, I applied the change myself no problem. There was also one other insertion that was necessary (adding ", $boardurl" to "global $context"), but the Package Manager had done it successfully for me.

Then I test run the mod. Now there's one glitch, not sure if it's introduced by this mod or something earlier I installed. But for some reason, a lot of the forward slashes in my Themes/default/Display.template.php are appearing as the Japanese yen sign. Now I installed a dozen mods same night, so I can't be sure which of the mods pulled this nasty joke on me. Possibly one of the foreign mods as some languages do use yen symbol for slash. The result is you won't be able to read any post from anyone. Anyway I just used Notepad++ and replaced all instances of yen (untick "Whole word match") back to /

Things worked fine from there.

Thanks for this neat nice little mod. I haven't looked into it in detail but I guess two suggestions for improvement would be: (1) please allow use of higher resolution awards. Currently it only takes 16x16 which is really quite crude and (2) introduce some sort of calculation system that will automatically award an award for example when the person posted >100 posts, and then a second award when posted >500 posts or based on respect, karma or whatever, would be fun.

Enjoy!

m4ng0

JohnWayne999 thank you in first line.

Im searching for an award system and I was really woundering how to fix the Simple Awards System for the smf version 1.1.15 well I have very low level of coding experience and I was a bit afraid... well after a while my decision was to take the risk to try... I did the same as you explain and download the package SimpleAwardSystem_1_3_1.zip but after openin the xml. file in the notpad  I must say I was not able to find the string;
<install for= 1.1.x

This is how it looks;
<?xml version="1.0"?>
<!DOCTYPE package-info SYSTEM "http://www.simplemachines.org/xml/package-info">
<package-info xmlns="http://www.simplemachines.org/xml/package-info" xmlns:smf="http://www.simplemachines.org/">
   <!-- For the id, always use something unique - put your name, a colon, and then the package name. -->
   <id>WWakerFAN:SimpleAwardSystem</id>
   <!-- Below should be the name of this package. -->
   <name>Simple Award System</name>
   <!-- The version of this modification.  Keep it numeric so PHP can tell that old < new. -->
   <version>1.3.1</version>

   <!-- Type, one of: modification, avatar, language. -->
   <type>modification</type>

   <!-- Installation, the key part of this file. -->
   <install for="1.1.2">
      <readme type="file">readme.txt</readme>
      <code type="file">AwardSystemdb.php</code>
      <modification type="file" format="xml">modification.xml</modification>
   </install>
   
   <install for="1.1.3">
      <readme type="file">readme.txt</readme>
      <code type="file">AwardSystemdb.php</code>
      <modification type="file" format="xml">modification.xml</modification>
   </install>
   
   <install for="1.1.4">
      <readme type="file">readme.txt</readme>
      <code type="file">AwardSystemdb.php</code>
      <modification type="file" format="xml">modification.xml</modification>
   </install>
   
   <uninstall for="1.1.2">
      <modification type="file" format="xml" reverse="true">modification.xml</modification>
   </uninstall>
   
   <uninstall for="1.1.3">
      <modification type="file" format="xml" reverse="true">modification.xml</modification>
   </uninstall>
   
   <uninstall for="1.1.4">
      <modification type="file" format="xml" reverse="true">modification.xml</modification>
   </uninstall>
</package-info>

Can you lead me the way and help me out?

Let me thank you in advance. And I must say Im very very afraid of the japaniese Yen sign... If I get lost the messages... it will be hit me very hard...

Yiorgos

#425
Edit package-info.xml.
   Find <uninstall for="1.1.2">

   Add before that
   <install for="1.1.15">
      <readme type="file">readme.txt</readme>
      <code type="file">AwardSystemdb.php</code>
      <modification type="file" format="xml">modification.xml</modification>
   </install>

   
   Find </package-info>

   Add before that
   <uninstall for="1.1.15">
      <modification type="file" format="xml" reverse="true">modification.xml</modification>
   </uninstall>



Follow the rest of the instructions provided by JohnWayne999 (above)

@ JohnWayne999
You may redistribute the package you made for SMF 1.1.15

www.sdtv.gr


Abandoned modifications that I corrected to apply on SMF 2.0 Gold
Simple Awards System  To award good members
Limit Posts Per Day  for over-posting members

m4ng0

Thank you for your fast response.

Shell I delete the "<uninstall for="1.1.2">" string or just add your given strings before this ?!

Yiorgos

NO delete.

Just Add before the string that you search for.


www.sdtv.gr


Abandoned modifications that I corrected to apply on SMF 2.0 Gold
Simple Awards System  To award good members
Limit Posts Per Day  for over-posting members

m4ng0

Ok I got it, thank you. I will let you know how it ends.

m4ng0

Okay editing is done but know I got a funny response like;

Unknown column 'memberName' in 'smf_awards'
Dosya: /home/content/m/o/b/mobilumsadmin/html/purosever/Packages/temp/AwardSystemdb.php
Satır: 69

Note: You need to upgrade your database. Your files are currently at version SMF 1.1.15, but the database is at version 1.1.13. Upgrade.php 't run is recommended.

I guess after this, I will have more issues because Im running an turkish page... it will be langues issues for most.. Im just guessing.

m4ng0

Well I give it a try and I got the following response;

The upgrader found some old or outdated files.

Please make certain you uploaded the new versions of all the files included in the package.

Click here to try again.

Yiorgos

#431
 m4ng0 
Just make sure that you keep Back Ups from data base and files.

Take BackUp from the Database and the files.

Then TRY to Upgrade to SMF 2.0.1

Take your time. Do not harry. Read, ask and then Upgrade.

I am pretty sure that you will finally Upgrade to SMF 2.0.1

Turkish should not be a problem.
You will get help from the Turkish SMF section
Keep on

www.sdtv.gr


Abandoned modifications that I corrected to apply on SMF 2.0 Gold
Simple Awards System  To award good members
Limit Posts Per Day  for over-posting members

m4ng0

Thank you for your help and support. Im not sure but I guess I will leave it this way because I cant risk the data and the population. Thanks one more time.

JohnWayne999

#433
Hi m4ngo: Sorry I was lazy. The .x refers to whatever your version is. Follow as Yiorgos explained.  But I tell you what, I've made a new mod you might like (Auto Award). Basically it awards medals to users based on how many posts they've made. Please find attached snap shots. Good news is it runs on both SMF 2.0.1 and SMF 1.1.15. I haven't tested on 1.1.12 or the version you are using but I'm willing to bet 2c it will run no prob. I am waiting for SMF moderator to approve. If you want to try it first, you can get it here:

http://www.gpland.org/index.php?topic=22.0

or

http://www.simplemachines.org/community/index.php?topic=456221.0

I am not sure how to overcome your database mistach issue. Have to say though, I did come across that same error previously. I had enough of SMF 1 at that stage and moved onto SMF 2.0.1, so didn't really know what happened there. But like Yiorgos suggested make backups. It's so easy to just backup whatever you have. For example I back up after every 2 or 3 mods I install. That way if any problem I can always roll back within seconds. Usually rather than trying to 'fix' a mod that doesn't work, I just roll back and forget that mod altogether. You can spend too much time trying to fix a broken mod, better off just find (or wait for) another one that works.

Please find attached the Simple Award package I forced to execute on SMF 1.1.15. Note you will need to have SMF 1.1.15 running because this package won't accept any other versions. The other award system you might want to try is Member Awards by Spuds, which supports awards of higher resolution. From memory I think Simple Award only takes 16x16.

m4ng0

JohnWayne999 XXL Respect; and thank you for your kind response. Im such a noob so I got my backups but Im very afraid that ı cant restore the forum back.. But I also need deathly the mod. I guess I will give it a try..

Do you think the previous changes will effect your mod installation?

m4ng0

While attempting to install, this package encountered an issue with the pre-existing "awards" table, if you wish to proceed with the installation, you will be required to remove or rename the offending "awards" table.

JohnWayne999

Hi m4ngo

Beats me. I don't know what the table issue is about. Sounds like some sort of table screw up in MySQL but I can't think of any reason why a simple award system would want to access MySQL. Bottom line is sorry can't you on this one. I previously had an inconsistent table myself, tried to correct it but never actually quite succeeded. Ended up just restoring to the last save point / backup point.

LOPar

Please, please upgrade this mod to the latest SMF version.

fullmoonya

#438
this is an update. i know now how to install this mod in smf 2.0.2.

first, emulate it to smf 2.0 RC5

then, install it in your package manager.
you will see an error on installing the package but just continue the installation. it doesn't matter.

then, after you install the package, put this code on Souces/Display.php

find:
$memberContext[$message['id_member']]['can_see_warning'] = !isset($context['disabled_fields']['warning_status']) && $memberContext[$message['id_member']]['warning_status'] && ($context['user']['can_mod'] || (!$user_info['is_guest'] && !empty($modSettings['warning_show']) && ($modSettings['warning_show'] > 1 || $message['id_member'] == $user_info['id'])));
}


add before:
//asd simple award mod
               
if(!empty($modSettings['award_show_display']) && !empty($memberContext[$message['id_member']]['awards']) && empty($memberContext[$message['id_member']]['custom_fields']['awards']))
{
$award_str = '';
$award_limit = 0;

foreach($memberContext[$message['id_member']]['awards'] as $award)
{
$award_str .= '<img alt="' . stripslashes($award['title']) . '" src="' . $boardurl . '/awards/' . stripslashes($award['fileName']) . '" title="' . stripslashes($award['title']) . '" />';

$award_limit++;

if(!empty($modSettings['award_limit']) && $award_limit == $modSettings['award_limit'])
{
if($award != end($memberContext[$message['id_member']]['awards']))
$award_str .= '<a href="' . $scripturl . '?action=profile;area=awards;u=' . $message['id_member'] . '">...</a>';
break;
}
}

$memberContext[$message['id_member']]['custom_fields']['awards'] = array(
'title' => 'Awards',
'value' => '<span class="awards">' . $award_str . '</span>',
'placement' => false,
);
}
//dsa


i hope i help others that will use this mod. :)
do not mark my topic solve unless it is REALLY SOLVED.
my forum

Visit My Blog:
Google SEO Share

LOPar

Another question - what do I have to modify to remove that annoying phrase "Awards:" under the avatar? I want clear look - when only images are shown.

I tried to play with

$memberContext[$message['id_member']]['custom_fields']['awards'] = array(
'title' => 'Awards',
'value' => '<span class="awards">' . $award_str . '</span>',
'placement' => false,
);


but if i remove 'title' => 'Awards', the word is gone, but the colon not dissapear.
is there any methods to show only images?

thanx.

Advertisement: