Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
On a live site, I have found it useful to disable google ads and show the placeholder for specific users who are
not site admin. These are users which run and manage the site, are on it a lot of the time and do not want to be exposed to accidentally clicking on the live ad. But they need to see where they are placed, and check that all is correct.
I created the new permission 'show placeholder' which can be assigned to any role as usual. It is checked in adsense_display() in addition to when the entire site ads are disabled and/or the user is the site admin. Patch to follow.
Comment | File | Size | Author |
---|---|---|---|
#1 | _1819510_1.adsense.placeholder_perm.d6.patch | 1.25 KB | jonathan1055 |
#3 | 1819510-3-placeholder_permission-d6.patch | 1.66 KB | fenstrat |
#3 | 1819510-3-placeholder_permission-d7.patch | 1.76 KB | fenstrat |
Comments
Comment #1
jonathan1055 CreditAttribution: jonathan1055 commentedHere is the patch against 6.x-1.4 as that is what I am using in production.
It applies ok to the latest dev but with offsets.
Three functions are changed: hook_perm(), adsense_display() and _adsense_check_if_enabled()
Comment #2
jonathan1055 CreditAttribution: jonathan1055 commentedForgot to change the status.
Comment #3
fenstratWorks well. I've made a couple minor changes:
$user->name
.Comment #4
jcnventura CreditAttribution: jcnventura commentedThanks for the patch..
http://drupalcode.org/project/adsense.git/commit/b4b6d2a
Comment #5
jonathan1055 CreditAttribution: jonathan1055 commentedYour welcome. Thanks for committing.
Comment #6
fenstratNice to see the work you're putting into the module atm @jcnventura thanks!
Comment #7
jcnventura CreditAttribution: jcnventura commentedIt's polishing up, so that I can start work on porting it to D8.. I did a sorry job of updating it to D7. :)
Comment #8.0
(not verified) CreditAttribution: commentedfix typo