Using a Custom User Meta Key for Points

The points of a user are stored in the user meta table. By default the meta key for the points is of the form wordpoints_points-{points-type}, where {points-type} is the slug of the points type. For example, if the slug was “credits”, the meta key would be wordpoints_points-credits.

Since version 1.3.0, WordPoints allows a custom meta key to be assigned to a points type. This will override the default, changing the key under which the users’ points are stored. This advanced feature was introduced to allow WordPoints to be easily integrated with other plugins. You might for example have a plugin that uses some form of user credits. You may wish to make WordPoints treat these credits like a points type, but it doesn’t seem like there is an easy way to to this. That is why this feature was introduced. It allows you to turn that other plugin’s credits into a WordPoints points type. This can only be done if the other plugin’s credits are being stored in the user meta table.

Note that although WordPoints will keep a log of points transactions for a points type with a custom meta key, like it would with any points type, only changes made by WordPoints will be logged. The other plugin can still change the value, but those changes will not be logged by WordPoints

Because this is an advanced feature, it cannot be set from the administration panels. The setting must be added with some custom code. An example of a function to set a custom meta key for a type of points is below. This function will change the meta key for the credits points type to 'credits'.