After my previous problem of getting a unknown function stripos() - which was arbitrarily deleted twice by the admins here without an answer - I found out in the Internet that stripos() works only for PHP 5 and I should change it to strpos. That was so easy to answer, why did you need to just ignore my question and delete it without an answer?
And BTW, the above is a BUG!!! You should have it working with every PHP version.
Done the change and the module stopped crashing.
However, despite the fact that I am trying to get a CSE search box, I only get a box written "Google Adsense" in the first line and "Adsense for Search" in the following line, with no search box.
I have gone through the options, filled the publisher ID and the slot-id, and nothing.
Would like to understand where I am going wrong and what is missing, and not to have my post deleted.
Thanks in advance.
Helio
Comments
Comment #1
jcnventuraIt wasn't deleted.. It's still there and correctly marked as a duplicate, which is the appropriate status for that issue. Change the filter from 'open' to 'any' and you'll be able to see them. FYI, it is impossible to delete any issue, so even if I wanted to do it (which I did, with the second one), I wouldn't be able to do it.
The module, as configured by default prevents you, as the admin user, from seeing the ads. Try logging out and you should see them fine.
João
Comment #2
heliod commentedThanks for the explanation. I couldn't find it on the duplicate either so I assumed it was deleted.
I did not understand which filter to change from Open to Any.
And in the first phase, when I am testing the module to see if I can even work with it, I would prefer that the administrator would be the ONLY user to see it. This is something that should not be hardcoded in the module, but something to be using with the Drupal authorization system.
Thanks for the patience. I will be waiting for the details.
Helio
Comment #3
heliod commentedJoao,
Thanks for your help. I really managed to get it working for non-administrators and it works well.
I have one problem left: My regular user in the site is the administrator user, and I need the module to work for it as well.
Is there any way I can do that?
TIA,
Helio
Comment #4
jcnventuraThe module doesn't allow for that possibility.. Google's terms are that you should not cause page views in your own site, so that the reason why it's hardcoded, and that's the reason why the module won't be changed.
To do this in your site, you'll have to edit _adsense_check_if_enabled(), add a check for $user->uid == 1 and return TRUE in that case.
João
Comment #5
heliod commentedHi, Joao,
This seems to me strange - if I put the Google CSE code in my site I will be able to search even if I am the administrator of the site.
Why would they force you to prevent the administrator from searching.
At this very moment, I have two search boxes on my site - one for everybody (using your module) and one for the administrator only (using Google's original code) - the only difference between them is that the last shows the result in a separate page without design. Is it so bad that I want to see it formatted just as all my users?
Seams to me very illogical. I would like to understand why.
BTW, I tried to hardcode the check you have suggested, but it did not work. It seems there must be some additional check if the user has the role of administrator in order to prevent it in this way as well. Additionally, my UID is 2, but I have the administrator role.
Thanks for your help.
Helio
Comment #6
jcnventuraSimply put, they ask you to not create page impressions (https://www.google.com/adsense/support/bin/answer.py?hl=en-uk&answer=18203). You may get your account disabled if you create too many page impressions, or click on an ad by mistake.
In order to protect the admins of Drupal sites using this module from having the account disabled, the admin is not shown any ads, nor is he able to use the adsense units. The CSE code provided by Google is not intelligent enough to know this, but this module is and we take advantage of this information.
If you want to use the AdSense features, logout of your account, and test the ads. And replying to your question, it is indeed bad that you want to see your AdSense searches. You shouldn't be using them in the first place, and may lead to your AdSense account being disabled and losing all your earnings.
As to the fact that your UID is 2.. You should have mentioned it before. Drupal grants all permissions to user 1, but for user 2, these must be specifically set by his role. One of the permissions for this module is 'hide Adsense'. You probably have it set, and as configured, ads are not shown to you.
João
Comment #7
heliod commentedI understand what you say, however I believe the administrator should also have the right to search for material in his own site. The idea is not to create volume of clicks or to make money, it is just to search the posts on the site.
Anyway, I understood you are not the person I need to discuss this with.
Thanks and best regards,
Helio