Buy me a Beer

Started by _Anthony_, June 06, 2008, 09:30:44 PM

Previous topic - Next topic

_Anthony_

Link to Mod


BUY ME A BEER v1.4
By Karl Benson/ MrBabbelen


Compatibility
For SMF 1.1.x versions only

Introduction
Allows users to reward other users for their posts by buying them a beer (or at least donating enough money via Paypal to buy one).

Where the user has entered their paypal address, A 'beer glass' icon appear in the poster information area of users posts.  The alt text when hovering over the icon states 'Buy Me A Beer Through Paypal' [must be logged in to see] and when clicked takes the user to the paypal page.

Features
o Adds a paypal donation field to each users profile
o Adds a clickable beer icon to take user to donation page.
o Supports Languages
- English/English-utf8
- English_British/English_British-utf8
I welcome translations for other languages. Please post the translated language strings in the Support Topic.

Installation
Simply install the package to install on the SMF Default Core Theme ONLY.
All other themes will require manual edits for Profile.template.php and Display.template.php
AND you will need to place a copy of the image buymeabeer.gif in the image folder of each of your themes (Themes/{themename}/images/)

Open Themes/{themename}/Profile.template.php, and FIND:

// All the messenger type contact info.

ADD BEFORE:

// Paypal Address For 'Buy Me A Beer Mod
echo ' <tr>
<td width="40%"><b>', $txt['buymeabeer'], ': </b><div class="smalltext">', $txt['buymeabeer_desc'], '</div></td>
<td><input type="text" name="buymeabeer" size="24" value="', $context['member']['buymeabeer']['name'], '" /></td>
</tr><tr>
<td colspan="2"><hr width="100%" size="1" class="hrcolor" /></td>
</tr>
';


Open Themes/{themename}/Display.template.php, and FIND:

// Show online and offline buttons?
if (!empty($modSettings['onlineEnable']) && !$message['member']['is_guest'])

ADD BEFORE:

// SHOW BUY ME A BEER
if (!$message['member']['is_guest'] && $context['user']['is_logged'] && !empty($message['member']['buymeabeer']))
{
$priceofbeer = 5 ; // In US Dollars no cents
echo'<br/>
<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=' , htmlentities ($message['member']['buymeabeer'], ENT_NOQUOTES, "UTF-8") , '&item_name=' , htmlentities ($txt['pleasebuymeabeer'], ENT_NOQUOTES, "UTF-8") , '&amount=', $priceofbeer ,'%2e00&no_shipping=0&no_note=1&tax=0&currency_code=USD&lc=US&bn=PP%2dDonationsBF&charset=UTF%2d8" rel="nofollow" title="', $txt['buymeabeeralt'] ,'"><img alt="', $txt['buymeabeeralt'] ,'" border="0" src="', $settings['images_url'] , '/buymeabeer.gif" border="0"/></a><br/>';
}


If your theme has its own versions of the language files Modifications.english.php and/or Modifications.english-utf8.php, OR if your using a language other than those supported (listed above) by the mod then you will need to copy the language strings into each custom version of those files.
$txt['pleasebuymeabeer'] = 'Buy Me A Beer';
$txt['buymeabeeralt'] = 'Buy Me A Beer Through Paypal';
$txt['buymeabeer'] = 'PayPal Address For Users To Buy You A Beer';
$txt['profile_error_bad_paypal'] = 'The PayPal Address you entered was not a valid email address';
$txt['profile_error_paypal_taken'] = 'The PayPal Address you entered is already in use by another member';
$txt['buymeabeer_desc'] = 'Allows users to reward you for your posts';


Useful Links
SMF Package Parser
Manual Installation Of Mods
How Do I Modify Files?

Customization
$5 for a beer?  Seems reasonable, but if you want to change it you can do so easily by editing the Display.template.php and FIND the line below and REPLACE the 5 with another digit (must be a whole number, no decimals).
$priceofbeer = 5 ; // In US Dollars no cents

