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

Problem retrieving data from Twitter

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. Your comment is awaiting moderation.

    Magnificent site. Lots of helpful info here.
    I am sending it to a few friends ans additionally sharing in delicious.
    And naturally, thanks to your effort!

  2. Your comment is awaiting moderation.

    Hello, all the time i used to check weblog
    posts here early in the daylight, because i like to gain knowledge of more and

  3. Reply

    Your comment is awaiting moderation.

    stiri paranormale si nu numai!

  4. Reply

    Your comment is awaiting moderation.

    Gear Heater: Shifting the muffler procedure could render the devices heater inoperable.

    Management of the electrical power generated by large
    industrial engines is vital to ensure safety and high performance of
    the equipment. Instead of replacing the old and worn out
    equipment or the equipment which is not environment friendly, People across the
    world, are turning towards repowering the engines.

  5. Reply

    Your comment is awaiting moderation.

    Humana People to People is a charity and an international movement that was established
    to provide development aid for those living in poverty.
    As an organization, they have done some incredible work in helping others gain self-sufficiency and
    have a pathway to economic independence.

    In Estonia, Humana People to People runs a sorting factory and 15
    shops to provide clothing to impoverished people throughout Sub-Saharan Africa.
    The sorting factory and shops helps provide work to local people in Estonia.
    Also, Humana People to People provides a variety of global educational programs in Estonia that teach schoolchildren about the
    lives of people in Asia and Africa.

    Humana People to People is well-known for it’s work in Africa, as well
    as making people in Estonia feel involved in the globally connected world.
    People in the Baltic region have been somewhat isolated from global humanitarian efforts, so Humana People to People is bringing
    them in and giving them a sense of global connectedness.

  6. Your comment is awaiting moderation.

    It also helps reduce the risk of diabetes and heart disease.

    These creamy-fleshed fruits are also loaded with tryptophan that converts to serotonin and melatonin,
    the brain’s key calming hormones. Mas himself admits in this section to certain times in his life when he to has been a victim of

  7. Reply

    Your comment is awaiting moderation.

    - Heat Resistant: Florsheim FE845 8″ Heat Resistant Flex Met Internal Metatarsal Guard Boot: Lots of things can make you hot around the collar – honey-do lists, traffic jams, and don’t forget the line at the BMV that never, ever seems to get any shorter or quicker even when you go first thing in the morning before they open only to find you’re not the genius you thought you were because every other person in town had that bright idea (we’re not bitter, we swear). “So many women have made vital contributions to the advancement ofscientific knowledge but too often in the past, as in other fields, they havebeen under-recognised.
    Well apparently there is a catch in the transport tech, and I
    guess that’s as good as the superior technology will allow.

  8. Reply

    Your comment is awaiting moderation.

    You could definitely see your skills within the article
    you write. The sector hopes for more passionate writers such as you who aren’t afraid to
    mention how they believe. At all times go after your

  9. Your comment is awaiting moderation.

    It’s appropriate time to make some plans for the longer
    term and it’s time to be happy. I’ve read this put up and if I may just I wish to counsel you few attention-grabbing things or tips.
    Maybe you can write next articles referring to this article.
    I wish to learn more issues about it!

  10. Your comment is awaiting moderation.

    Therefore, the answer to the question as to which of these two algae should you take is that
    you should definitely have both of them in your diet.

    People who find themselves participating in fat loss also need
    dietary supplements to help keep them healthy. These include quercetin, a member
    of the flavonoid family which has powerful anti-inflammatory and anti-cancer properties.

  11. Reply

    Your comment is awaiting moderation.

    Oh my goodness! Awesome article dude! Thank you so much,
    However I am experiencing troubles with your RSS. I don’t understand the reason why I am unable
    to subscribe to it. Is there anyone else getting similar RSS problems?
    Anyone that knows the solution will you kindly respond?

  12. Reply

    Your comment is awaiting moderation.

    I’ve been browsing online more than 2 hours today, yet I never found
    any interesting article like yours. It’s pretty worth
    enough for me. In my opinion, if all website owners and bloggers
    made good content as you did, the net will be a lot more useful than ever before.

  13. Reply

    Your comment is awaiting moderation.

    Hello! I could have sworn I’ve been to this blog before but
    after reading through some of the post I realized it’s new to me.
    Anyhow, I’m definitely glad I found it and I’ll be bookmarking and checking
    back frequently!

  14. Reply

    Your comment is awaiting moderation.

    Together with the launch of fashion tshirts the Religious t-shirt market advanced into printing more hip types on more exclusive style
    slice tshirts. The Religious consumer that is worrying today looks at
    the printed Religious tshirt as part of a style attire and
    not simply a promotional event share. The promotional tshirt for holiday bible college or that childhood occasion gives approach
    today for the twenty dollar adorned or printed American Clothing tshirt.

  15. Your comment is awaiting moderation.

    Hey There. I found your weblog the usage of msn.

    This is a really well written article. I’ll be sure to bookmark it
    and return to read extra of your helpful info. Thank you
    for the post. I will certainly return.

  16. Reply

    Your comment is awaiting moderation.

    Howdy I am so excited I found your blog page, I really found you
    by accident, while I was browsing on Google for something
    else, Regardless I am here now and would just like
    to say kudos for a incredible post and a all round exciting blog
    (I also love the theme/design), I don’t have time to look over it all at the minute but I have bookmarked it and also
    added your RSS feeds, so when I have time I will be back to read
    more, Please do keep up the superb b.

  17. Reply

    Your comment is awaiting moderation.

    My brother suggested I might like this blog. He was once totally right.
    This post truly made my day. You can not imagine just how so much time
    I had spent for this info! Thank you!

  18. Reply

    Your comment is awaiting moderation.

    If anyone had instructed me a couple of years back that you may truly produce meals straight out of your
    individual backyard simply by holding fish and cultivating vegetation submerged in water, I might have been completely dumbfounded.

  19. Your comment is awaiting moderation.

    Can you tell us more about this? I’d love to find out some additional information.

  20. Reply

    Your comment is awaiting moderation.

    Valuable info. Lucky mе I discovgered your web site accidentally, ɑnd I’m snocked wɦy this accident didn’t tοоk ρlace in advance!
    I bookmarked it.

  21. Reply

    Your comment is awaiting moderation.

    This site definitely has all of the information and facts I wanted concerning this subject and didn’t know
    who to ask.

  22. Reply

    Your comment is awaiting moderation.

    I delight in, cause I discovered exactly what I used to be looking for.
    You have endwd my four day lengthhy hunt! God Bless you man. Have a
    great day. Bye

  23. Reply

    Your comment is awaiting moderation.

    It means that you get total discounts at the time of
    subscription. One should keep in mind that communication lines for live support are kept open for paid accounts,
    who are given top priority. The laws have been changing and
    many portals that offer services are finding it harder and
    harder to get their word out there.

  24. Reply

    Your comment is awaiting moderation.

    Hi there, everything is going perfectly here and ofcourse every one is sharing facts, that’s truly
    excellent, keep up writing.

  25. Reply

    Your comment is awaiting moderation.

    You may get awesome lower costs by way of this place, but you’ll by no means know until you name and find out.

  26. Reply

    Your comment is awaiting moderation.

    Vesel-Mander and Kent-Rush (1974, 56) suggest that feminist counsellors use body
    therapies as a result of a great deal of women’s oppression is biological.
    At first Nasser followed a pro-Western policy and successfully negotiated
    the evacuation of British forces from Egypt in 1954.
    Bitterness is anger with no outlet to be heard or feeling that
    you can not change anything.

  27. Reply

    Your comment is awaiting moderation.

    Aw, this was a very nice post. Finding the time
    and actual effort to produce a good article… but what can I say… I hesitate a
    lot and never manage to get nearly anything done.

  28. Reply

    Your comment is awaiting moderation.

    Goood day very cool blog!! Guy .. Beautiful
    .. Superb .. I’ll bookmark your site and take the feeds additionally?
    I’m happy to find a lot of useful info here in the put
    up, we want develop more techniques in this regard, thanks
    for sharing. . .. . .

  29. Reply

    Your comment is awaiting moderation.

    First of all I would like to say great blog! I had a quick question that I’d like to
    ask if you do not mind. I was interested to know how you center yourself and clear your head prior to writing.
    I have had a tough time clearing my mind in getting my thoughts out there.
    I do take pleasure in writing however it just seems
    like the first 10 to 15 minutes are usually lost just trying to figure out how to begin. Any ideas or tips?

    Appreciate it!

  30. Your comment is awaiting moderation.

    You actually make it appear so easy together with your presentation however I find this
    matter to be actually something that I feel I might by no
    means understand. It sort of feels too complicated and extremely huge for me.
    I am looking forward for your next post, I’ll attempt to get the dangle of it!

  31. Your comment is awaiting moderation.

    Everything is very open with a clear description of the challenges.

    It was really informative. Your site is very useful.

    Many thanks for sharing!

  32. Reply

    Your comment is awaiting moderation.

    May I simply say what a comfort to find someone that truly understands what they’re
    talking about online. You definitely understand how to bring a problem to
    light and make it important. More and more people ought to read this and understand this
    side of the story. It’s surprising you’re not more popular since you definitely have the

  33. Reply

    Your comment is awaiting moderation.

    Excellent, what a weblog it is! This webpage provides valiable
    fachts to us, keep it up.

  34. Reply

    Your comment is awaiting moderation.

    Sorry, but modern petrologists’ could easily detect such.
    I believe I speak for all Sony gamers when I say, ‘Fix it, and don’t bring it back up until it’s
    secure’. Some very cool armor, weapons, and accessories are available.

  35. Reply

    Your comment is awaiting moderation.

    Link exchange is nothing else except it is only placing the other person’s
    website link on your page at appropriate place and other person will also do similar in support of

  36. Reply

    Your comment is awaiting moderation.

    I all thе time emailed tҺіs web site post ƿage to aall mʏ contacts, sincee іf likе to
    read itt after tɦаt my contacts ѡill tօo.

  37. Reply

    Your comment is awaiting moderation.

    If somе one wishes to be updated witth moxt reϲent tecɦnologies therefore he must be visit this web page and
    be up to date every day.

  38. Reply

    Your comment is awaiting moderation.

    There are a few factors you want to consider when purchasing
    a superfood drink powder. Cayenne, a natural phytonutrient derived from capsicum,
    helps support circulation. I think most of us bought into this promotional title Superfoods but when last time the ‘mortal’ continental
    cucumber was claimed to be one of the Superfoods,
    I woke up.

  39. Reply

    Your comment is awaiting moderation.

    Whether or not you’re constructing a non-profit site or possibly a
    company web site, WordPress would not charge a fee for something, forever.
    While there are genuine charity websites, there are also numerous scammers who would do anything to rob money out of innocent people.
    Because of the nonprofit status, you should determine
    how and where you will keep the articles of incorporation, bylaws and all meeting
    minutes for review by any member of the community the nonprofit serves.

  40. Reply

    Your comment is awaiting moderation.

    Thanks for the marvelous posting! I actually enjoyed reading it, you
    could be a great author. I will be sure to bookmark your blog and will eventually come
    back at some point. I want to encourage you to continue your great writing, have a nice weekend!

  41. Reply

    Your comment is awaiting moderation.

    My brother recommended I might like this website. He was once entirely right.
    This publish actually made my day. You cann’t imagine simply how mjch time I had spent for
    this information! Thanks!

  42. Reply

    Your comment is awaiting moderation.

    Hi to every one, since I am in fact keen of reading tthis weblog’s post to be updated regularly.
    It includes nice information.

  43. Reply

    Your comment is awaiting moderation.

    It’s nearly impossible to find knowledgeable people about this subject, but you
    seem llike you know what you’re talking about! Thanks

  44. Reply

    Your comment is awaiting moderation.

    Un extrême remerciement à l’auteur dս site web

  45. Reply

    Your comment is awaiting moderation.

    This is the right blog for anyone whoo wants to understand this topic.

    You realize so much its almost hard to argue with
    you (not that I really would want to…HaHa).
    You certainly put a fresh spin on a topic which has been discussed
    for years. Excellent stuff, just excellent!


Leave a Comment