HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS, which is now in beta. ocPortal 9 will be superseded by Composr 10.

Head over to compo.sr for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.


Donation Module ?

Login / Search

 [ Join | More ]
 Add topic 
Posted
Rating:
#86577 (In Topic #17703)
Avatar

Well-settled

When I first found ocPortal it was because I was looking for a Open Source software that was complete with some entertainment features, nice user friendly forums and up to date. The idea of it being Open Source is it was cost effective for places that ran on Donations and complete so that everything was there little or no coding skills required. Not everyone wants to be a programmer just because they have a use for a website. :dry:

The default theme had a banner indicating Donations as such well brazened across top. Now that I am slowly getting acclimated to the new software I find myself looking for a way to incorporate in a simple way to nicely ask that members can simply click to go to a donation area input a $ figure in a box and it take them to our communities PayPal deposit screen. And then logging their site name as a donator in some fashion. A running list each month of these members would be great. Has anyone done this or is their a addon I am missing that will help me accomplish this? I ask about a addon because of my extremely short time using ocPortal I am struggling as is to do simple things. Creating from scratch is well way above my skill level at the moment.

I didnt know if the classifieds might have a payment system that could be modified to use or what others are doing. So anyone with experience adding a PayPal donation feature I would love to get some insight on how you did this. :)

By the way the calender is a extremely nice feature. It solved a big issue I had before with the other part of running our gaming community on donations. Having a way to remind (politely) its members of due dates for things such as game server payments, domain registrations, hosting fees, etc.. I love the Calender!  It would be awesome to use it in a way to log payments received from PayPal and so on. But that is just an idea right now I need a way to implement the basic features.

:offtopic:
  on a lighter side I did a search on the forums for Donations. :lol: I got 1 hit, not counting the faq* ones that didn't help in this case. It started out

Chris Graham said

This is going to come across rather grumpy
here is the rest post #84498 in case anyone missed it.

EDIT: *That was a typo I swear on the faq so sorry if it offended, it was a accident I swear. :$ I only mentioned his post because I can relate. I get frustrated and want to rant at times as well. :)


Last edit: by Sahs

Don't be skeerd its me learning ocPortal.
Take a look you never know what its going to be like.
Here is the box of chocolate link. 

Expand: What the site is to be for. What the site is to be for.

Back to the top
 
Posted
Item has a rating of 5 (Liked by Sahs)  
Rating:
#86587
Avatar

Community saint

For myself I just added paypal buttons to a comcode page. However this approach doesn't come with tracking so I have been thinking of making a mini-module for donations. If I do I will share and let you know. Alternatively, I suppose you could use the ecommerce system and just add items for purchase which are donations. I haven't tried this yet but I may and if it works well skip the mini-module?

I think there is a default comcode page for donations already which you can find at Yoursite.com/pg/donate   just edit it with your buttons

Oh and you can always add a more prominent link to it by adding it to your Zone Menu
Back to the top
 
Posted
Rating:
#86589
Avatar

Well-settled

Thanks Duck I thought you might have done something like this. If I remember right you had/have a game site?

I have found the page you mentioned. I was thinking it would be a generic coded page for PayPal but its just a page.  :(  I havent figured out the way all this works yet. I read stuff and I think I am doing great then I keep reading and then I get confused so i start over. Its like racing circle track. I am going fast but I am getting nowhere most of the time.   O_o

Don't be skeerd its me learning ocPortal.
Take a look you never know what its going to be like.
Here is the box of chocolate link. 

Expand: What the site is to be for. What the site is to be for.

Back to the top
 
Posted
Rating:
#86590
Avatar

Well-settled

Well I found where to get my code from that will accomplish most of the issue. It allows you to mod the code as well to give redirect back to your site if payment is canceled or another link if successful.  :)
Contribution Payments -- Donate Buttons

Just have to learn my way around better.  :$

I just found Reference information for HTML variables that can be used in customizing / making the code here  


Last edit: by Sahs

Don't be skeerd its me learning ocPortal.
Take a look you never know what its going to be like.
Here is the box of chocolate link. 

Expand: What the site is to be for. What the site is to be for.

Back to the top
 
Posted
Item has a rating of 5 (Liked by Sahs)  
Rating:
#86591
Avatar

Community saint

Yeah sorry I guess I should have explained more clearly. Yes I created the button code via Paypals button generators. I made a Donate Button as well as Subscribe and then added them to the comcode page manually. I does the job but as I say there is no tracking on the website to list the donators. Something that could be useful to encourage the donations via recognition.
Back to the top
 
Posted
Rating:
#86593
Avatar

Well-settled

