Skip to Content Skip to Menu

How to check CB-usergroup from PHP?

  • mikerotec
  • mikerotec
  • OFFLINE
  • Posts: 347
  • Thanks: 28
  • Karma: 2
8 years 8 months ago - 8 years 8 months ago #288964 by mikerotec
How to check CB-usergroup from PHP? was created by mikerotec
I'm hacking together some mods to JomClassifieds, which for our purposes seems to be the most suitable of all the 'CB-aware' joomla classifieds out there.
We want our 'free' users to view ads, but only our "paid' users to be able to post.
Currently, we can do that by protecting "Post an Ad" URL (and a couple of others) with CBsubs plan.

But in addition to posting ads, we want our "paid" users to also be able to purchase some of the optional upgrades built in to JomClassifieds.
(they have their own purchasing function which works fine)
Sadly, I just found out that out of the box, the JomClassifieds requires 'public' access for the "post an Ad' menu item, or else Paypal crashes and burns whenever a user attempts to buy a 'premium' ad. So it turns out that I can't just protect the 'post an ad' URL with CBsubs. :S

With future maintenance in mind, I am trying to keep mods to the JomClassifieds extension to a minimum...

So it seems that rather than mess around with relocating the paypal API stuff, it would be simpler to just display a simple 'You must purchase Paid subscription to post" (etc) block at the top of the page, and disable posting buttons - based on the logged-in user's CB usergroup.

Is there a handy doc on how to detect the CB usergroup somewhere?
Last edit: 8 years 8 months ago by mikerotec.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 49447
  • Thanks: 8467
  • Karma: 1465
8 years 8 months ago #288966 by krileon
Replied by krileon on topic How to check CB-usergroup from PHP?
CB just uses Joomla ACL. So you can use Joomla API to check for usergroups to avoid needing to load CB in your 3rd party extension. If your extension already has the functionality to block certain things via usergroups or view access levels then I'd jut give the user the necessary usergroups using CBSubs or if you need to give them multiple usergroups a Usergroup action in CB Auto Actions.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
The following user(s) said Thank You: mikerotec

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum