This is information about opportunities for expansion and customization, which provides the platform. Here you will learn how to change the code of views and how to create your own extensions to add functionality to the platform.

How to extend Crowdfunding?

Joomla provides an excellent opportunity for developers and other third parties to extend the capabilities of the CMS through a variety of extensions.

You can extend the system developing Components, Modules or Plug-ins.

If you are new in Joomla, you can start from Developer Documentation to learn more about options to extend its capabilities.

What is Crowdfunding API?

This is a library that comes with the crowdfunding platform. You should use this library in your extensions. That will help you to interact with the platform.

You will find a documentation about Crowdfunding API on the ITPrism APIs site.

Plug-in Events

In this section, I am going to describe all plug-in events provided by Crowdfunding Platform. You will be able to use them to extend the extension, developing own plug-ins.

 

Content Events

Content events are triggered during the content creation process. The majority of these events are called in views, components and modules. This list gives a brief description of each event, what their parameters are, and some examples of their use in core plugins.

 

onContentValidate

Description

This event is used to validate data during the process of creating a project. This event is invoked on steps "Basic", "Funding" and "Story".

Parameters

context - The context of the content being passed to the plugin - this is the component name and wizard step name (e.g. com_crowdfunding.basic). Use this to check whether you are in the desired context for the plugin.

&data - A reference to the data that is being sent by the user.

&params - A reference to an object that provides parameters of the component.

Return Value

Returns an associative array.

array(
"success" => true
);

array(
"success" => false,
"message" => "Invalid title."
);
Example

Content - Crowdfunding Validator

Used in files

components/com_crowdfunding/controllers/project.php

components/com_crowdfunding/controllers/funding.php

components/com_crowdfunding/controllers/story.php

 

onContentValidateAfterSave

Description

This event is used to validate data during the process of creating a project. This event is invoked on steps "Basic", "Funding" and "Story".

Parameters

context - The context of the content being passed to the plugin - this is the component name and wizard step name (e.g. com_crowdfunding.basic). Use this to check whether you are in the desired context for the plugin.

&item - A reference to the project object.

&params - A reference to an object that provides parameters of the component.

Return Value

Returns an associative array.

array(
"success" => true
);

array(
"success" => false,
"message" => "Invalid title."
);
Example

Content - Crowdfunding Validator

Used in files

components/com_crowdfunding/controllers/story.php

 

onContentValidateChangeState

Description

The system uses this event to validate project data when someone decide to change project state. It is used only on front-end and validates the project data when someone launch a project.

Parameters

context - The context of the content being passed to the plugin - this is the component name and wizard step name (e.g. com_crowdfunding.projects.changestate). Use this to check whether you are in the desired context for the plugin.

&item - A reference to the project object.

&params - A reference to an object that provides parameters of the component.

Return Value

Returns an associative array.

array(
"success" => true
);

array(
"success" => false,
"message" => "Invalid title."
);
Example

Content - Crowdfunding Validator

Used in files

components/com_crowdfunding/controllers/projects.php

 

onContentAfterSave

Description

This is an event that is called after the content is saved into the database. Even though article object is passed by reference, changes will not be saved since storing data into database phase is past. An example use case would be redirecting user to the appropriate place after saving.

Parameters

context - The context of the content being passed to the plugin - this is the component name and wizard step name (e.g. com_crowdfunding.project). Use this to check whether you are in the desired context for the plugin.

&item - A reference to the JTableProject object that is being saved which holds the project data.

isNew - A boolean which is set to true if the content is about to be created.

Return Value

Returns TRUE on success, FALSE on failure and NULL to omit the result.

Example

Content - Crowdfunding Admin Mail

Used in files

components/com_crowdfunding/models/project.php

 

onContentChangeState

Description

This is an event that is called after content has its state change (e.g. Launched to Stopped ).

Parameters

context - The context of the content being passed to the plugin - this is the component name and wizard step name (e.g. com_crowdfunding.project). Use this to check whether you are in the desired context for the plugin.

ids - An array of primary key ids of the content that has changed state.

state - The value of the state that the content has been changed to.

Return Value

Returns TRUE on success, FALSE on failure and NULL to omit the result.

Example

Content - Crowdfunding Admin Mail

Used in files

components/com_crowdfunding/models/projectitem.php

administrator/components/com_crowdfunding/models/project.php

 

onContentBeforeDisplay

Description

This is a request for information that should be placed immediately before the generated content. For views that generate HTML, this might include the use of styles that are specified as part of the content or related parameters. Although parameters are passed by reference, this is not the event to modify project data.

Parameters

context - The context of the content being passed to the plugin - this is the component name and view - or name of module (e.g. com_crowdfinding.details). Use this to check whether you are in the desired context for the plugin.

&article- The project that is being rendered by the view.

&params - A reference to an object that provides parameters of the component.

Return Value

String. Returned value from this event will be displayed on details page the media ( picture and video ).

Example

Content - Crowdfunding Nav

Used in files

components/com_crowdfunding/views/details/view.html.php

 

onContentAfterDisplayMedia

Description

This is a request for information that should be placed immediately after the media ( picture or video ) on details page. For views that generate HTML, this might include the use of styles that are specified as part of the content or related parameters. Although parameters are passed by reference, this is not the event to modify project data.

Parameters

context - The context of the content being passed to the plugin - this is the component name and view - or name of module (e.g. com_crowdfinding.details). Use this to check whether you are in the desired context for the plugin.

&article - The project that is being rendered by the view.

&params - A reference to an object that provides parameters of the component.

Return Value

String. Returned value from this event will be displayed on details page after the media ( picture and video ).

Example

Content - Crowdfunding Share

Used in files

components/com_crowdfunding/views/details/view.html.php

 

onContentAfterDisplay

Description

This is a request for information that should be placed immediately after the generated content. For views that generate HTML, this might include the closure of styles that are specified as part of the content or related parameters. Although parameters are passed by reference, this is not the event to modify project data.

Parameters

context - The context of the content being passed to the plugin - this is the component name and view - or name of module (e.g. com_crowdfinding.details). Use this to check whether you are in the desired context for the plugin.

&article - The project that is being rendered by the view.

&params - A reference to an object that provides parameters of the component.

Return Value

String. Returned value from this event will be displayed on details page and on payment wizard, step "Share" (last step).

Example

Content - Crowdfunding Images

Used in files

components/com_crowdfunding/views/details/view.html.php

components/com_crowdfunding/views/backing/view.html.php

 

Crowdfunding Payment Events

Crowdfunding Payment events are triggered during the payment process. They are used for preparing payment plugins and processing transactions.

 

onPaymentExtras

Description

This is a request for information that should be placed on step 2 of the payment wizard.This generates an HTML and might include the closure of styles that are specified as part of the content or related parameters.

Parameters

context - The context of the content being passed to the plugin - this is the component name and wizard step name (e.g. com_crowdfunding.payment.step2). Use this to check whether you are in the desired context for the plugin.

&item - A reference to the project object.

&params - A reference to an object that provides parameters of the component.

Return Value

String. Returned value from this event will be displayed on step 2 of the payment wizard.

Example

CrowdfundingPayment - Login

Used in files

components/com_crowdfunding/views/backing/view.html.php

 

onProjectPayment

Description

This is a request for information that should be placed on the payment wizard, step "Payment". This generates an HTML code providing functionality for processing payments.

Parameters

context - The context of the content being passed to the plugin - this is the component name and wizard step name (e.g. com_crowdfunding.payment). Use this to check whether you are in the desired context for the plugin.

&item - A reference to the project object.

&params - A reference to an object that provides parameters of the component.

Return Value

String. Returned value from this event will be displayed on step "Payment" of the payment wizard.

Example

CrowdfundingPayment - PayPal

Used in files

components/com_crowdfunding/views/backing/view.html.php

 

onPaymentAuthorize

Description

This event authorize the possibility to make payment. This event will be triggered when someone continue to "step 2" and the system uses "Four Step" payment wizard.

Parameters

