Advertisement:

Author Topic: [MOD][PENDING] Anti-Adblock Plugin for SMF - My first SMF plugin  (Read 82161 times)

Offline die2mrw007

  • Jr. Member
  • **
  • Posts: 266
    • GizmoLord on Facebook
    • @Gizmo_Lord on Twitter
    • GizmoLord
I just tried my hands on making a SMF mod...it is a simple mod with basic logic.
I dont know what are the changes with SMF v1.xx, so the mod is basically done keeping SMF v2.xx in mind...

Anti-Adblock is a plugin to display a small tootip message for abblock users asking them to disable the adblock plugin for your site and support the ad revenue contribution.

Original Post: http://forum.gizmolord.com/smf/anti-adblock-plugin-for-smf-2-0

I wanted someone to check this mod and confirm if its working fine with the theme they have installed on their forum. I have already checked with my test forum, but cant confirm as I might not tried with some extreme case themes which you may have installed on your forum.

I may try to make this using hooks later after studying it. Also I will try to implement some more features which can be managed via admin panel in future updates. One such being the ability to change the pre-defined notice to custom notice which accepts user input.
« Last Edit: August 09, 2013, 08:01:24 AM by Gary »

Offline ApplianceJunk

  • SMF Hero
  • ******
  • Posts: 3,474
    • ApplianceJunk.com
Re: [MOD] Anti-Adblock Plugin for SMF - My first SMF plugin
« Reply #1 on: August 13, 2012, 01:20:44 AM »
Installed on local host using MAMP with Safari.

Showed this at the top of site.

Quote
Anti-Adblock Javascript by die2mrw007 : http://forum.gizmolord.com
Anti-Adblock Javascript by die2mrw007 : http://forum.gizmolord.com
No AdBlock Plus detected! Thanks for truly supporting our site.Close

I click on close and it still shows this at the top.

Quote
Anti-Adblock Javascript by die2mrw007 : http://forum.gizmolord.com
Anti-Adblock Javascript by die2mrw007 : http://forum.gizmolord.com


Other mods I had installed.
2.   Add Join Date to Post    1.0 
3.   NoFollow BBCode

Once I uninstalled NoFollow BBCode and tried installing your mod again I no longer had the funny text at the top left, but instead seen a alert bar at the top center for a second.

Not running ad blocking software right now. May test it out more later.

Offline ApplianceJunk

  • SMF Hero
  • ******
  • Posts: 3,474
    • ApplianceJunk.com
Re: [MOD] Anti-Adblock Plugin for SMF - My first SMF plugin
« Reply #2 on: August 13, 2012, 01:25:00 AM »
Ok, installed Safari adblocking extension.
http://safariadblock.com

Seen larger pop up at top center of screen for just a split second and it was gone.
Not sure what it even said.

Offline die2mrw007

  • Jr. Member
  • **
  • Posts: 266
    • GizmoLord on Facebook
    • @Gizmo_Lord on Twitter
    • GizmoLord
Re: [MOD] Anti-Adblock Plugin for SMF - My first SMF plugin
« Reply #3 on: August 13, 2012, 01:45:34 AM »
Ok, installed Safari adblocking extension.
http://safariadblock.com

Seen larger pop up at top center of screen for just a split second and it was gone.
Not sure what it even said.
Actually its a cookie based plugin....when you close the notification it wont popup thereafter until you restart the browser(its actually present there but gets hidden)


Did you experience any installation errors with this mod?
And for which SMF themes you installed this apart from curve theme?
I tried this with Curve theme, Inferno theme by dzinerstudio

Offline ApplianceJunk

  • SMF Hero
  • ******
  • Posts: 3,474
    • ApplianceJunk.com
Re: [MOD] Anti-Adblock Plugin for SMF - My first SMF plugin
« Reply #4 on: August 13, 2012, 01:56:43 AM »
SMF 2.0.2 with curve theme.
No install error, but some errors in SMF log.

Erros in log after install, during use and after uninstalling it.
I kept clearing the log to try and see when the errors come up, but it was a different number of errors each time.

I would see the two different pop ups at the top of the site all the time.
The smaller one when I did not have a adblocker running and a larger pop up when I had the adblocker running.

Every time I went to a different page or refreshed the page the bar would flash at the top of the screen. It was so fast I could not read what it said. Turned on my screen recorder to record it so I could pause the recording and read it, but with the screen recorder running the pop up bar would not show up, lol...

I'm probably not being much help, sorry.


Offline ReaperX

  • Semi-Newbie
  • *
  • Posts: 12
Re: [MOD] Anti-Adblock Plugin for SMF - My first SMF plugin
« Reply #5 on: August 13, 2012, 06:21:25 AM »
I didn't installed it, just looked at code.
In anti-adblock.xml you could replace:
Code: [Select]
<script type="text/javascript" src="' . $settings['default_theme_url'] . '/advertisement.js"></script>';?><?php
Code: [Select]
<script type="text/javascript" src="' . $settings['default_theme_url'] . '/advertisement.js"></script>';
I don't think that you need to close and open PHP tag..

second thing, if you adding scripts using $context['html_headers'] then you don't have to add those scripts in index.template.php, so i would remove first operation for this file
« Last Edit: August 13, 2012, 06:37:14 AM by ReaperX »

Offline cicka

  • Sophist Member
  • *****
  • Posts: 1,280
  • Gender: Female
Re: [MOD] Anti-Adblock Plugin for SMF - My first SMF plugin
« Reply #6 on: August 13, 2012, 07:22:40 AM »
Congratulations with your first mod for Smf :)

Have you considered to submit it at the mod site?

Offline die2mrw007

  • Jr. Member
  • **
  • Posts: 266
    • GizmoLord on Facebook
    • @Gizmo_Lord on Twitter
    • GizmoLord
Re: [MOD] Anti-Adblock Plugin for SMF - My first SMF plugin
« Reply #7 on: August 13, 2012, 03:45:50 PM »
Congratulations with your first mod for Smf :)

Have you considered to submit it at the mod site?
I didnt think of it yet...and it isnt yet perfect for submission in my view.
BTW, how is the submission process? Where I will need to post when its ready for submission?

Offline die2mrw007

  • Jr. Member
  • **
  • Posts: 266
    • GizmoLord on Facebook
    • @Gizmo_Lord on Twitter
    • GizmoLord
Re: [MOD] Anti-Adblock Plugin for SMF - My first SMF plugin
« Reply #8 on: August 13, 2012, 03:52:13 PM »
I didn't installed it, just looked at code.
In anti-adblock.xml you could replace:
Code: [Select]
<script type="text/javascript" src="' . $settings['default_theme_url'] . '/advertisement.js"></script>';?><?php
Code: [Select]
<script type="text/javascript" src="' . $settings['default_theme_url'] . '/advertisement.js"></script>';
I don't think that you need to close and open PHP tag..

second thing, if you adding scripts using $context['html_headers'] then you don't have to add those scripts in index.template.php, so i would remove first operation for this file
Ooops, I forgot to remove those ?><?php from the final code...my test forum was behaving weird after adding the set of javascripts in header (the font size at board index was displaying enlarged)...so I was playing out with some assertions..

And yeah, Exactly...I wasnt really aware of certain file behavior until Arantor guided me in appropriate way.
I added those certain bits of code to Load.php only as some set of code were'nt getting "catch" in find/replace method in the package making of SMF plugin due to different theme base (Core and curve). When approaching Load.php, it couldnt click my mind that I could continue with the edits at Load.php itself

Offline cicka

  • Sophist Member
  • *****
  • Posts: 1,280
  • Gender: Female
Re: [MOD] Anti-Adblock Plugin for SMF - My first SMF plugin
« Reply #9 on: August 13, 2012, 03:56:23 PM »
Congratulations with your first mod for Smf :)

Have you considered to submit it at the mod site?
I didnt think of it yet...and it isnt yet perfect for submission in my view.
BTW, how is the submission process? Where I will need to post when its ready for submission?

Here is the submission link

http://custom.simplemachines.org/mods/index.php?action=postmod;sa=new

If there will be anything that will need correcting the Customizing Team will let you know so you can apply the changes needed.

Offline die2mrw007

  • Jr. Member
  • **
  • Posts: 266
    • GizmoLord on Facebook
    • @Gizmo_Lord on Twitter
    • GizmoLord
Re: [MOD] Anti-Adblock Plugin for SMF - My first SMF plugin
« Reply #10 on: August 13, 2012, 04:00:34 PM »
Congratulations with your first mod for Smf :)

Have you considered to submit it at the mod site?
I didnt think of it yet...and it isnt yet perfect for submission in my view.
BTW, how is the submission process? Where I will need to post when its ready for submission?

Here is the submission link

http://custom.simplemachines.org/mods/index.php?action=postmod;sa=new

If there will be anything that will need correcting the Customizing Team will let you know so you can apply the changes needed.
Thanks a lot buddy :)

BTW, under what category this mod falls in?

Offline Suki

  • Customizer
  • SMF Super Hero
  • *
  • Posts: 15,097
  • Kaizoku Jotei
    • MissAllSunday on GitHub
    • SMF mods
Re: [MOD] Anti-Adblock Plugin for SMF - My first SMF plugin
« Reply #11 on: August 13, 2012, 05:18:21 PM »
Thank you for your mod die2mrw007, have you consider it to use the Mod Development board  to release your mod?

Its basically similar to upload it to the modsite, the difference is, the review will be done by the community and the team as a whole.
Look at them. They're just asking for it. Maybe the human race deserves to be wiped out.

Online vbgamer45

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,366
    • smfhacks on Facebook
    • VBGAMER45 on GitHub
    • @createaforum on Twitter
    • SMF For Free
Re: [MOD] Anti-Adblock Plugin for SMF - My first SMF plugin
« Reply #12 on: August 13, 2012, 05:38:18 PM »
Great idea can't wait to see how well it works with detection.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Offline PLAYBOY

  • SMF Hero
  • ******
  • Posts: 2,019
  • Livephotoshop.com & Lullabyabc.com
    • Lullabies and Us
Re: [MOD] Anti-Adblock Plugin for SMF - My first SMF plugin
« Reply #13 on: January 27, 2013, 04:06:12 PM »

Very nice idea. This would work out so good and be very useful for many people.
Are there any updates on this?

Offline bladesb

  • Semi-Newbie
  • *
  • Posts: 34
  • Gender: Male
    • Blades and Bushcraft Forum
Re: [MOD] Anti-Adblock Plugin for SMF - My first SMF plugin
« Reply #14 on: April 10, 2013, 10:01:01 PM »
I am curious too. Just had members of my forum begin blocking ads and my revenue is down. This would be a huge help.
SMF 2.0.4, "Green Bean" Theme

Offline dimspace

  • Jr. Member
  • **
  • Posts: 343
    • @dimspace on Twitter
    • Velorooms.com
Re: [MOD] Anti-Adblock Plugin for SMF - My first SMF plugin
« Reply #15 on: April 20, 2013, 09:03:40 PM »
In the absence of the mod being finished, heres a small peice of code I use on my site.

This was shamelessly lifted from playonlinux.com

Code: [Select]
<p id="ads">

<--REPLACE THIS WITH ADSENSE CODE-->

</p>

<script type="text/javascript"><!--
if(document.getElementsByTagName("iframe").item(0) == null)
{

document.write("<div style='width:250px; height:250px; padding-top: 10px; margin-left:5px;border:1px solid #666666; color:#FFF; background-color:#666; text-align:center; font-family:Maven Pro,century gothic, arial, helvetica, sans serif;padding-left:5px;padding-right:5px;border-radius:7px;font-size:18px;'>Advertising seems to be blocked by your browser.<br /><br /><span style='font-size:12px'>We would appreciate it if you would whitelist this site as we depend on ads to fund our server fees, domain costs etc. </br></br>Alternatively please consider donating towards our costs and receive 12 months ad free membership. Many thanks</span></br></br><img src='http://i38.tinypic.com/10z4hz6.png' alt='Adblock Plus' /></div>");
};
--></script>

Then set the styling to match the ad in question, dimensions etc.

This basically puts a hidden panel behind the add as demonstrated in the screenshots.

In the example its grey, but it could equally be a plain background with text.

