Skip to Content Skip to Menu

[SOLVED] Is there a cleaner API/substitution way to get GJ data from $GROUP_ID?

  • NFA
  • NFA
  • OFFLINE
  • Posts: 84
  • Thanks: 15
  • Karma: 0
2 years 4 months ago - 2 years 4 months ago #330023 by NFA

Using it where? If in CB Auto Actions you'd need to provide what trigger you're using as the group object may already be available. Worst case you just get the value from GET as group id will be in the URL.

We use it in our own created PHP code, some in modules on the GJ Group page. These modules resist in a sidebar of the Joomla template, outside the GJ and CB templates. In the past, we indeed used:
Code:
if(isset($_GET['gid'])){ $GROUP_ID = $_GET['gid']; } else { $GROUP_ID = $_GET['id']; }
But this doesn't work anymore, since you learned to us (last week) to create nice GroupJive SEF URL's like
Code:
/menu_alias/cateogry_id-category_name/group_id-group_name
We were even busy to create menu items for every group (with CB Auto Action - PHP) but given this we maybe have to keep the default GroupJive SEF URL's and use the code below?
Code:
$GROUP_ID = strtok(basename(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)), '-');
Or do you know a better way to get GROUP_ID from the current displayed group? You have really spoiled us on CB Profile pages with things like
Code:
[cb:userdata field="user_id" user="#displayedOrMe" /]
and we now miss that kind of power on GJ Group pages ;-)

You'll need to use SQL to query for that as there's no utility function for that.

Okay, thanks!

P.s.: @Kyle/Krileon: Thank you so much for helping me to figure out the most efficient way to get this kind of things done in GroupJive! As I will use these kinds of things a lot.
Last edit: 2 years 4 months ago by NFA.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48541
  • Thanks: 8290
  • Karma: 1445
2 years 4 months ago #330031 by krileon
I can't really help you with writing your custom PHP especially outside the scope of CB as you'll have no access to our APIs unless you load our API in as instructed in the below tutorial.

www.joomlapolis.com/documentation/279-community-builder/tutorials/18357-including-cb-api-for-usage-outside-of-cb

You can still get the group id from GET, but it's not "gid" it'll just be "group" or "id" depending on where you are. You can then pass that to pluginClassUrl if you loaded CBs API.


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: NFA

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

Moderators: beatnantkrileon
Powered by Kunena Forum