Not a problem, I found it to be quite easy to apply I actually have the Donation part functioning. Not completely as it needs to be visible. As you said recognition is a good thing when taking peoples money.  It helps as new donators names show up others are reminded as well. And a little peer pressure thrown in on the side might not hurt. :devil:

I see there are HTML codes that can be used to track transactions. The "custom" or "invoice" one ?



I just do not know how or where to start. Somehow get it to tell the correct member to display their forum name? To donate their email would be mandatory to register in to the site and it possibly could be matched up giving the donators username?

Hell what am I talking about I have no clue how to code or what is even possible. :lol::lol:

Don't be skeerd its me learning ocPortal.
Take a look you never know what its going to be like.
Here is the box of chocolate link. 

Expand: What the site is to be for. What the site is to be for.

Back to the top
 
Posted
Item has a rating of 5 (Liked by Sahs)  
Rating:
#86596
Avatar

Community saint

Yeah this would require coding and some database (well technically a file could be used) additions to do the tracking. Then you can set up IPN notifications in paypal to notify you when donations are received.  This can be coded and set up rather simply if using paypal buttons but if done right it's a little more complicated (but not a lot) so you can actually add buttons etc via your website. So basically when the person clicks you can record the transaction right away in the DB before redirecting them to paypal and then when the transactions finished via paypal they send you notification and you can finalize in your DB.

There are plenty of php classes written for this already on the web that could used with a little modification to work with ocPortal. I have too many projects on the go right now that I am way behind on to tackle this but I may do it in the future if no one else gets around to it.
Back to the top
 
Posted
Rating:
#86597
Avatar

Well-settled

That would be awesome if you or someone did. But I totally understand the time issue. Thanks

Don't be skeerd its me learning ocPortal.
Take a look you never know what its going to be like.
Here is the box of chocolate link. 

Expand: What the site is to be for. What the site is to be for.

Back to the top
 
Posted
Item has a rating of 5 (Liked by SahsLiked by Jean)  
Rating:
#86599
Avatar

Community saint

I was looking at the ecommerce system and I think actually an easy approach would be just to use that for Donations. Set up Products with donation ids and then people just buy the donation? If we think about carefully we could use the product id field to build a mini block to list donators. That should be rather simple I think. Hmm this might work. I am not at home most of  this and next week so I don't have access to my main comp in which I develop so I can't do a lot of exploring and testing etc but as soon as I home I will experiment with this to see what I can come up with.
Back to the top
 
Posted
Item has a rating of 5 (Liked by Sahs)  
Rating:
#86600
Avatar

Community saint

@Chris

if you're glancing this thread can you answer me this:

Is it possible to use the same product id for different products in the shopping cart?


IE if we set up several products with varying amounts for donation:

Product1 Donate $5
Product2 Donate $10
Product3 Donate $20

Could each of those have a product id of "donation"?

If so then I can make a simple block to list Donations based on that id field.

Not as elegant as a real donation module I suppose because you will have to define amounts for people instead of allowing them to pick any amount but it could serve as a quick simple soltuion to the Donation tracking problem for now?

Thoughts?


Last edit: by Duck
Back to the top
 
Posted
Item has a rating of 5 (Liked by Sahs)  
Rating:
#86604
Avatar

Community saint

Duck said

Yeah this would require coding and some database (well technically a file could be used) additions to do the tracking. Then you can set up IPN notifications in paypal to notify you when donations are received. This can be coded and set up rather simply if using paypal buttons but if done right it's a little more complicated (but not a lot) so you can actually add buttons etc via your website. So basically when the person clicks you can record the transaction right away in the DB before redirecting them to paypal and then when the transactions finished via paypal they send you notification and you can finalize in your DB.

This sounds very much like what happens now when you but support credits for ocProducts support. Your transaction is recorded and then you are taken to the Paypal site where you can choose to return to the ocPortal site.

Bob
Back to the top
 
Posted
Item has a rating of 5 (Liked by Sahs)  
Rating:
#86605
Avatar

Community saint

@Bob yeah I was looking at the API for ecommerce and it should be easy to add once I figure it out.
Back to the top
 
Posted
Item has a rating of 5 (Liked by Sahs)  
Rating:
#86606
Avatar

Community saint

Duck said

@Bob yeah I was looking at the API for ecommerce and it should be easy to add once I figure it out.
Maybe you guys could ask Chris how much it would cost to bundle up what ocPortal does as an add-on? Since it's already working, it would likely not be too expensive – not that i am trying to discourage any third-party development, it's just that it seems to be really close to what's being asked for. I mean, if it's just a couple of hours of support credits, it might well be worth pooling resources to get the just over $100 dollars and be done with it.