As a note, I would advise only using it once per page at most. Users who dont block ads dont mind seeing ads, users who block ads dont want their browsing experience ruined by countless messages. Once is enough.

Offline winniethepooh

  • Jr. Member
  • **
  • Posts: 100
  • Gender: Male
  • Rookie Helper
    • https://www.facebook.com/the.cookie.monstar on Facebook
    • @1337pose on Twitter
    • Search N-JIN
Re: [MOD] Anti-Adblock Plugin for SMF - My first SMF plugin
« Reply #16 on: April 20, 2013, 09:47:48 PM »
In the absence of the mod being finished, heres a small peice of code I use on my site.

This was shamelessly lifted from playonlinux.com

Code: [Select]
<p id="ads">

<--REPLACE THIS WITH ADSENSE CODE-->

</p>

<script type="text/javascript"><!--
if(document.getElementsByTagName("iframe").item(0) == null)
{

   document.write("<div style='width:250px; height:250px; padding-top: 10px; margin-left:5px;border:1px solid #666666; color:#FFF; background-color:#666; text-align:center; font-family:Maven Pro,century gothic, arial, helvetica, sans serif;padding-left:5px;padding-right:5px;border-radius:7px;font-size:18px;'>Advertising seems to be blocked by your browser.<br /><br /><span style='font-size:12px'>We would appreciate it if you would whitelist this site as we depend on ads to fund our server fees, domain costs etc. </br></br>Alternatively please consider donating towards our costs and receive 12 months ad free membership. Many thanks</span></br></br><img src='http://i38.tinypic.com/10z4hz6.png' alt='Adblock Plus' /><>");
};
--></script>

Then set the styling to match the ad in question, dimensions etc.

This basically puts a hidden panel behind the add as demonstrated in the screenshots.

In the example its grey, but it could equally be a plain background with text.

As a note, I would advise only using it once per page at most. Users who dont block ads dont mind seeing ads, users who block ads dont want their browsing experience ruined by countless messages. Once is enough.
Wow, that is a great idea dimspace. thanks for your contributions!
"But I'm tryin' Ringo.I'm tryin' real hard to be the Shepherd."

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 68,065
    • Arantor on GitHub
Re: [MOD] Anti-Adblock Plugin for SMF - My first SMF plugin
« Reply #17 on: April 20, 2013, 09:56:44 PM »
Of course, anyone who just uses NoScript isn't going to see the ads either ;)

(Quick reply works just fine without JS, so it's entirely possible to visit forums and reply without it enabled.)
To assume is to hope that those who came before had the presence of mind and capacity to implement the dreams of those who would come after.

You either die a hero or live long enough to see yourself become the villain. It seems you have chosen which, and now I must do the same.

Offline winniethepooh

  • Jr. Member
  • **
  • Posts: 100
  • Gender: Male
  • Rookie Helper
    • https://www.facebook.com/the.cookie.monstar on Facebook
    • @1337pose on Twitter
    • Search N-JIN
Re: [MOD] Anti-Adblock Plugin for SMF - My first SMF plugin
« Reply #18 on: April 20, 2013, 10:09:03 PM »
Of course, anyone who just uses NoScript isn't going to see the ads either ;)

(Quick reply works just fine without JS, so it's entirely possible to visit forums and reply without it enabled.)
You really are a wealth of information Arantor. I'm sorry for bein a *jerk* earlier. maybe i can learn to keep my mouth shut and i might learn something  :D
"But I'm tryin' Ringo.I'm tryin' real hard to be the Shepherd."

Offline dimspace

  • Jr. Member
  • **
  • Posts: 343
    • @dimspace on Twitter
    • Velorooms.com
Re: [MOD] Anti-Adblock Plugin for SMF - My first SMF plugin
« Reply #19 on: April 21, 2013, 07:10:02 PM »
Of course, anyone who just uses NoScript isn't going to see the ads either ;)

(Quick reply works just fine without JS, so it's entirely possible to visit forums and reply without it enabled.)

yeh, theres that as well..

To be honest, ads are a really sore point with me.. The sites that go mental on ads just encourage people to use ad blockers, which hurts the small sites that depend on a handful of well placed ads for revenue..

THat said.. never run a small website or forum unless you can afford to pay for it yourself..