Donate
Has this modification helped you? Support the developer by Donating

Support
Please use the modification thread for support with this modification.
(Please don't ask me to do the edits for you)

Changelog
v1.0
o Initial release made per SMF user request.
v1.1
o Ensured it removes the buymeabeer.gif image on uninstall (as per SMF Modification Guidelines)
o Wrote out the manual edits
o Improved the readme/documentation for this mod
v1.2
o Fixed install bug where had previous install
v1.3
o Fixed install bug, not installing column
o Added english-utf8 support.
v1.4 - 25th December
o Added english_british/english_british-utf8 support.

Apllicmz

Update portuguese and brazlian utf8

<file name="$languagedir/Modifications.portuguese.php" error="skip">
<operation>
<search position="end" />
<add><![CDATA[
$txt['pleasebuymeabeer'] = 'Compre-me uma cerveja';
$txt['buymeabeeralt'] = 'Compre-me uma cerveja através do Paypal';
$txt['buymeabeer'] = 'PayPal o endereço para os membros comprarem-lhe uma cerveja';
$txt['profile_error_bad_paypal'] = 'O PayPal endereço que você digitou não foi um endereço de email válido';
$txt['profile_error_paypal_taken'] = 'O PayPal endereço que você digitou já está em uso por outro membro';
$txt['buymeabeer_desc'] = 'Permite que os membro lhe recompensa nos postes';
]]></add>
</operation>
</file>
<file name="$languagedir/Modifications.brazilian.php" error="skip">
<operation>
<search position="end" />
<add><![CDATA[
$txt['pleasebuymeabeer'] = 'Compre-me uma cerveja';
$txt['buymeabeeralt'] = 'Compre-me uma cerveja através do Paypal';
$txt['buymeabeer'] = 'PayPal o endereço para os membros comprarem-lhe uma cerveja';
$txt['profile_error_bad_paypal'] = 'O PayPal endereço que você digitou não foi um endereço de email válido';
$txt['profile_error_paypal_taken'] = 'O PayPal endereço que você digitou já está em uso por outro membro';
$txt['buymeabeer_desc'] = 'Permite que os membro lhe recompensa nos postes';
]]></add>
</operation>
</file>


<file name="$languagedir/Modifications.portuguese-utf8.php" error="skip">
<operation>
<search position="end" />
<add><![CDATA[
$txt['pleasebuymeabeer'] = 'Compre-me uma cerveja';
$txt['buymeabeeralt'] = 'Compre-me uma cerveja atrav&eacute;s do Paypal';
$txt['buymeabeer'] = 'PayPal o endere&ccedil;o para os membros comprarem-lhe uma cerveja';
$txt['profile_error_bad_paypal'] = 'O PayPal endere&ccedil;o que voc&ecirc; digitou n&atilde;o foi um endere&ccedil;o de email v&aacute;lido';
$txt['profile_error_paypal_taken'] = 'O PayPal endere&ccedil;o que voc&ecirc; digitou j&aacute; est&aacute; em uso por outro membro';
$txt['buymeabeer_desc'] = 'Permite que os membro lhe recompensa nos postes';
]]></add>
</operation>
</file>
<file name="$languagedir/Modifications.brazilian-utf8.php" error="skip">
<operation>
<search position="end" />
<add><![CDATA[
$txt['pleasebuymeabeer'] = 'Compre-me uma cerveja';
$txt['buymeabeeralt'] = 'Compre-me uma cerveja atrav&eacute;s do Paypal';
$txt['buymeabeer'] = 'PayPal o endere&ccedil;o para os membros comprarem-lhe uma cerveja';
$txt['profile_error_bad_paypal'] = 'O PayPal endere&ccedil;o que voc&ecirc; digitou n&atilde;o foi um endere&ccedil;o de email v&aacute;lido';
$txt['profile_error_paypal_taken'] = 'O PayPal endere&ccedil;o que voc&ecirc; digitou j&aacute; est&aacute; em uso por outro membro';
$txt['buymeabeer_desc'] = 'Permite que os membro lhe recompensa nos postes';
]]></add>
</operation>
</file>



_Anthony_

Ok, i will add those in a little while.

_Anthony_


KiLLuMiNaTi-7-


_Anthony_

Yes, it was on like the 6th page

KiLLuMiNaTi-7-

You had only just posted the day before you bumped lol. I've got no problem with it though.

_Anthony_

I know, but some how it got down there :o

damnitmike

I just had an idea...so I'll run it by ya....

Make the beer icon an animation....so that it animates a beer glass, dollar sign, a gift box, etc......

Sure its Buy Me A Beer.....but this would make it that and alot more......


_Anthony_

Cool i will start working on that good idea.

chadon

 Is there any plan to release a version for SMF 2.0?
It looks like a simple mod. Is there a way to do a manual install until a new version comes out with something like the custom profile function?
It might be a stupid question but at least it bumped the topic  :P

_Anthony_

Quote from: chadon on June 22, 2008, 11:48:10 AM
Is there any plan to release a version for SMF 2.0?
It looks like a simple mod. Is there a way to do a manual install until a new version comes out with something like the custom profile function?
It might be a stupid question but at least it bumped the topic  :P
I might, i haven't had much time, to do anything.

Jed C

i would like this mod but without the paypal section
you could just accumulate beer glass icons
once you reach 10 glass's it changes to one glass again but a different colour
you get ten of that colour and it changes again and so on
until you get ten glass's of amber nectar
you then have to trade them in for a virtual night on the p**s with the lads/girls which you obviously get a coloured icon for LOL

badbo

I get this error each time I try to install.

BLOB/TEXT column 'buymeabeer' can't have a default value
File: C:\smf\Packages\temp\install.php
Line: 18
I have tried several times  should I just install it the manual way?

Bo

damnitmike

#14
I asked those helpful folks at SMF Helper if someone could make an animation for me to use with this mod. I also gave the current buymeabeer GIF's size with the request, so that the new animation could be easily uploaded to overwrite the old one.

And Mother Goose was more than happy  to do this. And did a great job, I might add! She does some really nice work, if you didn't know, and as I had found out.

I uploaded it to my site, and I must say, it really looks great, and stands out nicely from everything else, as it animates through the beer glass, dollar sign, gift box, and hamburger....

Mother Goose  put no restrictions on it. But I think it would be nice if you gave her some credit in the mod somewhere, if you use it. ;D

It is a  nice little detail, showing some of the many ways you can use this mod to 'pay back' a friend on the forum. I think it shows the added dimension for which this mod can be used.

And will spruce up that SMF 2.0 version nicely.....


For anyone who wants to use it, you will have to rename the gif. I left it as is on purpose.  ;D

perpetuallove

I thought this was the mod i was looking for, but it seems it gives the person who you are buying the beer the $$ right? I am wanting something just like this, but that the $ would go to my account (admin) as if it was a donation to the site. So if they click the beer icon or whatever- it goes to the sites donation fund instead of the person they are buying the beer for's paypal. Does that make sense?

Is it possible to do that with this mod? or is there another mod I could use for that?

daveand5

Very good mod, very useful
Any one with problems in profile showing only : instead of the Normal Text
make sure you add the text to your language file
I use english and had to add it to englishutf8, not sure why, but that fixed it.
so if you have 2 files one ending with utf8, add the text to it.

jayman2

Quote from: daveand5 on March 07, 2009, 09:31:01 AM
Very good mod, very useful
Any one with problems in profile showing only : instead of the Normal Text
make sure you add the text to your language file
I use english and had to add it to englishutf8, not sure why, but that fixed it.
so if you have 2 files one ending with utf8, add the text to it.
What version of smf are you running?  I've been trying to modify it into 2.0 rc1, but I know very little about php programming.  I have seen one site running 2.0 rc1 and they have "buy me a beer" running.

Advertisement: