One of the most frequently asked questions we get about BracketPress is “how can I have my users have multiple brackets?”
Awesomely, the core of BracketPress already has that capability. If you’d like to give an additional bracket (or two) to your users, here’s what you as the site owner can do:
a) Login in to the Administrator
b) Click on “Brackets”
c) Click “Add New”
d) Give the new bracket a title
e) In the content area, type in the shortcode: [bracketpress_display_bracket]
f) Scroll down to “Author” and select the owner of this bracket.
g) Hit “Publish”
Hint: If you don’t see ther “Author” section, make sure that it’s enabled in the “screen options” drop-down available from the top right of the Add New Bracket admin screen.
Now, when your user logs in, all their brackets will be listed.
But what if you want to do this automatically? Fore example, making sure that all of your users have two brackets to start with?
Below is a a function that checks to see how many brackets a user has, and if they don’t have enough, ads them up to the limit.
Chances are, you’ll want to run the function when a user signs on. Here’s the Gist:
To put the code in your site, simply use Otto’s pluginception, enter the above code, and activate the plugin. Be sure to change num_brackets to the number of brackets you want each person to have, and feel free to make the bracket title unique to your site.
There’s certainly more you could do. For example, if you get the users role, you could have different levels of users have a different number of brackets. You could also store the number of brackets each user has in the user meta-data, then use Easy Digitial Downloads, s2Member, or another ecommerce system to increment the count … thereby “selling” brackets.
We’ll leave the above expansions as an exercise for the reader, as they are very site dependent. However we can provide additional development services on request as time allows.