Pay With A Like - Different URLs for each button

I'm not sure if this has been done before, but a client requested this so I made some changes to the core plugin file, if this could be added in a future version then we won't have to be scared to update!

The request was for the Facebook and Google Like & +1 buttons to like custom URLs.

I added a couple of boxes on the post page so that these can be customised, and if they weren't customised then the websites Facebook and Google URLs would be used.

Essentially they are liking the Facebook/Google pages to unlock content site-wide.

The only problem I see with this, is that if users delete cookies, then they will have to unlike and then like the page again.

That being said the file edited was wp-content/plugins/pay-with-a-like/pay-with-a-like.php

Changes are surrounded by:

// Added by Mike
// End Added by Mike

Changes are on lines:
1277 - 1289
1334 - 1337
1390 - 1399
1482 - 1490
2020 - 2035
2142 - 2163

Here's the code:

I'm not a PHP coder so it's probably awful code, but hopefully this will help someone and maybe Paul can find a way to implement it better if this is a feature that others have requested.

  • Paul
    • The Green Incsub


    I've seen a request similar to this some months ago and told the member to put down the pipe.

    I guess I'm not understand the need or the solution on this one. If these are simple site-wide likes then what is the point of having different URLs for each buttons within the set? Seem just using random would work as well.

    Thanks Mike. Will take a look and see if we want to incorporate this in some future release.

  • Mike
    • WPMU DEV Initiate

    Thanks @Jack and @Paul, in this case they wanted the 'likers' to like the facebook page and the +1ers to like the google page so that they get more likes and +1s on their pages rather than just on the post.

    Not a common request maybe, but there might be a few who find it useful.

    As I said the only downside is that if people delete cookies they'll have to unlike before being able to like it again. But in some industries that might not be a problem, and most don't delete their cookies on a regular basis anyway.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.