XF 2.1 How could users donate to other users?

Hilary

Member
I'm thinking - tentatively - of having a system on my forum whereby users can 'thank' other users with a donation - like the 'buy me a beer' button you used to see on websites, but somewhere on their posts or in their profile.

Has anyone implemented anything like this, and if so, how? I don't think there's an add-on for it. (I can imagine another button under 'like' for instance - like, love, beer-mug... - or something clickable after the user title / banner... )
 
Not necessarily custom development with an add on, per se.

But you could make a custom field with a phrase ("buy me a beer") and their PayPal link or email. Then just plop both those in the user bits or profiles.

Then you don't have to worry about anything as it's handled by PayPal and not your processor (refunds, disputes, etc.), which would require an add on to distribute (and maybe take a cut, but it sounds like donations only, so direct wound be best).
 
But you could make a custom field with a phrase ("buy me a beer") and their PayPal link or email.

Only problem with that is you would be exposing everyone's PayPal email/link to the world. Best tot have a addon to handle it and obfuscate the email/link.
 
  • Like
Reactions: frm
It would require custom development.
:(
you picturing the other users actually getting the money? Or the site gets the money and the user gets an account upgrade?
The other users get the money. (I might ask them to send me a 'tithe', honour system. It's the kind of community where that would work.)
Not necessarily custom development with an add on, per se.

But you could make a custom field with a phrase ("buy me a beer") and their PayPal link or email. Then just plop both those in the user bits or profiles.

Then you don't have to worry about anything as it's handled by PayPal and not your processor (refunds, disputes, etc.), which would require an add on to distribute (and maybe take a cut, but it sounds like donations only, so direct wound be best).
This sounds ideal. (They could set up a paypal.me link to avoid sharing email addresses.) Where can I learn more about how to do this, please?
 
This sounds ideal. (They could set up a paypal.me link to avoid sharing email addresses.) Where can I learn more about how to do this, please?
This is how I would do it.

ACP > Users > User custom fields

Create: ppMeLink
1571671110917.webp

Use regex to determine if it's a valid PP link or not:
1571671169350.webp

Regex: ^http[s]*:\/\/[www.]*paypal\.me\/[a-zA-Z0-9\-\_]*

Use these settings so a moderator can remove it and that it's not visible in the profile (only in the user info) and ignore the value display HTML as I'm reporting that as a possible bug.
1571671282711.webp

Edit the template message_macros around line 18:
1571671437744.webp
Right under <xf:userbanners>:
HTML:
<xf:if is="$xf.visitor.user_id"><span style="padding: 5px;"><a href="{$xf.visitor.Profile.custom_fields.ppMeLink}" target="_blank" rel="noopener noreferrer nofollow">Donate! :)</a></span></xf:if>

And you'll get this for logged in users:
1571671582663.webp

And logged out:
1571671641172.webp

They set their PayPal.Me link in their account details:
1571671718082.webp
 
It may not be the ideal look you're going for, but it's a beginning of a template customization to add that PayPal link anywhere without having an add on to accomplish it.

I'd probably use the PayPal donate image instead of the text provided (HTML required). You can also create another field of custom text if you want and then just use $xf.visitor.Profile.custom_fields.ppMeDonateText (a new custom field with same settings except the regex of ^[a-zA-Z0-9\s\.\!\,]* instead so they can make a sentence with spaces, numbers, a comma, period or exclamation point too, otherwise, you can get some nasty javascript in there).
 
I would make it really simple and just create a Paypal button BBCODE:

Code:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick" />
<input type="hidden" name="hosted_button_id" value="{text}" />
<input type="image" src="https://www.paypalobjects.com/en_US/GB/i/btn/btn_donateCC_LG.gif" border="0" name="submit" title="PayPal - The safer, easier way to pay online!" alt="Donate with PayPal button" />
<img alt="" border="0" src="https://www.paypal.com/en_GB/i/scr/pixel.gif" width="1" height="1" />
</form>

Each user would just need to create their own paypal donate button in Paypal Tools, then choose that bbcode and add their button ID. They could use this in signatures or posts or profile
 
This is how I would do it.

ACP > Users > User custom fields

Create: ppMeLink
View attachment 212464

Use regex to determine if it's a valid PP link or not:
View attachment 212465

Regex: ^http[s]*:\/\/[www.]*paypal\.me\/[a-zA-Z0-9\-\_]*

Use these settings so a moderator can remove it and that it's not visible in the profile (only in the user info) and ignore the value display HTML as I'm reporting that as a possible bug.
View attachment 212466

Edit the template message_macros around line 18:
View attachment 212467
Right under <xf:userbanners>:
HTML:
<xf:if is="$xf.visitor.user_id"><span style="padding: 5px;"><a href="{$xf.visitor.Profile.custom_fields.ppMeLink}" target="_blank" rel="noopener noreferrer nofollow">Donate! :)</a></span></xf:if>

And you'll get this for logged in users:
View attachment 212468

And logged out:
View attachment 212469

They set their PayPal.Me link in their account details:
View attachment 212470


I wanted to specify that: href="{$xf.visitor.Profile.custom_fields.ppMeLink}" is wrong. It should be href="{$user.Profile.custom_fields.ppMeLink}" otherwise it'll always be your paypal.me link, and not the one that user specified.
 
I wanted to specify that: href="{$xf.visitor.Profile.custom_fields.ppMeLink}" is wrong. It should be href="{$user.Profile.custom_fields.ppMeLink}" otherwise it'll always be your paypal.me link, and not the one that user specified.
Thank you for pointing that out. I also reported this as a bug as it was outputting the raw content of the link only and not respecting the HTML value.


It's not a bug and {$definition.getFormattedValue($user.custom_fields.ppMeLink)|raw} (untested) should be used as opposed to the former variable wrapped in HTML in the template so it can be accessed in both ways (a plain text URL and HTML filled out in "Value display HTML").
 
Top Bottom