Categorie ‘Making / Made Money’ » Archiv


0

Taming the Upgrades plugin from http://premium.wpmudev.org

February
2

If you’re lucky enough to have a subscription to Premium WPMU Dev account then you’ll have access to great monetization plugins like the Upgrades or Supporter which take all the pain out of providing a ‘pay for’ service that can handle payments through Paypal, Google or even Amazon gateways.

I downloaded and installed the upgrades plugin a while ago and I’ve used it to monetize certain parts of my ComLuv site. There’s the usual way of adding plugins to the Upgrades directory and configuring them to be used which I’ll go into in a future post but I wanted to use the system slightly differently, and that was to charge users for adding new URLs to an account or to add default links to their returned list of posts.

The advantage of premium

Some of the advantages to using wpmupremium plugins is the support you receive, knowledge that the plugin will be updated to keep it compatible with new changes and my favourite is, the quality of the code.

When you’re getting premium, you’re getting premium code which for me personally, has taught me a LOT about how wordpress works. Particularly custom hooks and actions and filters. That was always a mystery to me until I dissected the plugins I downloaded from their site so it was a breeze to modify the upgrades plugin to work for users who don’t have blogs and start using the internal functions in a daughter template to do what I wanted.

Modifying the upgrades plugin


I needed to allow the upgrades menu to show for regular users because not everyone who joins the Comluv site starts a blog. This was just a simple case of changing the user level so that everyone, not just blog owners can see the menu and buy credits.

There are two places to modify:

/mu-plugins/upgrades-framework.php
line ~ 197-200 (upgrades plug pages framework function)
change add menu and submenu calls to

add_menu_page($upgrades_branding_plural, $upgrades_branding_plural, 0, 'upgrades.php');
add_submenu_page('upgrades.php', __('Credits'), __('Credits'), 0, 'credits', 'upgrades_credits_output' );
add_submenu_page('upgrades.php', __('History'), __('History'), 0, 'history', 'upgrades_log_output' );

line ~ 1919 (upgrades_credits_output function)
change user check to

if(!current_user_can('level_0')) {

Creating the daughter template

Adding another page you can use as a template is pretty easy, you just need to create a new php file in your theme directory and make sure it has the correct remarks at the top to identify it as a template page.


/*
Template Name: ComLuv purchase url
*/

Next just copy and paste the main calls from another template, you’ll be deleting most of it like the loop to display posts and replacing it with your own hard coded form and text. Be sure to keep the divs that surround the content intact.

I wrote a description of the item being sold and added a form.
(DON’T copy and paste from this page, I had to remove the beginning < characters from the code so it displays properly)

form action='/member/additional-urls/' method="POST">
input name="addurl" type="text" size="30"/>
input type="submit" name="submit1" value="Submit"/>

/form>

I also added a finish_page() function which just closes the /div tags so I could easily break out of what I was displaying without rendering the rest of the custom code below it.

You set the action to the page slug you’re publishing the page as and put a nonce field in there so you can check it with the next bit of code to prevent a naughty user from trying to call the purchase directly.

Handling the purchase

Next, you need to handle the data that gets submitted by your form and do the magic with the users credits.

if(isset($_POST['submit1'])){
$nonce=$_REQUEST['_wpnonce'];
if(!wp_verify_nonce($nonce,'addurl1')){
echo 'Page request deformed, please go back and try again. (b1s1)';
finish_page();
}
if(!$_POST['addurl']){
echo 'Please go back and enter a value';
finish_page();
}
// check if user has enough credits
global $user_ID;
$credits = upgrades_user_credits_available($user_ID);
if($credits < 3){
echo 'h2>Error - Insufficient Credits/h2>';
echo 'p>You will need to purchase some credits to register another URL, you currently have strong>'.$credits.'/strong>';
echo 'p>a href="/wp-admin/upgrades.php?page=credits">Click here to visit the purchase page/a>';
finish_page();
}
// if we're here then everything is ok to provide service and deduct credits
$credits = upgrades_user_credits_available($user_ID);
$credits -= 3;
upgrades_user_credits_update($credits);
upgrades_log_add_msg($user_ID,'You paid 3 credits for an additional URl - '.$url);
do_add_url($url,$user_ID);
echo 'h2>Site added, 3 credits used on your account/h2>';
echo 'p>You have '.$credits.' credits remaining';
echo 'p>a href="/member/additional-urls/">Click here to refresh the page/a>';

The first bit gets the nonce you created and checks it and displays an error message if it doesn’t match
Next, check the field you’re expecting and spit out an error if it is empty.
Next, check the user has enough credits and spit out an error if they don’t.
If everything is fine, continue.

use $credits = upgrades_user_credits_available($user_ID); to get the users current credits total
use upgrades_user_credits_update($credits); to set the users credits total to $credits (after you deduct what your item/upgrade costs)
use upgrades_log_add_msg($user_ID,’You paid 3 credits for an additional URl – ‘.$url); to add a message to the users Credits history page so they know they used some.

That’s it, easy peasy! Here’s an idea, use credits to sell digital downloads on another page, just check and deduct the users credits before allowing a dowload.

I’ll post a follow up to this soon on how to use the upgrades plugin to add a new package that enables the RSS widget for a blog (I’ll show you how to disable the rss widget too)

You can get over 100 plugins and themes of premium quality at http://premium.wpmudev.org and they all help to make your wpmu site better than the jones’s :)

Blog Tools, Making / Made Money, PHP, Wordpress


9

Text links work to make Fired Wok number 1 Oriental Food Delivery

January
9

A customer came in to the takeaway we run and mentioned that he got to our website (Fired Wok Chinese Takeaway) only after he added the word ‘takeaway’ to his search term.

Confusing because, I was quite pleased with how the SERPS are for Firedwok and ‘chinese takeaway lancaster‘ which results (at time of writing) to this..

Straight on the map and number 1 on results (with added tags)

It turns out that he was searching for ‘oriental food delivery lancaster’ which made the site past page 5 on the results!

Bring on the featured links!

A few days or weeks ago, ComLuv got put up to PR6 on the homepage from Google. How nice! I mentioned this in the email newsletter and within a few hours, two links were sold on the sidebar for 30 days each. One with a subscription! woot!, might this be the first month Comluv pays for itself? lol

I thought I’d take advantage of this PR increase and put a text link for ‘oriental food delivery lancaster’ on with the paid ones and left it a while. In the meantime, I put some more posts on the blog portion of the takeaway website and put in some ‘oriental food’ references on the homepage.

Got me some SERPs

And now, a search for ‘oriental food delivery lancaster’ results in a number 1 position (and number 2)

1 portion of SERPS please

Very happy with my text link purchase, and because I own the site it means it was free! haha :-)

I guess I can take it down now, it’s done it’s job and it can make some space for another paid ad.

It’s not just me

A paid customer bought a link for UK payday loans back when that search term had them after page 10 (I tested it when they first bought the link) and now that term results in them being on page 1 of google.

They even asked why I had no subscription option for the ads! I switched it on and straight away, I had 50$ per month subscriptions coming in. Very nice!

Get YOU some links

If I can sell a few more links on subscription, I’ll have enough to upgrade the server to more memory and a faster processor. It’s typical that the first time the site has made enough money to pay for it’s own server and bandwidth, it reaches capacity again and needs upgrading! lol. what a fun ride!

You can buy featured homepage links and network wide footer links on the ComLuv page here

Blog News, Making / Made Money, ecommerce