Code Transfers

Estimated reading: 5 minutes 986 views

Code Transfers

Introduced in 1.1, code transfers is a feature that allows your users to make quick transfers using a custom code that you setup, in certain situations. Right now, the following instances are supported:

InstanceRecipientDescription
WordPress CommentsPost AuthorUsers can quickly transfer points when leaving a comment to the post author.
BuddyPress Activity CommentProfileBy posting a comment on a users activity, you can transfer points to the user that owns the profile.
BuddyPress Private MessageMessage RecipientUsers can make quick transfers when sending a new message or leaving a reply to a message.
bbPress Topic ReplyTopic AuthorUsers can quickly transfer points when posting a reply in a forum topic.

The core concept is that your users indicate in their comment / message that they want to make a transfer and how much to transfer. Since the recipient is already set, they do need to provide this.

 

In order for the add-on to understand what piece of text is a transfer and what is just a comment text, you are required to set a unique identifier. This should be a word or a set of characters that users would normally not type in a comment field. This is followed by the point amount and that is all.

 

Transfers are processed when the comment / message / reply is saved. If the transfer could not be made, you can select to replace the transfer request with an error message or a success message. Otherwise the request is stripped of the message / comment to prevent it running again.

Limitations

Transfers will be processed when a comment is approved. So if a comment is held for moderation, an admin can adjust or remove a request before it is processed by editing the comment. This also means that the user needs to have enough points at the time when the comment is approved. So if the user makes a comment, has enough points at the time to send the requested amount, but the comment is held for moderation. If the user no longer has enough funds by the time the comment is approved, the request will be rejected.

 

For BuddyPress users, when a user leaves a reply for a private message, the request will not render until the page is refreshed. This is because BuddyPress does not allow us to filter the content that is returned to the user via AJAX.

 

This feature is not guaranteed to work with third-party comment systems! If comments are loaded over AJAX, the request might still be visible until the page is refreshed, depending on your setup.

Setup

Just like with regular transfers, we need to set the reference that we will be logging transfers under and the minimum and maximum amount a user can transfer in a single session.

Next we need to set the format that identifies the transfer in a comment or message. This needs to be something unique that a user would not normally put in a comment / message. Use special characters to make it more unique.

 

Besides this unique identifying string, we also need to indicate the point amount. It is recommended that it comes after the identifying mark as numbers in itself is not unique enough.

 

Next we need to set what we should replace the request with if the transfer is successful. You can leave this empty in which case the user will not see the results of the transfer, even if it succeeds. Note that this message will be visible to everyone so if used.

 

Finally we need to select what instances the transfer is allowed to occur. If you do not have a specific plugin installed, like BuddyPress, you will not see these instances as an option. To disable this feature make sure no instances are selected.

 

If you have multiple point types setup, you will be able to set a unique setup for each point type.