Go Back   vb.org Archive > vBulletin Modifications > vBulletin 3.8 Modifications > vBulletin 3.8 Template Modifications

Reply
 
Thread Tools
UKBL ~ "Buy Me a Beer" Hack Details »»
UKBL ~ "Buy Me a Beer" Hack
Version: 1.00, by UKBusinessLive UKBusinessLive is offline
Developer Last Online: Feb 2012 Show Printable Version Email this Page

Category: End-User Options - Version: 3.8.1 Rating:
Released: 02-11-2009 Last Update: 02-13-2009 Installs: 36
Template Edits
Re-useable Code Translations  
No support by the author.

UKBL ~ "Buy Me a Beer" Hack v1.5



You may of seen this on other Forums But Now, The Buy Me a Beer Hack comes to VBulletin Display a Drinks Icon on your Postbit and watch those beers come rolling in, Don't forget to Buy me a Beer
Now even Easier to Install




View the demo above for step by step demo on how to set up a Buy me a Beer on your forums as well as Buy me a Drink - Multichoice

All we need to do is a simple Custom User Field to allow members to add their paypal address, Thats It.

In this Updated version i've set the beer Price to ?3 you can off course change this and convert the currency to UD Dollars, its a lot easier believe me.
So to Start



Here is a walkthrough on what to do.

Download the beer.zip file and upload the four images to your forums /images/misc directory or even a hosting service like photobucket.


Next we need to create a Custom User Field in the members CP so, Log onto your Admin CP and go to "User Profile Fields"

Click on Add New User Profile field, and chose "Single Line Text Box"

Then copy the Following


Title = Buy Me A Beer

Description = Add your Paypal Email Address so members can buy you a Beer!

Max length of allowed user input = 50

Field Length = 50

Display Order = 10

Field Required = No

Field Editable by User = Yes

Private Field = No

Field Searchable on Members List = Yes

Display Page = Edit your Details

Thats It when your done click save

Then you'll see a list of custom fields and your new one should be right at the bottom, Make a note of the field number, For example we'll use field8



Copy and Paste the code from the zip file into notepad

PHP Code:
<if condition="$post['[COLOR="Red"]fieldX[/COLOR]']">
<
a href="https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=$post[[COLOR="red"]fieldX[/COLOR]]&item_name=Buy me a Beer&amount=3%2e00&no_shipping=0&no_note=1&tax=0&currency_code=GBP&lc=GB&bn=PP%2dDonationsBF&charset=UTF%2d8" target="_blank" rel="nofollow" title="Click to buy me a Beer">
<
img alt="Buy me a Beer?" border="0" src="http://www.yourforum.com/images/misc/beer.png" border="0"/>
</if> 


You need to edit the following

Remember to change the X in FieldX to the Field Number from your Custom Field shown in RED

In the code look for

PHP Code:
Beer&amount=

This is the value of your beer, Look for

PHP Code:
currency_code=GBP 
This is the currancy country code and GB is the Country , so for Dollars you'd need to change these values to USD and US

its pretty easy really,

and finally change the url of the pictures you uploaded earlier to your forums /images/misc folder or even an image hosting company.

Thats all there is to the code edits, Now we need to go back to our Admin CP, Go to the template you are using in Styles & Templates/Style Manager, and select Edit templates.

Go to "postbit templates" and select the template you are using, either postbit or postbit_legacy.


Find the following

PHP Code:
$template_hook[postbit_userinfo_right]
                <