context - The context of the content being passed to the plugin - this is the component name and wizard step name (e.g. com_crowdfunding.payment.authorize). Use this to check whether you are in the desired context for the plugin.

&item - A reference to the project object.

&params - A reference to an object that provides parameters of the component.

&user - A reference to a user object ( JUser ).

Return Value

Returns TRUE on success, FALSE on failure and NULL to omit the result.

Example

CrowdfundingPayment - Login

Used in files

components/com_crowdfunding/controllers/backing.php

 

onBeforePaymentAuthorize

Description

This event authorize the possibility to make payment on "step 2" of the payment wizard.

If a plug-in returns content, the system will not evoke the event "onProjectPayment". It will display that content instead payment gateways, that should be initialized by "onProjectPayment".

Parameters

context - The context of the content being passed to the plugin - this is the component name and wizard step name (e.g. com_crowdfunding.before.payment.authorize). Use this to check whether you are in the desired context for the plugin.

&item - A reference to the project object.

&amount - A reference to the object Crowdfunding\Amount.

&params - A reference to an object that provides parameters of the component.

Return Value

Returns STRING on success and NULL to omit the result.

Example

CrowdfundingPayment - Fraud Prevention

Used in files

plugins/crowdfundingpayment/fraudprevention/fraudprevention.php

 

onPaymentNotify

Description

This event will be invoked when the system receives notification data from a payment gateway. That event should process the transaction.

Parameters

context - The context of the content being passed to the plugin - this is the component name, the string "notify" and the name of the payment service (e.g. com_crowdfunding.notify.paypal). Use this to check whether you are in the desired context for the plugin.

params - An object that provides parameters of the component.

Return Value

This event returns an object that contains the name and alias of the payment gateway. It also contains the following objects - project, reward, transaction and payment session.

$paymentResult = new stdClass;

{ "project" => {object}, "reward" => {object}, "transaction" => {object},
"paymentSession" => {object}, "serviceProvider" => "PayPal", "serviceAlias" => "paypal",
"redirectUrl" => "",
"message" => "",
"triggerEvents" => false };
Example

CrowdfundingPayment - PayPal

CrowdfundingPayment -Stripe Connect

Used in files

components/com_crowdfunding/controllers/notifier.raw.php

components/com_crowdfunding/controllers/payments.php

 

onAfterPaymentNotify

Description

This event will be triggered when the system completes with the processing of transaction. This will be invoked after the event onPaymentNotify.

Parameters

context - The context of the content being passed to the plugin - this is the component name, the string "notify" and the name of the payment service (e.g. com_crowdfunding.payments.checkout.stripe). Use this to check whether you are in the desired context for the plugin.

paymentResult - An object that contains data returned by the event onPaymentNotify.

params - An object that provides parameters of the component.

Return Value

None. It does not return value.

Example

CrowdfundingPayment - PayPal

CrowdfundingPayment -Stripe Connect

Used in files

components/com_crowdfunding/controllers/notifier.raw.php

components/com_crowdfunding/controllers/payments.php

 

onAfterPayment

Description

This event will be triggered when the system completes with the processing of transaction. This will be invoked after the event onPaymentNotifyNotify.

Parameters

context - The context of the content being passed to the plugin - this is the component name, the string "notify" and the name of the payment service (e.g. com_crowdfunding.notify.paypal). Use this to check whether you are in the desired context for the plugin.

paymentResult - An object that contains data returned by the event onPaymentNotify.

params - An object that provides parameters of the component.

Return Value

None. It does not return value.

Example

CrowdfundingPayment - PayPal

CrowdfundingPayment -Stripe Connect

Used in files

components/com_crowdfunding/controllers/notifier.raw.php

components/com_crowdfunding/controllers/payments.php

 

onPaymentsCheckout

Description

This event is invoked when a user makes a payment. It is used from payment services which provide preapproved payments. This event will create a preapproved transaction record.

Parameters

context - The context of the content being passed to the plugin - this is the component name, the string "payments.checkout" and the name of the payment service (e.g. com_crowdfunding.payments.checkout.paypal). Use this to check whether you are in the desired context for the plugin.