Bob



Last edit: by BobS
Back to the top
 
Posted
Item has a rating of 5 (Liked by BobS)  
Rating:
#86607
Avatar

Well-settled

I agree there is no reason to do double the work if just massaging to something already made would do the job.


Don't be skeerd its me learning ocPortal.
Take a look you never know what its going to be like.
Here is the box of chocolate link. 

Expand: What the site is to be for. What the site is to be for.

Back to the top
 
Posted
Item has a rating of 5 (Liked by Sahs)  
Rating:
#86608
Avatar

Community saint

Sahs said

I agree there is no reason to do double the work if just massaging to something already made would do the job.
Mind you, I have no idea of what the cost would be to bundle up what is being used by ocPortal into an addon. I just suspect that it wouldn't be too involved and would actually be a good feature for ocPortal. Chris will have to weigh in on this with some numbers.

I am sure that Duck would do a great job should he chose to tackle this too. But I think getting this implemented in the ocPortal installation would be a great benefit for many sites, especially gaming sites and might unlock more opportunity for ocPortal.

Bob
Back to the top
 
Posted
Item has a rating of 5 (Liked by SahsLiked by Jean)  
Rating:
#86622
Avatar

Duck said

@Chris

if you're glancing this thread can you answer me this:

Is it possible to use the same product id for different products in the shopping cart?


IE if we set up several products with varying amounts for donation:

Product1 Donate $5
Product2 Donate $10
Product3 Donate $20

Could each of those have a product id of "donation"?

If so then I can make a simple block to list Donations based on that id field.

Not as elegant as a real donation module I suppose because you will have to define amounts for people instead of allowing them to pick any amount but it could serve as a quick simple soltuion to the Donation tracking problem for now?

Thoughts?

No, but no issue. Each product must have a unique price. But a hook may define multiple products. Routinely we do this, dynamically generating a hook's products based on what has been set up on the site. E.g. usergroup subscription products – USERGROUP1, USERGROUP2, etc.

Here's out sources_custom/hooks/systems/ecommerce/support_credits.php hook. The code was not designed to be readable, but it's not too bad an example. It is pretty similar to some of the inbuilt hooks, or the one supplied in the classifieds addon. Essentially it defines how product purchases are activated, lists products, records the details relating to a transaction ID [what we call the key, based on PayPal terminology] (in this case in a custom table, credit_purchase).

PHP code


<?php /*

 ocPortal
 Copyright (c) ocProducts, 2004-2009

 See text/en/licence.txt for full licencing information.

*/

/**
 * @license        http://opensource.org/licenses/cpal_1.0 Common Public Attribution License
 * @copyright        ocProducts Ltd
 * @package        customers
 */

/**
 * Handling of adding support credits to a member's account.
 *
 * @param  ID_TEXT    The key.
 * @param  array    Details relating to the product.
 * @param  ID_TEXT    The product.
 */
function handle_support_credits($_key,$details,$product)
{
    unset(
$product);

    
$row=$GLOBALS['SITE_DB']->query_select('credit_purchases',array('member_id','num_credits'),array('purchase_validated'=>0,'purchase_id'=>intval($_key)),'',1);
    if (
count ($row) != 1) return;
    
$member_id=$row[0]['member_id'];
    
$num_credits=$row[0]['num_credits'];
    if (
is_null($member_id)) return;

    
require_code('ocf_members');
    
$cpfs=ocf_get_all_custom_fields_match(NULL,NULL,NULL,NULL,NULL,NULL,NULL,true);
    
$cpf_id=NULL;
    foreach (
$cpfs as $cpf)
    {
        if (
$cpf['trans_name']=='ocp_support_credits')
        {
            
$cpf_id=$cpf['id'];
            break;
        }
    }
    if (
is_null($cpf_id)) return;

    
// Increment the number of credits this customer has
    
require_code('ocf_members_action2');
    
$fields=ocf_get_custom_field_mappings($member_id);
    
ocf_set_custom_field($member_id,$cpf_id,intval($fields['field_'.$cpf_id])+intval($num_credits));

    
// Update the row in the credit_purchases table
    
$GLOBALS['SITE_DB']->query_update('credit_purchases',array('purchase_validated'=>1),array('purchase_id'=>intval($_key)));
}

class 
Hook_support_credits
{
    
/**
     * Get the products handled by this eCommerce hook.
     *
     * @return array    A map of product name to list of product details.
     */
    
function get_products()
    {
        if (
get_forum_type()!='ocf') return array();
        
require_lang('customers');
        
$products=array(
            
'1CREDITS'=>array(PRODUCT_PURCHASE_WIZARD,1*floatval(get_option('support_credit_value')),'handle_support_credits',NULL,do_lang('CUSTOMER_SUPPORT_CREDIT')),            /* £5.50, by default */
            
'2CREDITS'=>array(PRODUCT_PURCHASE_WIZARD,2*floatval(get_option('support_credit_value')),'handle_support_credits',NULL,do_lang('CUSTOMER_SUPPORT_CREDITS','2')),    /* approx. £17, 0.5 hours on budget */
            
'3CREDITS'=>array(PRODUCT_PURCHASE_WIZARD,3*floatval(get_option('support_credit_value')),'handle_support_credits',NULL,do_lang('CUSTOMER_SUPPORT_CREDITS','3')),    /* approx. £17, 0.5 hours on budget */
            
'4CREDITS'=>array(PRODUCT_PURCHASE_WIZARD,4*floatval(get_option('support_credit_value')),'handle_support_credits',NULL,do_lang('CUSTOMER_SUPPORT_CREDITS','4')),    /* approx. £17, 0.5 hours on budget */
            
'5CREDITS'=>array(PRODUCT_PURCHASE_WIZARD,5*floatval(get_option('support_credit_value')),'handle_support_credits',NULL,do_lang('CUSTOMER_SUPPORT_CREDITS','5')),        /* approx. £30 */
            
'6CREDITS'=>array(PRODUCT_PURCHASE_WIZARD,6*floatval(get_option('support_credit_value')),'handle_support_credits',NULL,do_lang('CUSTOMER_SUPPORT_CREDITS','6')),        /* approx. £30 */
            
'9CREDITS'=>array(PRODUCT_PURCHASE_WIZARD,9*floatval(get_option('support_credit_value')),'handle_support_credits',NULL,do_lang('CUSTOMER_SUPPORT_CREDITS','9')),    /* approx. £50, 1.5 hours on budget */
            
'20CREDITS'=>array(PRODUCT_PURCHASE_WIZARD,20*floatval(get_option('support_credit_value')),'handle_support_credits',NULL,do_lang('CUSTOMER_SUPPORT_CREDITS','20')),    /* approx. £100 */
            
'25CREDITS'=>array(PRODUCT_PURCHASE_WIZARD,25*floatval(get_option('support_credit_value')),'handle_support_credits',NULL,do_lang('CUSTOMER_SUPPORT_CREDITS','25')),    /* approx. £140 */
            
'35CREDITS'=>array(PRODUCT_PURCHASE_WIZARD,35*floatval(get_option('support_credit_value')),'handle_support_credits',NULL,do_lang('CUSTOMER_SUPPORT_CREDITS','35')),    /* approx. £200 */
            
'50CREDITS'=>array(PRODUCT_PURCHASE_WIZARD,50*floatval(get_option('support_credit_value')),'handle_support_credits',NULL,do_lang('CUSTOMER_SUPPORT_CREDITS','50')),    /* approx. £300 */
            
'90CREDITS'=>array(PRODUCT_PURCHASE_WIZARD,90*floatval(get_option('support_credit_value')),'handle_support_credits',NULL,do_lang('CUSTOMER_SUPPORT_CREDITS','90')),    /* approx. £500 */
            
'180CREDITS'=>array(PRODUCT_PURCHASE_WIZARD,180*floatval(get_option('support_credit_value')),'handle_support_credits',NULL,do_lang('CUSTOMER_SUPPORT_CREDITS','180')),    /* approx. £1000 */
            
'550CREDITS'=>array(PRODUCT_PURCHASE_WIZARD,550*floatval(get_option('support_credit_value')),'handle_support_credits',NULL,do_lang('CUSTOMER_SUPPORT_CREDITS','550')),    /* approx. £3000 */
        
);

        return 
$products;
    }

    
/**
     * Get the message for use in the purchase wizard.
     *
     * @param  string    The product in question.
     * @return tempcode    The message.
     */
    
function get_message($product)
    {
        return 
do_lang('SUPPORT_CREDITS_PRODUCT_DESCRIPTION');
    }

    function 
get_agreement()
    {
        
require_code('textfiles');
        return 
read_text_file('support_credits_licence','EN');
    }

    
/**
     * Find the corresponding member to a given key.
     *
     * @param  ID_TEXT        The key.
     * @return ?MEMBER        The member (NULL: unknown / can't perform operation).
     */
    
function member_for($key)
    {
        return 
$GLOBALS['SITE_DB']->query_value_null_ok('credit_purchases','member_id',array('purchase_id'=>intval($key)));
    }

    function 
get_needed_fields()
    {
        if (!
has_actual_page_access(get_member(),'admin_ecommerce',get_module_zone('admin_ecommerce'))) return NULL;

        
// Check if we've already been passed a member ID and use it to pre-populate the field
        
$member_id=get_param_integer('member_id',NULL);
        if (!
is_null($member_id)) $username=$GLOBALS['FORUM_DRIVER']->get_username($member_id);
        else 
$username=$GLOBALS['FORUM_DRIVER']->get_username(get_member());

        return 
form_input_username(do_lang('USERNAME'),do_lang('USERNAME_CREDITS_FOR'),'member_username',$username,true);
    }

    
/**
     * Get the filled in fields and do something with them.
     *
     * @param  ID_TEXT    The product name
     * @return ID_TEXT      The purchase id.
     */
    
function set_needed_fields($product)
    {
        
$num_credits=substr($product,0,-7);
        
$manual=0;
        
$member_id=get_member();

        
// Allow admins to specify the member who should receive the credits with the field in get_needed_fields
        
if (has_actual_page_access(get_member(),'admin_ecommerce',get_module_zone('admin_ecommerce')))
        {
            
$id=post_param_integer('member_id',NULL);
            if (!
is_null($id))
            {
                
$manual=1;
                
$member_id=$id;
            }
            else
            {
                
$username=post_param('member_username',NULL);
                if (!
is_null($username))
                {
                    
$manual=1;
                    
$member_id=$GLOBALS['FORUM_DRIVER']->get_member_from_username($username);
                }
            }
        }

        return 
strval($GLOBALS['SITE_DB']->query_insert('credit_purchases',array('member_id'=>$member_id,'date_and_time'=>time(),'num_credits'=>$num_credits,'is_manual'=>$manual,'purchase_validated'=>0),true));
    }

    
/**
     * Check whether the product code is available for purchase by the member.
     *
     * @param  ID_TEXT    The product.
     * @param  MEMBER        The member.
     * @return boolean    Whether it is.
     */
    
function is_available($product,$member)
    {
        return 
$member!=$GLOBALS['FORUM_DRIVER']->get_guest_id();
    }
}


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#86629
Avatar

