TinyPass Split Pays for WordPress – Mark 2

No Comments

This last week, Akilez Web Solutions was asked to revisit the modifications we made to the TinyPass plugin for WordPress. This time, our new client was looking to have multiple paywalls set-up with specific tags associated to different authors, and wanted to provide split pays for each author or in this case, a paywall targeting a specific author’s tag.

TinyPass Logo We were intrigued at the idea of taking a new shot at this terrific plugin. We had offered a solution in January that allowed for one split to be made in “Pay-per-Post” mode only. This was an effective modification an greatly benefited our previous client, however we were left a bit unsatisfied. We knew the modifications that we made would work, however, they were made in a bit hackish and all to incomplete manner.

What Were We Thinking?

First off, only one split pay? This made no sense, TinyPass’ plugin provides three pay options in both Paywall and PPP modes. What if a user wanted to have a different user get a split based on the pricing option elected by the client? What if a user wanted to give multiple splits of a pay option to multiple people? A furtherexamination of the code certainly seems to support this. Secondly, why limit the modification to just the PPP side of things? And lastly the modifications should be made to the plugin in a manner that is more consistent with its original coding, not hacked in and looking like a half thought out, last minute addition.

Our Refocused Aim

Never Forget to Set GoalsSo, we started out with three goals in mind:

  • Make the split pay options universal to both the “Paywall” and “Pay-per-Post” modes.
  • Allow for multiple split pays for each pricing option. (Incidently we also wanted to include code that didn’t limit the number of split pays in the way the number of price options is limited to three.)
  • Better integrate the modifications with the existing plugin.

We were of course successful, there wouldn’t be this post had we not. So once again we’d like to walk you through the changes we made and why.

In our previous modification we were working with TinyPass version 2.0.9. This time we started out with TinyPass 2.1.5. By version 2.1.5 there had been significant changes, multiple paywalls, better interface and quite a bit of bug fixing. However the 2.1.5 core file remained largely unchanged. This time we also  made modification to three files* in the TinyPass 2.1.5 plugin. Let’s Begin!
*For those paying attention, we claimed the last modification edited four files, however only three were mentioned or modified. :)

The Modification

Once again the process begins in the tinypass-form.php file. This incidentally is the only file that can be edited from the built in plugin editor provided in WordPress, It would behoove you to try these edits in a coding environment or simply a text editor.

Adding the split pay form

Starting with the most significant changes, directly after the __tinypass_price_option_display function we added the following function:

* Display split-pay options
function __tinypass_splitpay_display($opt, $email, $split, TPPaySettings $ps) { ?>
<label>Email</label><br />
<input type="text" size="15" name="tinypass[<?php echo "po_splitemail$opt" ?>][]" value="<?php echo $email ?>"><br />
<label>Split</label><br />
<input type="text" size="12" name="tinypass[<?php echo "po_splitpay$opt" ?>][]" value="<?php echo $split ?>">
<p style="display:inline">%</p><br /><br />
<a href="#"><?php _e("Remove") ?></a>
<hr />
<?php }

This will become our split pay form with removable “splits”. Note  we used a multidimensional array for the email addresses (tinypass[<?php echo "po_splitemail$opt" ?>][]) and the split percentages (tinypass[<?php echo "po_splitpay$opt" ?>][]). These are linked to the individual price option they are going to be displayed with. Also, we will use the “Remove” link to dynamically allow you to delete a split.

Next, we needed to add the split pay form cell to the price option display. In the __tinypass_price_option_display function, after the last <td> tag we added the following:

<td width="140" rel="<?php echo $opt; ?>">
$splits = $ps->getSplits($opt);
if (!empty($splits)) {
foreach($splits as $key => $value) {
echo __tinypass_splitpay_display($opt, $key, $value, $ps);
} ?>
<br />
<a href="#"><?php _e('Add') ?></a>

This adds our new form elements to the pricing option display form. The new (to be created) getSplits function will give us our splits in a nicely usable key-value array, which you can see we use to display previously entered splits. The “Add” link will be used to duplicate the form elements for adding multiple splits to a single pricing option. Because we are adding a new cell to the pricing options table, we decided to change the “Captions’ <td> width to 160 instead of 270. Honestly the best way to make this change is a “replace all” for  270 to 160 as it changes many places where that width is given. Next,  you will need to find:

<th width="100"><?php _e('Price') ?></th>
<th width="380"><?php _e('Length of access') ?></th>
<th width="160"><?php _e('Caption (optional)') ?></th>

Add the Header :

<th width="140"><?php _e('Splits (optional)') ?></th>

Then find:

<th width="100"><?php _e('Price') ?></th>
<th width="180"><?php _e('Length of access') ?></th>
<th width="160"><?php _e('Caption (optional)') ?></th>

and modify these headers to:

<th width="100"><?php _e('Price') ?></th>
<th width="180"><?php _e('Length of access') ?></th>
<th width="163"><?php _e('Caption (optional)') ?></th>
<th width="150"><?php _e('Splits (optional)') ?></th>

Once done, the pricing options table will display nicely in “Paywall” mode as well as in “PPP” mode. The odd values for the header make thing align in Firefox and honestly we didn’t care what happened to them in other browsers. It wasn’t technically in our goals to make the display cross browser compliant. (See the importance of setting goals in the beginning?)

Modifying the Pay Settings to Use Split Pays

This time around, we realize that we didn’t need to “do” anything special to make sure the split pay emails and percentages were saved along with the rest of the pay settings. So we didn’t need to add any complicated accessors and code to the  validation code. Nonetheless modifications to the TPPaySettings.php file are still necessary. So we added:

const AUTHOR_EMAIL = 'po_splitemail';
const SPLIT_PAY = 'po_splitpay';

under the list of price options constants. Note these are the same strings used in the form code we just added only without the price option integer.

Then amid the wide and varying public functions, we added our getSplits function:

public function getSplits($i) {
$var = array();
$index = 0;
$splits = $this->data->val(self::SPLIT_PAY . $i);
$emails = $this->data->val(self::AUTHOR_EMAIL . $i);
if (!empty($emails)) {
foreach($emails as $email) {
$var[$email] = $splits[$index++];
return $var;

As, promised the function will return the emails and split percentages in a key-value array that can be easily parsed by the form and other places. The data is already in the pay settings variable since TinyPass’ developers simply stored the array returned from the form(s). Silly us for not realizing that the first time around. There admittedly may be better ways we could have stored the data or presented it back but this is more than sufficient.

After all this is in place the last step in the process was to add our splits to the price offer. As last time the addSplitPay function already existed but was never used by TinyPass developers. So we added:

$splits = $ps->getSplits($i);
if (!empty($splits)) {
foreach($splits as $email => $split) {

to the create_offer function near the bottom of the TPPaySettings.php file after the line:

$po = new TPPriceOption($priceString);

Wiring Up the Form’s “Add” and “Remove” buttons.

At this point you might note we are not able to see a “Remove” button, a split pay form field and that the “Add” does nothing of worth. All of that is handled by modifications we will make in the tinypass_admin.js Javascript file located int the tinypass/js folder. At the top of this file we added:

jQuery("body").on("click", "a.removeSplit", function(event){
jQuery("body").on("click", "a.addSplit", function(event){
var opt = jQuery(this).parent().attr('rel');
var html = '<div>';
html += '<label>Email</label><br />';
html += '<input type="text" size="15" name="tinypass[po_splitemail' + opt + '][]" value="" /><br />';
html += '<label>Split</label><br />';
html += '<input type="text" size="12" name="tinypass[po_splitpay' + opt + '][]" value="" />';
html += '<p style="display:inline">%</p><br /><br />';
html += '<a href="#">Remove</a>';
html += '<hr />';
html += '</div>';


This jQuery code has two functions bound to the <body> element of the code that tell the system to add a “click” event to any existing or dynamically added “addSplit” class <a> tags. This is important since the “PPP” mode form doesn’t exist when you enter the post’s edit screen. Without this delegated binding using jQuery’s .on() function,  we would be stuck using much more complicated code to dynamically add and remove our split pay form elements.

The remove code is simple. It simply fades out and remove from the DOM the <a> tag’s parent div and with it the split form elements.

The add code adds a near match for the code we added in our first step to the containing div by checking the <div> tag’s  ‘rel’ attribute for the price option’s numeric value. Check the code we added at he beginning. you’ll see that we made sure to add it just for this occasion.

Ad with that the modifications are done. All of our goals are met and the result is a function plugin extending TinyPass’ version 2.1.5 plugin to include split pay capability. Thanks to our client for his patience and for bringing us this project and we hope this will serve you as well.

This is author biographical info, that can be used to tell more about you, your iterests, background and experience. You can change it on Admin > Users > Your Profile > Biographical Info page."


About us and this blog

We are a full service agency that deliver compelling digital marketing solution. Our winning solutions and experience helps to deliver great results across several key areas.

Sign up for our newsletter!

Recent Tweets

Request a free quote

We offers professional SEO services that help websites increase organic search drastically and compete for 1st page rankings of highly competitive keywords.


sidebar widgets

More from our blog

See all posts
No Comments
  1. Reply

    Your comment is awaiting moderation.

    A location’your home, or a convenient meeting place’will be agreed upon, as well.

    Many times, we have a car that no 1 would want to buy at all.
    Taking an old car off the road and recycling it should be good for the environment, but only if it’s done in the
    right way.

  2. Reply

    Your comment is awaiting moderation.

    If some one desires to be updated with most up-to-date technologies therefore he must be pay a visit this website and be up
    to date all the time.

  3. Reply

    Your comment is awaiting moderation.

    Hello to all, the contents present at this web page are truly remarkable for people knowledge, well, keep up the nice work fellows.

  4. Reply

    Your comment is awaiting moderation.

    It could or may not be section of their story quest, so keep an optical vision out – usually in case
    you are near a dock with a lot of rowboats, which means the quest giver/change in is nearby.

  5. Reply

    Your comment is awaiting moderation.

    This paragraph offers clear idea in support
    of the new visitors of blogging, that in fact how to do running
    a blog.

  6. Your comment is awaiting moderation.

    Great blog you’ve got here.. It’s hard to find high quality writing like yours nowadays.
    I truly appreciate people like you! Take care!!

  7. Reply

    Your comment is awaiting moderation.

    money lenders g9q instant online loans fkx quick loans rg4 instant loans d4e payday loans no credit check
    cgi cash loans t5n cash advance 5b2 installment loans
    m67 loans for bad credit 09h quick cash v3v small loans 6hm personal
    loans 9cd title loans obx car title loans 0h1 car title
    loans zai online gambling 0ea online casino b02 slot machines o04 online roulette z3f casino games ri7 casino bonus 3ye online casino bonus tib best online casino wkk online gambling casino mo5
    play casino

  8. Your comment is awaiting moderation.

    Like I said, they’re popular in business, and a VPN can actually
    be used to increase your security on unsecured networks.
    Free netflix offers are provided easily nowadays
    via online and get netflix free trial from this website:.
    However, this doesn’t mean that you don’t have full access to your account it’s all there.

  9. Reply

    Your comment is awaiting moderation.

    And approximately 20% of the children who die in a car
    accident each year are killed in accidents involving a
    driver who is legally intoxicated. An auto accident lawyers file output, follow the complex legal producers and all other
    issues of the clients to present their client part and
    help them in the best possible manner. When an auto accident occurs because of another driver’s actions
    and irresponsible behavior, you- as the victim, will have the right to claim damages payment.

  10. Reply

    Your comment is awaiting moderation.

    Wow, thios post is pleasant, myy sister is analyzing these
    things, therefore I am going to inform her.

  11. Your comment is awaiting moderation.

    Acting professional and singer Patrick Bruel seemed to be one
    of France’s biggest stars through the ’90s, first making his name like a teen idol and leading a positive to traditional French chanson in the new millennium.
    Bruel came into this world Patrick Benguigui within Tlemcen, Algeria, on, may 14, 1959.

    Their father abandoned your family when Patrick was
    merely a year old, and 1962, after Algeria received its independence, his
    mom moved to France, residing inside Paris suburb connected with Argenteuil.
    A good soccer player in his youth, Patrick first chosen the idea of as being a artist having
    seen Michel Sardou perform in 1975.

    As fortune might have it, acting would bring him his first accomplishment; first-time
    overseer Alexandre Arcady ran an advertisement seeking an adolescent man along with a French-Algerian (or “pied-noir” in People from france slang) accent for his picture Le Coup fuente
    Sirocco. Benguigui (as having been still called) responded and acquired the part.

    The year, he spent a while in Nyc, where he met Gérard Presgurvic, later to be his most important composer.

    Source: http://jumppage.biz/http://patrickbrueltour.wordpress.com/

  12. Your comment is awaiting moderation.

    The E5 offers much in the way of connectivity boasting WLAN for a fast internet connection, along with Wi-Fi; while it offers fast data connections also by way of
    the Bluetooth 2. The large game files of a few hundred megabytes or one or two
    gigabytes can be downloaded from internet within few minutes.

    Ironically, this rule doesn’t seem to apply when the racers cause
    frequent accidents between other innocent bystanders driving legally or the
    cops who frequently wreck when giving chase.

  13. Reply

    Your comment is awaiting moderation.

    When this combination occurs, ALL of the same color candies turn into stripes and simultaneously go off.
    If your game has levels, it should be easy enough for you to add a button to the store from the
    screen that notifies the user about a successful level completion. This
    means that you must estimate how many cheat codes for candy crush saga on facebook bars you will need.

  14. Reply

    Your comment is awaiting moderation.

    If is for these reasons that you might want to freeze your chocolate.
    You have got to operate hard to scale from the stage.
    The game Candy Crush Saga can be fun and frustrating at the same time.

  15. Reply

    Your comment is awaiting moderation.

    Special emphasis will be placed on the Muslim Brotherhood and its actions
    in perpetuating its brand of militant Islam.
    Learn the content and safety settings of your gaming consoles.
    Families, yea, even whole nations who had no
    access to water, were a people destined for trouble, or even extinction.

  16. Reply

    Your comment is awaiting moderation.

    Hello to every one, the contents present at this site are really remarkable
    for people experience, well, keep up the good work fellows.

  17. Reply

    Your comment is awaiting moderation.

    Thanks for a marvelous posting! I truly enjoyed reading
    it, you are a great author.I will ensure that I bookmark your blog and may come back in the future.
    I want to encourage you to continue your great posts, have a nice evening!

  18. Reply

    Your comment is awaiting moderation.

    This site definitely has all of the info I needed about this subject and didn’t know who to ask.

  19. Reply

    Your comment is awaiting moderation.

    Great post however , I was wondering if you could write a litte more on this topic?

    I’d be very grateful if you could elaborate a little bit further.

  20. Reply

    Your comment is awaiting moderation.

    I have read a few just right stuff here. Certainly worth bookmarking for revisiting.
    I wonder how much attempt you set to create one of these
    magnificent informative website.

  21. Reply

    Your comment is awaiting moderation.

    Chances are you will have to remove loan through either your relatives or nearest
    bank institution You should, nevertheless, borrow your money
    at cut-throat rates and with no further cost to help make the repayment fewer burdensome Just because you’re practicing physician does not mean that you’re of the same quality because all the other medical practitioners Every mortgage lender just desires to security with the
    funds he or she is lending and wants a assure to pay for this
    borrower This specific service could prove to be invaluable to you so as you don’t get yourself inside over your head down the road Sometimes
    if you can not plan well through the four week period,
    you will find that you do not have money to pay for rent The particular scenario would be
    the property marketplace is no different Though online application process can guide you to get low-cost rate together with
    bendable account options A mortgage loans will probably typically always be for a pre-determined value
    of the property The indegent credit factors are just brushed aside because the job seekers are ready to endanger
    the conditions of bad credit loans that are acceptable help of the particular finance throughout the tough time
    Some company owners may not be capable of sell their business,
    in particular when they are a new franchised business,
    without worrying about permission of your franchisor Through Web, you can evaluate the interest
    fees provide by way of different businesses and opt for the lender that fits you the best Most of
    these loans are cash advance loans and thus need to be repaid 100 %
    by your upcoming payday This is a good apply and helps to hold person from serious credit debt issues It’s not easy for those who have surfaced believing you receive a job and
    purchase a house for you to swallow tough fact that buying
    a home not only seriously isn’t realistic for the children, but which the dream of proudly owning might also
    be kitchen counter to long-term fiscal well-being
    Mac no cheese or perhaps Ramen are extremely cheap and easy to generate, a staple for students all over the
    world A study of the house market styles from the beginning in the century indicates an interesting pattern Any secured
    credit-based card means that you may have money on downpayment with that standard bank matching a person’s line of credit
    in the case of default He must be a person of Great britain and he need to be over 17
    Aside from your name and call information, the loan providers will require the main points and proof
    your career Stock Sign up ‘ An ebook used to document all issuances
    with sequential in addition to chronological
    order as a type of internal control measure; consequently providing many details of
    the making or issuances

    • Uwe
    • October 9, 2014

    Your comment is awaiting moderation.

    Amazing! Its truly remarkable post, I have got much clear idea
    regarding from this paragraph.

  22. Your comment is awaiting moderation.

    I was suggested this website by my cousin. I’m
    not sure whether this post is written by him as nobody else know such detailed about
    my problem. You’re amazing! Thanks!

  23. Reply

    Your comment is awaiting moderation.

    Incredible points. Solid arguments. Keep up the great work.

  24. Your comment is awaiting moderation.

    Spot on with this write-up, I absolutely believe this
    amazing site needs much more attention. I’ll probably be returning to read through more, thanks for
    the advice!

  25. Reply

    Your comment is awaiting moderation.

    Su studiopensiero.it trovate uno dei portfolio riguardanti i servizi fotografici matrimoniali più richiesto di Roma.

  26. Reply

    Your comment is awaiting moderation.

    Cerchi un fotograsfo per matrimonio a Roma? Lo trovi ssu studiopensiero.it, insieme a mole informazioni e consigli presenti sul blog dello studio.

  27. Reply

    Your comment is awaiting moderation.

    whoah this weblog is wonderful i like studying your posts.
    Stay up the great work! You realize, many people are hunting around for this information, you can aid them greatly.

  28. Your comment is awaiting moderation.

    WOW just what I was looking for. Came here by searching for local home improvement

  29. Reply

    Your comment is awaiting moderation.

    Good web site you have got here.. It’s hard to find
    high quality writing like yours nowadays. I honestly
    appreciate individuals like you! Take care!!

  30. Your comment is awaiting moderation.

    It’s remarkable to go to see this website and reading the
    views of all friends on the topic of this piece of writing, while I am also keen of getting experience.

  31. Reply

    Your comment is awaiting moderation.

    Adsense is actually a really great program for those who maintain blogs, as blogs get updated all the time and the Adsense possibilities
    are almost limitless. These pre-computed numbers, hold on in a very giant information bank for millions
    or URLs on the net. * Page SEO: Your page is optimized by various means which include, choosing the
    right keywords, placing them right, adding anchor text
    linking, adding call to action in various places on the page.

  32. Your comment is awaiting moderation.

    continuously i used to read smaller articles or reviews that also clear their motive, and
    that is also happening with this article which I am reading at this place.

  33. Reply

    Your comment is awaiting moderation.

    Hi there friends, its fantastic piece of writing about tutoringand
    completely defined, keep it up all the time.

  34. Reply

    Your comment is awaiting moderation.

    After spending her life focused on her career as a cabaret
    singer, Shaw realizes that she just didn’t have time to be
    courted by a man and get married. You can receive
    the next one directly into your email by clicking “SUBSCRIBE” at the top of the page.
    It is, therefore, vital to help those retaining muscles to return to their
    pre-pregnancy size if you wish to avoid a prolapse of
    your womb, rectum or vagina.

  35. Reply

    Your comment is awaiting moderation.

    A lot of damages, some irreparable, are brought about by
    cybercrime. You will nonetheless connect it by way of USB, Wi – Fi or
    Bluetooth. It’s more of the same decent gameplay with a
    great visual upgrade and a pretty cool overhaul of the class and progression system.

  36. Reply

    Your comment is awaiting moderation.

    Good post. I learn something new and challenging on sites I stumbleupon everyday.
    It will always be interesting to read through articles from other writers and use
    a little something from other sites.

  37. Reply

    Your comment is awaiting moderation.

    It is usually worthwhile to ask how rapidly the dumpster may
    be despatched to the work site. The thirty yard dumpster is
    the optimal dimension.

  38. Your comment is awaiting moderation.

    What’s Happening i’m new to this, I stumbled upon tjis
    I’ve discovered It positively useful and itt has helped me
    out loads. I amm hoping to give a contribution & assist
    other customers like its hellped me. Great job.

  39. Your comment is awaiting moderation.

    Williams says that there are “self-identified vampires” that concern them selves as followers of Dracula.
    Return to Northrend and complete all of the Argent Tournament Dailies.
    I personally like the ability to upgrade and create new
    weapons from those I already have.

  40. Your comment is awaiting moderation.

    NOTE: Wireless signals are able to pick up on the up the nose implant and a picture may
    be taken of the individuals thought or focus. But if you embrace and accept them, then you be free in your hopes, your
    desires, and life. Suzanne is hosting “Winter in Yosemite: Experience the Deep Peace and Power of the Place” weekend writing workshop from Friday, March
    12, 5 pm through Sunday, March 14 at noon.

  41. Reply

    Your comment is awaiting moderation.

    It’s nearly impossible to find educated people for this topic, but you sound like you know what you’re talking about!


Leave a Comment