&item - A reference to the project object.

&params - A reference to an object that provides parameters of the component.

Return Value

Returns an associative array.

array(
"redirect_url" => "..." // A URL where the system should redirect the user when payment processing completes.
);
Example

CrowdfundingPayment - PayPal Adaptive

Used in files

components/com_crowdfunding/controllers/payments.php

 

onPaymentsDoCheckout

Description

This event will be executed when the system has to process preapproved payment. It is used from payment services which provide preapproved payments. This event will register a preapproved transaction in the payment service.

Parameters

context - The context of the content being passed to the plugin - this is the component name, the string "payments.docheckout" and the name of the payment service (e.g. com_crowdfunding.payments.docheckout.paypal). Use this to check whether you are in the desired context for the plugin.

&item - A reference to the project object.

&params - A reference to an object that provides parameters of the component.

Return Value

Returns an associative array.

array(
"redirect_url" => "..." // A URL where the system should redirect the user when payment processing completes.
);
Example

CrowdfundingPayment - PayPal Express

Used in files

components/com_crowdfunding/controllers/payments.php

 

onPaymentsPreparePayment

Description

This event is invoked to provide additional data to a plug-in. That will be received by AJAX request and will be used from users to continue with their payment.

Parameters

context - The context of the content being passed to the plugin - this is the component name, the string "preparepayment" and the name of the payment service (e.g. com_crowdfunding.preparepayment.mollieideal). Use this to check whether you are in the desired context for the plugin.

&params - A reference to an object that provides parameters of the component.

Return Value

Returns an associative array.

array(
"success" true, // TRUE or FALSE
"title" => "The data was...", // A message to the user
"data" => array(
"url" => "..." // A URL where the system should redirect the user when payment processing completes.
)
);
Example

CrowdfundingPayment - Mollie iDEAL

Used in files

components/com_crowdfunding/controllers/payments.raw.php

 

onTransactionChangeState

Description

This event is triggered when the administrator changes the state of a transaction. It is only invoked from back-end.

Parameters

context - The context of the content being passed to the plugin - this is the component name the name of the view (e.g.com_crowdfunding.transaction). Use this to check whether you are in the desired context for the plugin.

&item - A reference to the project object.

oldStatus - A value of the old transaction state.

newStatus - A value of the old transaction state.

Return Value

None. This event does not return any data.

Example

CrowdfundingPayment Plugin class

Used in files

administrator/components/com_crowdfunding/models/transaction.php

 

onPaymentsCapture

Description

This event is triggered when the administrator decides to process a preapproved transaction. This event should make a request to payment services to capture preapproved amount. It is invoked only from back-end by the administrator.

Parameters

context - The context of the content being passed to the plugin - this is the component name, the string "payments.capture" and the name of the payment service (e.g. com_crowdfunding.payments.capture.paypal). Use this to check whether you are in the desired context for the plugin.

&item - A reference to the project object.

&params - A reference to an object that provides parameters of the component.

Return Value

Returns an associative array.

array(
"message" => "The transaction was...", // A message to the user
"type" => "message" // The type of the message - error or message.
);
Example

CrowdfundingPayment - PayPal Adaptive

Used in files

administrator/components/com_crowdfunding/controllers/payments.php

 

onPaymentsVoid

Description

This event is triggered when the administrator decides to cancel a preapproved transaction. It is invoked only from back-end by the administrator.

Parameters

context - The context of the content being passed to the plugin - this is the component name, the string "payments.capture" and the name of the payment service (e.g. com_crowdfunding.payments.capture.paypal). Use this to check whether you are in the desired context for the plugin.

&item - A reference to the project object.

&params - A reference to an object that provides parameters of the component.

Return Value

Returns an associative array.

array(
"message" => "The transaction was...", // A message to the user
"type" => "message" // The type of the message - error or message.
);
Example

CrowdfundingPayment - PayPal Adaptive

Used in files

administrator/components/com_crowdfunding/controllers/payments.php

 

Crowdfunding Events

Crowdfunding events are triggered on step five of the project wizard. This events provides additional features managed by third-party extensions.

 

onExtrasDisplay

Description

This is a request for a code that should be included on step five of the project wizard. For views that generate HTML, this might include the closure of styles that are specified as part of the content or related parameters. Although parameters are passed by reference, this is not the event to modify project data.

Parameters

context - The context of the content being passed to the plugin - this is the component name, view and additional context phrase (e.g. com_crowdfunding.project.extras). Use this to check whether you are in the desired context for the plugin.

&item - The project that is being rendered by the view.

&params - A reference to an object that provides parameters of the component.

Return Value

String. Returned value from this event will be displayed on project wizard, step "Extras" (fifth step).

Example

Some of the premium extensions (Crowdfunding Files, Crowdfunding Partners, Crowdfunding Finance) uses this event. You will find examples in folder "plugins/crowdfunding/files".

Used in files

components/com_crowdfunding/views/project/view.html.php

Observer Events

These events are triggered by objects before or after specific action.

onBeforeProcessTransaction

Description

This event will be triggered before system process transaction by Transaction Manager.

Parameters

context - The context of the content being passed to the observer - this is the component name, view and additional context phrase (e.g. com_crowdfunding.transaction.process). Use this to check whether you are in the desired context for the observer.

transaction - An object of transaction record.

options - An array with options used in the observer event.

Return Value

It does not return any value.

Example

The observer that will be handled by Transaction Manager in payment plugins.

You will find examples in the following file.

libraries/Crowdfunding/Observer/Transaction/TransactionObserver.php

plugins/crowdfundingpayment/paypal/paypal.php

Used in files

libraries/Crowdfunding/Transaction/TransactionManager.php

 

onAfterProcessTransaction

Description

This event will be triggered when system process a transaction by Transaction Manager.

Parameters

context - The context of the content being passed to the observer - this is the component name, view and additional context phrase (e.g. com_crowdfunding.transaction.process). Use this to check whether you are in the desired context for the observer.

transaction - An object of transaction record.

options - An array with options used in the observer event.

Return Value

It does not return any value.

Example

The observer that will be handled by Transaction Manager in payment plugins.

You will find examples in the following file.

libraries/Crowdfunding/Observer/Transaction/TransactionObserver.php

plugins/crowdfundingpayment/paypal/paypal.php

Used in files

libraries/Crowdfunding/Transaction/TransactionManager.php

How to debug the system and payment plug-ins?

If there is a problem with your system and you would like to find more information about the error, you have to debug your system. That will give you more information about the problem.

  1. Go to "System" -> "Global Configuration" -> "System" -> "Debug Settings".
  2. Set to "Yes" the option "Debug System".
  3. Now go to tab "Server" and set option "Error Reporting" to maximum.

Now, the system should display information about the error.

You can also check log files in folder "/logs" or the log file "error_log" in your main folder.

The platform provides section "Logs" where you will be able to read the log files. You will also find there useful information about data that the system receives and sends, during the payment process.

How to check the PHP version and loaded PHP libraries?

You should open your Joomla! System Information. You will find the PHP version and information about loaded libraries on tab PHP Information.

Check PHP version.

Check PHP Version

 

Check installed and enabled extension PHP Intl.

Check PHP Intl

How to change PHP version on your hosting?

You will find a tool in your hosting control panel, that will give you an option to switch your PHP version to higher one.

Here you are more information.

How to change PHP version on shared servers?

PHP version change

How to change your PHP version in CPanel?

How to enable PHP Intl on your hosting?

You should look in the documentation of your hosting providers for a tool that you can use to enable additional PHP libraries.

If there is no information, you should ask your hosting support to do it for you. You can also look at Google for information.

Here you are additional information about how to enable PHP Intl using a tool "Select PHP Version" via your cPanel.

Enabling/Installing Intl Extension PHP From cPanel

How to enable PHP Fileinfo on your hosting?

You should look in the documentation of your hosting providers for a tool that you can use to enable additional PHP modules.

If there is no information, you should ask your hosting provier support to do it for you. You can also look at Google for information.

Here you are additional information about how to enable PHP Fileinfo module using a tool "Select PHP Version" via your cPanel.

How to enable PHP extension Fileinfo via Cpanel?

.htaccess enable php fileinfo extension

PHP modules and extensions on shared hosting servers

How to edit views of the extension?

If you would like to add elements or to edit the HTML code of some pages, you have to override the component views. The system provides an easy way to do that. You have to make a copy of a view in your template folder and you have to edit it.
Here you are more information about how to do it.

How to customize styles for a component page and modules?

If you would like to write styles for some elements or modules to fine-tune the appearance of your site, you should use class suffix options.

You will find more information about that feature on the following pages.

How to override the styles of the component?

Crowdfunding platform includes CSS file with some styles. If you would like to edit these styles, you should override the file.

The file is "media/com_crowdfunding/css/frontend.style.css".

To override it, you have to make a new one in a folder "css/com_crowdfunding" in your template.

For example, you have to paste the file in that folder.

templates/my_template/css/com_crowdfunding/frontend.style.css

So, the system will load the new styles instead old ones.

The styles of the components are included on line 36 in "components/com_crowdfunding/crowdfunding.php"

You will find more information about that Joomla! feature on the following pages.

How to include missed Twitter Bootstrap styles and components?

Some templates do not provide a full set of Twitter Bootstrap styles and JavaScript components. That makes your pages to look badly.

There are several solutions:

  • You can include missed styles and components in your template code manually.
  • You can include some of the missed styles and components using Crowdfunding Options. You will find a list of elements in tab "Advanced".
  • You can find a template that provides many of the standard Bootstrap elements. If you would like, you can try the templates developed by YouJoomla.
  • You can hire a designer to fix your template or to do a template for your needs. You can do it on sites for freelancers like Freelancer.com.

How to set up campaign type CSS styles?

There are options on the tab "Discover" where you can enter styles for following project types.

  • Completed Successfully
  • Completed Unsuccessfully
  • Featured campaign
  • New campaign
  • Ending Soon

How to display a campaign badge?

There is an option "Include Badge Element" on the tab "Advanced" of Crowdfunding Options. That option includes a DIV element, that contains CSS class "cf-badge",into project boxes on the views "Discover" and "Featured". You should use that element to display a badge over the campaigns.

Example:

The element is

<div class="cf-badge"></div>

You should write CSS code like the following one and to include the code in your template styles.

.completed_successfully .cf-badge {
	background: url(../images/erfolgreich.gif) no-repeat top right;
}

.completed_unsuccessfully .cf-badge {
	background: url(../images/abgelaufen.gif) no-repeat top right;
}

.featured .cf-badge {
	background: url(../images/topprojekt.gif) no-repeat top right;
}

.cf-badge {
	display: block;
	width: 200px;
	height: 200px;
	position: absolute;
	top:0;
	right:0;
}

How to disable strict errors?

If you get error message like this "Strict Standards: Declaration of CrowdfundingCurrency::getInstance() should be compatible with JTable::getInstance" you should change the error reporting option.

There are two solutions:

  • To change Joomla! option

Go to System -> Global Configuration -> Server (Tab). Select other option for "Error Reporting".

  • To change server options

Check this out - PHP 5 disable strict standards error

How to contribute code to the platform?

If you would like to contribute a code (fix an issue or add new feature), you should send pull request to the distribution of Crowdfunding Platform.

  1. You should fork the repository and clone "develop" branch on your PC.
  2. Install distribution just like do with Joomla.
  3. Create a branch, write your code and send pull request to the branch "develop".

Here you are additional information about how to contribute and create pull request on GitHub.

Share this post

Submit to DeliciousSubmit to DiggSubmit to FacebookSubmit to Google PlusSubmit to StumbleuponSubmit to TechnoratiSubmit to TwitterSubmit to LinkedIn

Free Subscription

You can get the latest publication via RSS, Twitter or Facebook. And I can also deliver last news to you for free via Email:

RSS subscription Find us on Facebook Google+ page Follow me