Community saint

That is an excellent example for me to work from Chris thanks!
Back to the top
 
Posted
Rating:
#86630
Avatar

Well-settled

Thank you to Chris Duck and BobS even if it doesnt get figured out I appreciate all the time and effort you all have already spent on this.  :thumbs:  :thumbs:  :thumbs:

Don't be skeerd its me learning ocPortal.
Take a look you never know what its going to be like.
Here is the box of chocolate link. 

Expand: What the site is to be for. What the site is to be for.

Back to the top
 
Posted
Item has a rating of 5 (Liked by Jean)  
Rating:
#86631
Avatar

Community saint

Sahs said

It started out

"Chris Graham" said

This is going to come across rather grumpy
"View topic: Give and take - ocPortal.com"

I meant to mention this yesterday that I am pleased you stumbled across that topic. Aside from the fact that ocPortal staff has had to endure insult (which is completely inappropriate under any circumstance), I think it is important that every ocPortal user try to give back to the community in some way. It seems clear to me that you will be giving here in these forums as your knowledge of ocPortal allows.

But people should consider all the other ways that they can also give back to the community and to the developers of this magnificent software: How to help out - ocPortal

If someone can land a client with a big budget, that is probably the most helpful thing for ocPortal. Short of that, people should consider sponsoring some portion of a feature that will benefit them. You can find these features in the Tracker (Feature development tracker - ocPortal). Even if you are not currently in a position to provide sponsorship, you can vote for those features which you feel will help you out. This provides valuable information for the developers as they work on future versions of ocPortal.

But if you truly want to take ocPortal from awesome to the next level of awesomeness, people will need to provide some sponsorship. Chris has made it possible to purchase as little as one credit (currently less than US$8.50 without VAT). These small co-sponsorships add up and get features developed. They also help to provide a livelihood for the developers and staff of ocPortal - something I think we want to make sure continues to be available.

Bob
Back to the top
 
Posted
Item has a rating of 5 (Liked by Sahs)  
Rating:
#86632
Avatar

Community saint

Sahs said

Thank you to Chris Duck and BobS even if it doesnt get figured out I appreciate all the time and effort you all have already spent on this.  :thumbs:  :thumbs:  :thumbs:
It will get figured out – it looks like Duck is on it and Chris has provided him with a big hands-up. Time spent discussing  features is almost always useful in one way or another.

Bob
Back to the top
 
There are too many online users to list.
Control functions:

Quick reply   Expand