Documentation/configuration/Player Linking

Correctly configuring the database and the player-user-linking sections are required for CommunityBridge to work. All of CommunityBridge's features depend on being able to correctly match a Minecraft player to a their web application user account. CommunityBridge does this by looking up the player's Minecraft player name in the web application's database.

There's two possibilities here. Either the player's Minecraft player name and web application username must match OR you can create a custom profile field on the web application in which the player can put their Minecraft player name, often referred to as their "in game name" (IGN). The second option is that the username and player name can be different.

Scenario A: Names Must Match

For this option to work, you must tell CommunityBridge how your web application stores its user information.

Generally, there will be a table, typically named users or members, or something similar. Usually, it will have a prefix. For example, phpBB stores its user information on the phpbb_users table, SMF stores its user information on the smf_members table.

Then, you need to specify the name of the column (field) that contains the user ID and the name of the column that contains the user's username. For example, on phpBB the user ID is in the user_id column, the username is in two possible columns: username and username_clean (I recommend using username), on SMF the user Id is in the id_member column and the username is in the member_name column.

Here's a relevant excerpt from the player linking section, filled in with the appropriate information for phpBB. Notice uses-key is false and that information is left blank. They are unlikely to be needed for this scenario.

# The name of the table which contains the columns:
table-name: phpbb_users
 
# Column on the table that contains the user ID. Typically something like
# user_id or member_id
user-id-column: user_id
 
# If the player name is stored in a key-value pair of columns instead of
# its own column, set this to true:
uses-key: false
 
# If you set 'linking-uses-key' to false, then set this to the column that
# the playername is stored in. Otherwise, leave it empty.
playername-column: username
 
# If you set 'linking-uses-key' to true, then set the key column, value
# column, and the key-name here. Otherwise, leave these fields empty.
key-name:
key-column:
value-column:

Option B: Names Can Be Different

Generally, your first step in setting up this way is to create a custom user profile field in your web application. Each web application does this a different way. If you don't know how to add custom user profile fields to your web application, you should consult the support team for your web application to find out how. For purposes of discussion, I'll assume you've named your custom profile field "minecraft_name".

First thing to be aware of, most web applications take the name you gave your custom profile field and add a prefix to it. For example, on phpBB, all custom profile fields start with pf_, so we end up with pf_minecraft_name. On SMF, they're prefixed with cust_, so we end up with cust_minecraft_name.

You'll need to identify the table that your web application stores the data for your custom profile fields. Be careful, some web applications have one table that they have information about the profile fields and another one that has the actual profile field data in it (SMF is an example of one of these), be sure that you've found the table that the actual profile field data is in. Examples: phpBB: phpbb_profile_fields_data, SMF: smf_themes.

Here's where it gets tricky. Some web applications create a column for each custom profile field on the table. Others store the information on the table in key-value pairs and therefore will three important columns (user ID, key column, value column).

Columnar (Keyless) Style

phpBB is an example of a web application that creates a column for each custom profile field. So the important columns for phpBB is the user_id column and the pf_minecraft_name column. Here's what the config would look like for phpBB:

# The name of the table which contains the columns:
table-name: phpbb_profile_fields_data
 
# Column on the table that contains the user ID. Typically something like
# user_id or member_id
user-id-column: user_id
 
# If the player name is stored in a key-value pair of columns instead of
# its own column, set this to true:
uses-key: false
 
# If you set 'linking-uses-key' to false, then set this to the column that
# the playername is stored in. Otherwise, leave it empty.
playername-column: pf_minecraft_name
 
# If you set 'linking-uses-key' to true, then set the key column, value
# column, and the key-name here. Otherwise, leave these fields empty.
key-name:
key-column:
value-column:

Notice that uses key is false and the key-name/key-column/value-column settings are left blank. They are not needed on phpBB.

Key-Value Style

SMF is an example of a web-application that uses a key-value pair to store its custom profile fields. To set this up correctly, we have to know what column the user ID is in: id_member, the key name: cust_minecraft_name, what column will have the name of the key: variable, and what column will have the actual value: value.

# The name of the table which contains the columns:
table-name: smf_themes
 
# Column on the table that contains the user ID. Typically something like
# user_id or member_id
user-id-column: id_member
 
# If the player name is stored in a key-value pair of columns instead of
# its own column, set this to true:
uses-key: true
 
# If you set 'linking-uses-key' to false, then set this to the column that
# the playername is stored in. Otherwise, leave it empty.
playername-column: 
 
# If you set 'linking-uses-key' to true, then set the key column, value
# column, and the key-name here. Otherwise, leave these fields empty.
key-name: cust_minecraft_name
key-column: variable
value-column: value

Notice that uses-key is true. And that we don't need the playername-column, so it is left blank.

Summary

You have two different options on how to handle linking, either you can require the player's username to be identical to their Minecraft name or you can allow them to be different. The second option will be trickier to configure because there's two different ways a web-application might store the information you'll require. Don't forget that web applications like to put their own prefixes in front of custom profile field names, that will trip you up if you forget about that small detail.


Comments

Posts Quoted:
Reply
Clear All Quotes