Disable "My Classified Ads list" menu tab when users who can't create ads view own profile
| Project: | Classified Ads |
| Version: | 6.x-2.0-alpha5 |
| Component: | User interface |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs work |
Jump to:
I see this issue has been raised for the 5.x version, but not 6.x.
The "My Classified Ads list" tab shows up in a user's profile regardless of whether the user can or cannot create ads. I've looked at the previous discussions, so I understand why this is happening. Here's why I don't want this to happen: I would like to use Classified Ads as a "premium" feature for my site...a bonus they get for doing other things. They will use the Classified Ads to put up special offers and the like.
Access to creating and editing Classified Ads is role-based.
This pretty much falls apart if every user sees a "My Classified Ads list"....even a non-functional one...when they access their own account. It's also confusing; a tab item for a list of ads that will always be empty.
It seems this should be an easy tweak, but I haven't been able to figure it out. Is there a simple way to turn it off for a user's own profile when the user doesn't have access to creating ads?

#1
Fixed in -dev. Will be in next release. Users will only see a "My Classified Ads List" if they have permission to create, edit, or reset ads.
Cheers,
Miles
#2
Thanks. Maybe I'll be able to crack open the .module and see how you did it.
I'll download the -dev and check it out. This is a handy little module. I notice you're considering re: integrating with Ads, but to me, as an end user, the functions are quite different. I've got my ad blocks. Classified Ads gives me an additional, and quite useful, content type. Just my two cents...and God knows, we all know what the dollar's worth these days.
#3
@drupup: Just pull down the alpha6 release, the modification is included in that. All I've done is surround the user hook with a check to see what permissions they have. Very simple change. You need to be sure to flush your cache though.
I'm no longer considering any merge with the Advertisement module, the modules aren't on a convergent path at this time. I took over as maintainer of the Views module for Advertisement to start to see how it ticks and realised that they're chalk and cheese. I've been short of time the last few months but am keen to make a big push soon on new features for ed_classified and get it into Beta.
Cheers,
Miles
#4
hmmmm.....still showing. I've double-checked permission setup, flushed the cache (you GOTTA flush that cache!). Let me keep testing; I'm at the end of my day here in the 'states and ready to call it a night.
I think I've found a wee bug: if no ads have been created, the Classified Ad module forgets to print all the content, which for my site makes for a bit of formatting trouble, since without all the I end up with a headless rounded rectangle. Traced it to line 458 in the function ed_classified_page. If I changed this:
$ads[] = node_load(array('nid' => $node->nid));
}
to this:
$ads[] = node_load(array('nid' => $node->nid));
}
if (!isset($ads[0])) {
$ads[0] = 'There are no ads available in this category';
}
In other words, give it SOME content, and I got the full writeup, though it put "n/a" rather than my text. As you can tell, I'm a hacker, not a programmer. Sorry if this should have been a separate issue.
#5
Okay, came back, did a complete uninstall and reinstall, used the alpha, double-checked everything, and it's still showing up for everyone who is an authorized user. However, if I took the "create classified ads" permission and made it the access argument, it does what I want.
319 'access arguments' => array('create classified ads'),
I really need to learn how to do this module stuff properly. Apologies that these posts have been a bit all over the place.
#6
!!! I'll have a look at it. Reopening.
Cheers,
Miles
#7
Just checking in to bump this issue back up a bit.