Hey all,

I've got a client using this module and they've just asked me to hide the ad nodes from public view. The concern they have is that the Status, Statistics, Click History etc are visible for the world to see.

I've tried blocking this using node_access and content_access but this also blocks the ads from being available.

Looking through the code I'm seeing that it appears there is a permission system in place to block the display of this. I'm looking in ad.pages.inc at theme_node_ad(). There is a check for the 'access statistics' permission, but I'm not finding any way of assigning this to a user or role.

Am I missing something here or is this not implemented yet?

If it is, can someone point me at the path to set this (and show me where I should be able to see this link)?

If it's not implemented yet, I could edit here and attach a patch for it. I'm not sure of the reasoning behind the custom ad_permissions() function and in this case I would add the 'access statistics' to the hook_perm() and check via user_access().

Regards,
Gold

CommentFileSizeAuthor
#19 ad.module.patch478 byteslazly
#17 ad.module.patch576 byteslazly

Comments

MantasK’s picture

You need to enable "Ad Owners" module.
But then not necessary tabs appears, I hide them in template.php

hanamizuki’s picture

Even when I enable "Ad Owner", the ad node is still public...
Could someone explain why?

cerup’s picture

I have the same issue.

The node that the ad is in is public. The statistics and other things are not. However, the node itself should not be made public and only accessibly to owners.

PeterEmanuel’s picture

I'm chiming in - and hope a fix will be made available.
Ad nodes should not be displayed as "pages", only using views and blocks. The recommended fix to add the no-index meta tag makes no sense. Only the owner and/or admin should be able to access the node, for everyone else: 404 (if they somehow find the url).

Peter

perforator’s picture

+1

DynamicFred’s picture

unsubscribe please

maverick14’s picture

+1

cerup’s picture

A hacky way to do this is to set the ad node to unpublished, but the ad status to active. When you set it to unpublished, it'll auto set it to expired. Once it does that, go back in and set it to active which will leave it unpublished and unvieweable to other users. Not a good solution, but it worked in my tests.

Lowell’s picture

I agree, not a good solution. The not published/active state hides the node from ad owners as well.

I found that if I only display the $node->content['ad']['#value'] variable for that node through content templates, then I only lose the up front statistics and status messages, yet ad owners can still access the reports tab for the same statistics.

For non-ad-owners, all they get is the node title and image presented as an ad.

Satisfactory solution for now.

In the future, it would be nice to access these variables using views and then filter based on ad owner and other ad status values.

maverick14’s picture

For me, enabling the ad_owners module does it.

john franklin’s picture

The Ad Owners module will remove the statistics, but the page remains. You can also get a list of all ads in a category by clicking the tag at the bottom. On a test site, I am able to do this as an anonymous user.

alcoder’s picture

I think you can solve this with the Rules module.

You add a triggered rule: Content is going to be viewed
Set the conditions: Content has type Advertisement, Acting user is not the same as content author, Acting user doesn't have the "Editor" role
Action: for example do a redirect to the front page

osopolar’s picture

You can also use ctools page_manager to redirect away from the ad node or display the access denied page.

skh’s picture

Another alternative, also not 100% ideal.. could replace the goto with drupal_access_denied etc if preferred.

function MYMODULE_nodeapi(&$node, $op, $arg3, $arg4){
  switch ($op){
    case 'view':
      if($node->type == 'ad' && !user_access('administer advertisements')) {
          drupal_goto('<front>');
      }
    break;
  }
}
quinns’s picture

Just wanted to confirm that I was able to use the Rules module as outlined by #13. Good tip.

lazly’s picture

Status: Active » Needs review
StatusFileSize
new576 bytes

Its a huge problem for me, so i wrote a patch for it to ad.module file. Please check it and commit to source. Thx

lazly’s picture

Priority: Normal » Major
lazly’s picture

StatusFileSize
new478 bytes

Sorry, previously version was a little buggy, use this patch.

Riki_tiki_tavi’s picture

Confirm the problem. I don't use Ad Owners module, so ads on my site with all details (!!!) are in public.

It's a big problem.

I set the option which add "noindex" meta tag, but google bot ignores it and already gobbled up a lot of Ads and their details :(

I think the best way to resolve this is to split the "show advertisements" permission for showing ads and viewing nodes with all details.

lrwebks’s picture

Issue summary: View changes
Status: Needs review » Closed (outdated)

Drupal 6 is EOL and no longer supported. Closing this as outdated for that reason. Thanks for your contribution!