Skip to:

Custom Lottery and Gamble Feature in BuddyPress

  • Tosh


    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.

    Lottery Active

    Lottery Off

    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.

Viewing 2 replies - 1 through 2 (of 2 total)

  • josh101


    That’s cool. With the lottery on/off thing cant you set up a time for it and it auto runs and bp all ready has a random feature I wounder if they have an api for it because if so you may be able to make this 100% auto pilot. For the lottery. So there your two problem to solve for lottery.
    Bets I have no idea how you can poll that off but it maybe as simple as a new forum component ok so maybe its not that simple. Here my idea. It be like a friend request maybe you could get most the code from that component anyways but instead of a friend it be a bet. If the challenger agrees then bp makes an activity page for that bet think of the group activity page where member of “it” can only post in this case the betters but before the bet can go into the finale stage it must be validated then gain judges which is the one who says who wins or lose. Then click the jack pot and selects the winner from a drop down menu.
    Here another idea if the item is a bp or wp feature then the website could play as the judge.



    Here is how to do it btw –

    Good ideas on the auto-run and random. I’ll have to look at that more in depth when I have time.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom Lottery and Gamble Feature in BuddyPress’ is closed to new replies.
Skip to toolbar