I need help with regular expressions or Access Level (Membership with Classifieds)


My environment is BuddyPress, Membership, and Classifieds.

I've tried researching and understanding regular expressions, and I grasp the basic ones - like http://domain.com/dir/(.*)

But the more involved expressions have my head reeling! So I beg of you not to send me to Regex site. I've been to many and can't figure out how to do what I need. I have likewise searched this site.

I'm running Membership with Classifieds and I wish to do some specific URI blocks.

My Visitor and Basic Membership members are not to have access to the ability to create classified ads. The problem is that Basic Membership members are still able to get to their own dynamic URL http://domain.com/members/username/classifieds/my-classifieds/ and anything else beyond the username dynamically created directory.

Even though I can limit roles within Classifieds such that Basic Members cannot create ads, they nonetheless can get to /members/USERNAME/classifieds/my-classifieds, logically surmise that they can create an ad, then run into issues as they create the ad, but still manage to post it. This is terribly confusing to a user at Basic Membership level. To them it looks like a feature is broken.

If I place http://quiltersbug.com/classifieds/(.*) into a URL Group to fall under "negative" for an access level, it fails when a site member navigates to their BuddyPress profile to their profile and sees "Classifieds" as a menu item. The may natural think, "Oh! I can create a classified."

I can't not simply hide the Classifieds menu via CSS, because this will deprive my Premium Membership members from using that feature as well. Furthermore, even if I *DO* hide the Classifieds menu, there are other ways through normal navigation that a Basic Membership member (without the privilege to create ads) can still find their way to a screen to create ads.

I'm hoping that I can place an expression into a URL Group that will block access to http://doman.com/members/USERNAME/classifieds/ - but I cannot determine a code or variable to insert into my express that can pickup the directory portion that becomes the username.

Ideally, there would be a feature within through Membership Access Levels that was "Classifieds Plugin Aware" that would allow us to simply block access to creating classifieds, but without this, an expression that could understand the USERNAME portion of http://doman.com/members/USERNAME/classifieds/ would presumably work.

Is there an expression for this?

And even if an expression exists, I'll then be interested to see what happens in the following scenario: A Basic Membership member who is permitted to view ads, but not permitted to create ads, visits their BuddyPress profile - they will likely still see the Classifieds menu item within their profile. I wonder what will happen when they click on it? Ideally, they will get a "clean looking" message or screen that explains that they do not have that privilege with their current membership.

Thank you to anyone who can help me resolve this. :slight_smile: