Custom Lottery and Gamble Feature in BuddyPress
This is very customized for my use only really. But if anyone is interested in how I did it I can share how it was done but here is a general overview.
For the lottery account I run a sql statement to remove all donation logs for the lottery account only so it’s all clear. The donation logs for the member donating to the lottery remain in their account.
Reason I remove all the donation logs for the lottery account is because I have a set amount of points and times they can donate for example it’s impossible to enter the lottery more than 7 times. Only way to track and prevent this is to clear the account after each lottery/giveaway/contest/etc.
I can also turn the “lottery” on or off by changing a field to be “On” in the profile for that lottery account. This hides the enter contest button.
Anyway once a lottery is over and I turn it off I copy and paste all the logs into a random line picker or whatever you’d like to use. After the winner it picked I clear the logs.
On the gamble account it’s more a manual process. Members create a new forum topic and agree what to bet their points on, then after the betting time is over somebody locks the forum post and they when a winner is decided I log into the gamble account and donate the points to the winner and post a update about the latest winner.
I also had to modify several CubePoints core files to make this work as well. I have donations working for only 3 accounts. Lottery, Lottery2 & gamble. I disabled/hidden the donate link everywhere else.
On the lottery account pages here is a overview of the new features:
- Your entries in the current Lottery
- Your chance of winning the lottery based on your entries. This does NOT factor in entries from outside the site … for example Twitter, Facebook, YouTube, etc.
- Your points used in current lottery.
- Total points from everyone in current lottery.
- Total entries from everyone in current lottery.
- Total lottery point log entries are dynamic based on the amount of lottery entries. So it will show all the entries on the same page.
- At the top of the page it will have a link to the latest giveaway/contest which is also dynamic.
- Shows the last 10 giveaway/contest posts at the bottom of the page.
- Lottery donations can be turned on or off at any time.
- Active: It will have the donation button, link to how to enter and your lottery stats.
- Disabled: A “Lottery Closed” with lock icon will appear.
Here is a overview of the gamble account page and the new features:
- It will display your points gambled.
- It will display your winnings in bets.
- The bet your points button has a drop down of set point amounts for betting: 50, 100, 150, 200, 250.
- Shows all the points in the gamble “pot”
- A list of the latest winners
At the top of the page it will have a link for the latest bets and another link for how to create a new bet.
You must be logged in to reply to this topic.