Gamify your WordPress website by offering lotteries for points!
The myCRED Lottery add-on allows you to setup two types of lotteries where your users can enter and win points.
Pick a Winner!
You can select to draw one or more winners in a raffle type of lottery. Your users buy “entries” and receive a unique ticket number. When the lottery has been closed, x number of ticket numbers are drawn at random. The winners are paid either a lump sump of points or points based on a formula.
One of the most common lottery types where x number of winning numbers are drawn from a range. You can set the range, how many numbers to draw and how much points users win based on the number of correct picks.
- Set how many winners to draw.
- Set how many points each winner gets.
- Option to allow purchase of one or multiple entries.
- Set the number range.
- Set how many numbers to draw.
- Set how many points to give based on correct picks.
- Optional Jackpot system.
- Option to schedule lotteries to run daily, weekly or monthly. Also includes the option to run the lottery manually.
- Option to send custom email notifications for winners.
- Easy management of lotteries via the admin area.
- Option to set a minimum or maximum balance requirement to enter the lottery.
- Option to exclude users based on role or ID from lottery.
- Option to refund entries.
Fair Game Limitations
The lottery add-on while being customisable have certain intentional limitations in order to provide a fair game:
- The random number generator is not customisable.
- Administrators can not chose the winner or winning numbers of a lottery.
Lottery entries can not be altered. They can only be deleted or refunded.
Lottery entries can only be deleted / refunded while the lottery has started. Once the winner or winning numbers have been drawn, no further changes can be made.
The lottery add-on plugin is not encoded. Authorized personnel with a basic understanding of PHP can view the files and potentially manipulate them!
- Unzip the attached zip file and upload the folder to your websites plugin directly.
- Make sure you have myCRED installed and setup.
- Enable the myCRED Lottery plugin.
- Once enabled, a new menu will be available under “myCRED” in your admin area called “Lotteries”.
- Before creating a lottery, make sure your websites Timezone is setup and correct! Otherwise the schedule will be firing according to your server time which might not be the same as your local time! You can find your timezone settings on the “Settings” > “General” page.
- This add-on will check your time format and if you use AM/PM the lottery will also use AM/PM. Otherwise it will default to the 24 hour system. (optional)
- Login to your myCRED account here on mycred.me
- Click “Your Licenses” and enter the domain name of the website where this add-on is used. Save. (If you do not do this, your plugin will never update it self when a new version is available).
How to setup a lottery
- Visit the “Lotteries” page under the “myCRED” menu.
- Click “Create Lottery” in the top of the page.
- Just as with posts, start by giving your lottery a title and select your lottery “Type”. Before updating, also select your schedule. Choose either to run this lottery once, daily or weekly.
- Once you have entered in your dates and times, click “Save Draft”. Note that each state (start, close, draw and pay) must have a unique time. You can not draw winners and payout the same hour. This is so you can correct mistakes (if they happen) before each state change.
- When the lottery draft has been saved, 4 new meta boxes will be loaded.
- Start by setting up your lottery (The Setup Meta Box). By default, mycred will draw 5 winners / winning numbers. You can change this, but if you do, you must click “Update” for the Winnings section to update! myCRED will save your lottery settings each time the edit page is re-loaded.
- Set your requirements for participating in this lottery.
- Set exclusions for this lottery.
- Adjust the templates used by the lottery.
- Once you have all the settings according to your liking, you can publish the lottery though the “Activate Lottery” button.
How to show lotteries
Lotteries are shown on your website via the mycred_lottery or mycred_lotteries shortcodes. The mycred_lottery shows a specific lottery while the mycred_lotteries shortcode shows all published lotteries. You can find more information on how to use these shortcodes in the myCRED Codex.
How to edit lotteries
You can edit lotteries just like any other custom post type in WordPress via your admin area. NOTE In the current version of the lottery add-on, you can not make changes to a lottery that is active! I will add this feature to the next version of the lottery add-on.
- Visit the myCRED > Lotteries page.
- Select the lottery you want to edit and click on the lottery title.
- Edit the lottery and save your changes.
By default you can set a fixed number of points to award winners. As of version 1.2, you can also use formulas to give points based on specific metrics. For example you could set to payout a percentage of the total amount of points user has paid to enter the lottery. The following keywords are available in formulas:
||Represents the total amount of points paid to play this lottery.||Pay 10 points plus 10% of the total amount paid into this lottery:
10 + ( PAYMENTS * 0.1 )
||Represents the total number of entries in the lottery.||Pay 2 points per entry in the lottery as payout:
2 * ENTRIES
||Represents the total amount of points paid out in refunds for this lottery.||Pay 10% of the total amount paid into this lottery minus any refunds there might have been:
( PAYMENTS * 0.1 ) - REFUNDS
Note about formulas and testing
When testing, make sure you have enough entries / payments in the lottery for the payout to work. If your for example use whole numbers for your points and the formula results in a value smaller then 1, the result will be interpreted as zero and no payout will occur. I recommend you set a high price or enter enough entries when testing to prevent this from occurring.
- TWEAK – Added support for WordPress 4.9
- TWEAK – Added support for myCRED 1.8
- NEW – Added support for myCRED customizations of shortcode names.
- FIX – When selecting to draw / pick more then 5 winners / numbers, the settings are not saved when the lottery is saved.
- FIX – Updated the Math Evaluation script to latest version to resolve certain installations where formulas did not payout.
- FIX – Updated language files.
- FIX – Fixed PHP notice when editing lottery.
- TWEAK – Slight adjustment to the admin style.
- FIX – If too few users play a lottery, the tickets are not refunded but instead drawn as winners.
- NEW – Support for monthly and manual schedules.
- NEW – Re-design of the lottery editor.
- NEW – Added new shortcode mycred_lottery_winnings.
- TWEAK – Improved schedule process.
- NEW – Option to award points based on formula with built-in formula evaluation for testing.
- NEW – Option to set which point type to pay out.
- Fixed Bug #7 – Fixed schedule date issue showing server time and not local time set.
- Fixed Bug #8 – Fixed issue with drawn winners getting saved twice causing results to show duplicate winners.
- Fixed Bug #9 – The lottery add-on translates certain admin buttons.
- Added new Winning Numbers Widget showing a given lotteries drawn numbers.
- Hidden the Publish button to prevent lotteries from being published before a type and schedule is set. If a lottery is published before these details are saved, the lottery will fail.
- Fixed Bug #6 – Schedule is not working all the time. Rewrote the schedule.
- Added option to manually add entries in lotteries.
- Added next scheduled state in the lottery list.
- Replaced the UL element used for the past winners with a table.
- New mycred_lottery_jackpot shortcode to show a lotteries current jackpot.
- New mycred_lottery_plays shortcode.
- Fixed Bug #5 – myCRED Icon not visible when viewing lotteries or editing lotteries in the admin area.
- Added several action and filter hooks to allow customizations of payouts and participation.
- Fixed Bug #4 – Update button missing name causing lottery to re-set during edit
- Adjusted lottery for myCRED 1.3
- Fixed Bug #1 – Draw Winners are not paid out instead causes a fatal error.
- Fixed Bug #2 – Past Winners are incorrectly parsed causing fatal error.
- Initial release
Frequently Asked Questions
No questions found for this add-on.
Only logged in customers who have purchased this product may leave a review.