div>$post[icqicon$post[aimicon$post[msnicon$post[yahooicon$post[skypeicon] </div>
            </
div
directly below it add your saved code

PHP Code:
 <!-- /By me a Beer start-->
<if 
condition="$post['fieldX']">
<
a href="https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=$post[fieldX]&item_name=Buy me a Beer&amount=3%2e00&no_shipping=0&no_note=1&tax=0&currency_code=GBP&lc=GB&bn=PP%2dDonationsBF&charset=UTF%2d8" target="_blank" rel="nofollow" title="Click to buy me a Beer">
<
img alt="Buy me a Beer?" border="0" src="http://www.yourforum.com/images/misc/beer.png" border="0"/>
</if><!-- /
By me a Beer End--> 
Then all your members need to do is to add their Paypal address in their UserCP and automatically their drinks icon will show up in their postbit, If they no longer want to accept Drinks, all they need to do is to delete their Paypal Address from their User CP

So when they click on your Drinks icon they'll be taken to your Paypal's donation Page



Easy

Hope you enjoy this, Please don't forget to click install if you use





UPDATE 13.02.09

Several Members have expressed concerns with the fact that when you hover with your cursor over the drinks icon the members paypal add is displayed in the Status Bar.

Concerns were made about email harvesters and spammers, and as a responsible Developer Please Find below a security patch which you will need to add at the bottom of the Postbit template that your using, Just copy and paste, right at the bottom.


PHP Code:
<script>

function 
hidestatus(){
window.status=''
return true
}

if (
document.layers)
document.captureEvents(Event.MOUSEOVER Event.MOUSEOUT)

document.onmouseover=hidestatus
document
.onmouseout=hidestatus
</script


This will disable the Staus bar and prevent anyone viewing details, however once the Beer icon has been clicked and the page reverts to the paypal payment page, then the link will be shown.

Also Don't forget to add a template conditional around your uploaded code

PHP Code:
<if condition="is_member_of($bbuserinfo, X, X, X)">
[
COLOR="Navy"][B]The Code goes here !![/B][/COLOR]
</if> 

With the X the numbers of your usergroup, This will prevent guests, and no registered members from viewing this hack

Please continue reporting any bugs and we'll fix them accordindly



A Second Version with Multiple choices is now available in the Multichoice.zip

REMEMBER YOU'LL NEED TO ADD THIS IN ADDITION TO THE BUY ME A BEER HACK.

You can Now add a wide variety of Drinks, Food or anything you want to the list and this will be shown inyour posbit and will still allow others to Buy for you via paypal, The Code is basically the same but we will need to add a few extra's, To get the multichoice hack to work we need to have the "Buy Me a Beer Hack" Installed, so if you havn't done that then please do so before going to Multichoice, OK so lets start...

1. Download the Multichoice.zip to your desktop and copy the multichoice.txt file to your text editor, like Notepad

2.Next we need to create a Custom User Field in the members CP so, Log onto your Admin CP and go to "User Profile Fields"

Click on Add New User Profile field, and chose "Single Selection drop down menu "

Then copy the Following


Title = Buy Me A Drink

Options Add the Different varity of drinks here ( One on each line, Remember you need to keep the name of the drinks the same as the drinks Picture format, so if you have Beer, Then you should have beer.png as the graphic file. )

Display Order = 15

Field Required = No

Field Editable by User = Yes

Private Field = No

Field Searchable on Members List = Yes

Display Page = Edit your Details

Thats It when your done click save





Remember you need to add this second custom user field in addition to the first one, make a note of the user Field Number Its like this Field9

Next Make sure that the graphic files are named the same as the Drinks in the Multichoice box, So if you have Wine as one of your choices, you need to make sure the Graphic is called Wine.png

In your forums Image directory you need to make a new directory called "Drinks" and upload all your drinks graphic files to your newly created directory, should be something like this..

YourForum.com/images/drinks

Finally we need to edit the code we have already uploaded into the postbit template,

So grab that code


PHP Code:
<!--buy me a beer -->
<
center>
<if 
condition="is_member_of($bbuserinfo, x, x, x, x)">
<if 
condition="$post['field8']"><div class="info">
<
a href="https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=$post[field8]&item_name=Buy me a Beer&amount=3%2e00&no_shipping=0&no_note=1&tax=0&currency_code=GBP&lc=GB&bn=PP%2dDonationsBF&charset=UTF%2d8" target="_blank" rel="nofollow" title="Click to buy me a Beer">
Buy Me a Drink</a></if><if condition="$post['field9']"><img alt="Buy me a Beer?" border="0" src="http://www.yourforum.com/images/drinks/$post[field9].png" border="0"/></div></if></center>
</if>
<!--
end buy me a beer --> 
Now look carefully at the code

PHP Code:
<if condition="is_member_of($bbuserinfo, [COLOR="Red"]x, x, x, x[/COLOR])"

The red X's are to be replace withthe usergroup ID's of the usergroups you want to view

PHP Code:
<if condition="$post['field8']">
<
a href="https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=$post[field8] 
This remains the same as this is our user dedined field which we did earleier which allows the insertion of the Paypal Email addy. That was field8 in our example.

Now look at the next bit

PHP Code:
<img alt="Buy me a Drink?" border="0" src="http://www.yourforum.com/images/drinks/$post[fieldx9].png" border="0"/> 
Have you noticed i've changed the "Buy me a Beer" to "Buy me a Drink" and inplace of the name of our graphic file i've added another post field attribute $post[fieldx9] Which is the custom user field for the dropdown multichoice this will insert whatever the member choses to show in their postbit.

VERY IMPORTANT.

As the Name only of the Graphic file is chosen by the user, you need to ensure that your graphic formats remain the same, either all .jpg, png, or gif, No mixing of formats allowed.

Hope you enjoy the new addition

Many thanks to My Friend Steve (TimberFloorAu) from http://www.yobromofo.com/forum/ for the update on the code, and for getting my ideas working

Download Now

File Type: zip beer.zip (211.7 KB, 136 views)
File Type: zip multichoice.zip (29.4 KB, 94 views)

Screenshots

File Type: png beer -b.png (124.1 KB, 0 views)
File Type: png beer-a.png (33.1 KB, 0 views)
File Type: png paypal.png (48.0 KB, 0 views)
File Type: png multi.png (30.6 KB, 0 views)

Supporters / CoAuthors

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #52  
Old 02-13-2009, 05:07 PM
UKBusinessLive UKBusinessLive is offline
 
Join Date: Sep 2008
Location: Essex, United Kingdom
Posts: 1,637
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by ArnyVee View Post
Can we have it work so that the person is paying the forum for the purchase? Sort of like how Facebook gets the cash on a 'buy me a gift' deal?
I'll write up a new code for you Arny I'll do it after i post another update

To stop the status bar from showing the members details when you hover over the icon.

Bear with me mate
Reply With Quote
  #53  
Old 02-13-2009, 05:15 PM
ArnyVee's Avatar
ArnyVee ArnyVee is offline
 
Join Date: Mar 2008
Posts: 944
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That's great Gerry! Thank you! :up:

Great job on getting some very useful mods out! These are the type of mods that increase interactivity on our forums (which is absolutely vital! ) and create a more cohesive community!
Reply With Quote
  #54  
Old 02-13-2009, 05:21 PM
UKBusinessLive UKBusinessLive is offline
 
Join Date: Sep 2008
Location: Essex, United Kingdom
Posts: 1,637
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by scottct1 View Post
Ok I got the bright idea to make the icon show on the postbit but when you click on it have it take you to the user profile.

I wanted to put the code for the button in the profile so this way the bots can't harvest users email addresses since user profiles are blocked from bots in the .htaccess file.

However when I put the code in the user profile the fields are not being pulled. I can't figure out why its not parsing the fields in the user profile. But as an example the working code in the postbit for the picture is http://www.yourforum.com/images/drinks/beer.png however when the page is being displayed its not parsing and coming up with http://www.yourforum.com/images/drinks/.png
Scott

I have made a security patch which will disable the status bar. Several Members have expressed concerns with the fact that when you hover with your cursor over the drinks icon the members paypal add is displayed in the Status Bar.

Concerns were made about email harvesters and spammers, and as a responsible Developer Please Find below a security patch which you will need to add at the bottom of the Postbit template that your using, Just copy and paste, right at the bottom.

Code:
<script>

function hidestatus(){
window.status=''
return true
}

if (document.layers)
document.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT)

document.onmouseover=hidestatus
document.onmouseout=hidestatus
</script>
This will disable the Staus bar and prevent anyone viewing details, however once the Beer icon has been clicked and the page reverts to the paypal payment page, then the link will be shown.

Please continue reporting any bugs and we'll fix them accordindly

Thanks buddy

Gerry
Reply With Quote
  #55  
Old 02-13-2009, 05:31 PM
UKBusinessLive UKBusinessLive is offline
 
Join Date: Sep 2008
Location: Essex, United Kingdom
Posts: 1,637
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by ArnyVee View Post
That's great Gerry! Thank you! :up:

Great job on getting some very useful mods out! These are the type of mods that increase interactivity on our forums (which is absolutely vital! ) and create a more cohesive community!

No Worries Mate,

Glad to help where i can, But could do with a rest after this one

Arny, I take it you have a Forum paypal account already??? Then what you'll have to do is if you don't want members to buy beers for each other but just pay the forum then you need to delete the part about custom user fields and simply add your paypal address in the code as opposed to the field attribute

Works along the lines of something like this...

Code:
<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=admin@mickeymouse.com&item_name=Buy me a Beer&amount=3%2e00&no_shipping=0&no_note=1&tax=0&currency_code=GBP&lc=GB&bn=PP%2dDonationsBF&charset=UTF%2d8" target="_blank" rel="nofollow" title="Click to buy me a Beer">
<img alt="Buy me a Beer?" border="0" src="http://www.yourforum.com/images/misc/beer.png" border="0"/>
</if>
You can see where you need to add your email addy, its in red

Then you can change the other bits, Buy me a Beer to Buy us a Gift or something along those lines, Don't forget to change the graphic

Hope that helps

Gerry

PS a little something for you for St Patricks Day

Reply With Quote
  #56  
Old 02-13-2009, 05:41 PM
R-D's Avatar
R-D R-D is offline
 
Join Date: Jan 2008
Posts: 158
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Just to let you know, that won't stop harvesters and/or spammers in the slightest.

It'll hide the status bar link for users with javascript enabled, it won't however remove the link from the page's source code or hide the status bar link for anyone with javascript disabled.

At best, it'll just stop most regular (human) members from seeing the status bar link. The majority (if not all) automated spammers and harvesters will still be able to get the link with no problems at all.

Your best bet would be to use a template condition to hide the entire modification (and the actual link itself) from guests. That's probably the only reliable way to hide the link(s) from spammers and harvesters.
Reply With Quote
  #57  
Old 02-13-2009, 05:43 PM
UKBusinessLive UKBusinessLive is offline
 
Join Date: Sep 2008
Location: Essex, United Kingdom
Posts: 1,637
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by R-D View Post
Just to let you know, that won't stop harvesters and/or spammers in the slightest.

It'll hide the status bar link for users with javascript enabled, it won't however remove the link from the page's source code or hide the status bar link for anyone with javascript disabled.

At best, it'll just stop most regular (human) members from seeing the status bar link. The majority (if not all) automated spammers and harvesters will still be able to get the link with no problems at all.

Your best bet would be to use a template condition to hide the entire modification (and the actual link itself) from guests. That's probably the only reliable way to hide the link(s) from spammers and harvesters.
Thanks for the tip, I'm onto that now Just added the template condition to the first post, so now you have to be logged in and a member to even be able to view the buy me a beer hack, Funny enough i'd already thought of this in an earlier post, but i forgot to add it to the first post

Thanks again for reminding me
Reply With Quote
  #58  
Old 02-13-2009, 06:57 PM
UKBusinessLive UKBusinessLive is offline
 
Join Date: Sep 2008
Location: Essex, United Kingdom
Posts: 1,637
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by scottct1 View Post
I love it but may have to remove it as my users don't like having their email address displayed in the status bar of the browser.

If we can figure out a solution to this, this could be MOTM.
Don't forget to add the template conditional on the first post, That way only members and staff will be able to view the hack, together with the code to disable the staus bar, That should prevent any sercurity issues, with non members and guests.

Let me know if i can help further
Reply With Quote
  #59  
Old 02-13-2009, 07:18 PM
TandyServices's Avatar
TandyServices TandyServices is offline
 
Join Date: Aug 2008
Location: All over the USA
Posts: 216
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I can not get the new images to show?? here is what I have and my field is 32 and only .png..
Code:
<img alt="Buy me a Drink?" border="0" src="/images/misc/donate/$post[field32].png" border="0"/>
Reply With Quote
  #60  
Old 02-13-2009, 07:54 PM
UKBusinessLive UKBusinessLive is offline
 
Join Date: Sep 2008
Location: Essex, United Kingdom
Posts: 1,637
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by TandyServices View Post
I can not get the new images to show?? here is what I have and my field is 32 and only .png..
Code:
<img alt="Buy me a Drink?" border="0" src="http://www.yourforum.com/images/misc/donate/$post[field32].png" border="0"/>
Try adding the full URL to the graphics http://www.yourforum.com/images/misc/donate/$post[field32].png

let me know how you got on James
Reply With Quote
  #61  
Old 02-13-2009, 07:58 PM
TandyServices's Avatar
TandyServices TandyServices is offline
 
Join Date: Aug 2008
Location: All over the USA
Posts: 216
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yea we tried that too.. Didn't work either though... Any other suggestions? Thanks for the fast reply
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:57 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.08427 seconds
  • Memory Usage 2,412KB
  • Queries Executed 27 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (4)bbcode_code
  • (11)bbcode_php
  • (6)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (6)postbit_attachment
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete