Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Sponsorship is one of the most important features of the phpFox platform. Purpose of this tutorial is to provide some guideline for developers who want to integrate this feature with their apps.

Sponsor in app's block

...

#

Name

Description

1

can_sponsor_app

Can members of this user group mark a an app as Sponsor without paying fee?

2

app_sponsor_price

How much is does the sponsor space worth for app? This works in a CPM basis.

3

auto_publish_sponsored_app

After the user has purchased a sponsored space, should the app be published right away? . If set to No, the admin will have to approve each new purchased sponsored app space before it is shown in the site.

 

Note: replace app with your app's alias

 

 

Sponsor methods

phpFox provides 2 sponsor methods: Sponsor without fee and Purchase sponsor.

...

When can_sponsor_app is Yes, user users of that user group can sponsor item without paying fee.
All you have to do in your app is mark item as sponsor by database query and don't forget to add sponsor via function addSponsor() in class Ad_Service_Process.

...

Code Block
actionscript3
actionscript3

{permalink module='ad.sponsor' id={item-id} section={app}}

 

Note: replace app with your item app alias and item-id with your item id.

If your app has multiple items, please replace app with app_item (Ex: music_song, music_album, ...)

 

Code Block
actionscript3
actionscript3

...

{permalink module='ad.sponsor' id={item-id} section={app_item}}

Callbacks

Belows is all required callbacks when integrating your app with Ad Sponsor.

...

Code Block
actionscript3
actionscript3

{url link='ad.sponsor' where='feed' section='app' item={item-id}}

 

Note: replace app with your item app alias and item-id with your item id.

If your app has multiple items, please replace app with app_item (Ex: music_song, music_album, ...)

 

Code Block
actionscript3
actionscript3

...

{url link='ad.sponsor' where='feed' section='{app_item}' item={item-id}}

Un-sponsor action

To un-sponsor an item, we usually use ajax call

Code Block
javascript
javascript

$.ajaxCall('ad.removeSponsor', 'type_id={app}&item_id=`item-id`', 'GET');

 

Note: don't forget to replace app/app_item and app-id

Or we can use function deleteSponsor of class Ad_Service_Process.

 

Code Block
php
php

...

Phpfox::getService('ad.process')->deleteSponsor($iSponsorId, true);

Check sponsored item

To check sponsored item, you can use function canSponsoredInFeed of class Feed_Service_Feed. This function will return true if item is sponsored.

Code Block
php
php

Phpfox::getService('feed')->canSponsoredInFeed({app}, {app-id});

...