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 #2
jonathan1055 commentedForgot to change the status.
| Status | File | Size |
|---|---|---|
| new | 1819510-3-placeholder_permission-d7.patch | 1.76 KB |
| new | 1819510-3-placeholder_permission-d6.patch | 1.66 KB |
Works well. I've made a couple minor changes:
- "show placeholder" is to generic a permissions, changed to "show adsense placeholders".
- Placeholders also output "Ads disabled for site admin", so I've also changed that to use
$user->name. - Also included a D7 version.
- RTBC as these changes are minor and the new permission works as expected.
Thanks for the patch..
Nice to see the work you're putting into the module atm @jcnventura thanks!
It's polishing up, so that I can start work on porting it to D8.. I did a sorry job of updating it to D7. :)
Automatically closed -- issue fixed for 2 weeks with no activity.
Comment #1
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()