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 3 months ago - 2 years 3 months ago #329953 by NFA
Hi, Is there a GJ $groupURL equivalent for $profileURL=$_CB_framework->userProfileUrl($row[user_id]);

To get the URL from a GroupJive Group we use:
Code:
$groupURL = '/index.php?option=com_comprofiler&task=pluginclass&plugin=cbgroupjive&action=groups&func=show&cat=1&grp=' . $row['id'] ;

It works, but doesn't look good. Is there a (API) way to get the groupURL in the format like below?
Code:
/menu_alias/cateogry_id-category_name/group_id-group_name
Last edit: 2 years 3 months ago by NFA.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48424
  • Thanks: 8274
  • Karma: 1443
2 years 3 months ago #329962 by krileon
Yes, the below can be used to generate links to plugins.

Code:
$_CB_framework->pluginClassUrl( 'PLUGIN_ELEMENT', true, [ PARAMETERS_ARRAY ] )

Example as follows for GJ.

Code:
$_CB_framework->pluginClassUrl( 'cbgroupjive', true, [ 'action' => 'groups', 'func' => 'show', 'id' => GROUP_ID ] )


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.

  • NFA
  • NFA
  • OFFLINE
  • Posts: 84
  • Thanks: 15
  • Karma: 0
2 years 3 months ago - 2 years 3 months ago #329973 by NFA
That makes our lives so much easier, thanks!

Now that you have put us on the right track, can we expand the scope of this question a little more with an additional question?

Is there also such a kind of API and/or a CB-substitutions way to get other GJ Group values, like logo-location, canvas-location, name, description etc. from a $GROUP_ID and/or group="#displayed"?

For example, for the 'logo' (value + directory) location. We now use SQL against #__groupjive_groups to construct something like below, but isn't that approach an amateur way with unnecessary high maintenance and system resource costs?
Code:
$groupLogo = "/images/comprofiler/plug_cbgroupjive/' . $row['category'] . '/' . $row['id'] . '/' . $row['logo'] . '" ;
Last edit: 2 years 3 months ago by NFA.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48424
  • Thanks: 8274
  • Karma: 1443
2 years 3 months ago #329987 by krileon

Is there also such a kind of API and/or a CB-substitutions way to get other GJ Group values, like logo-location, canvas-location, name, description etc. from a $GROUP_ID and/or group="#displayed"?

Yes, all our code is OOP. So there's an object for groups that contains all of that information. Below is the path to the group table object.

\CB\Plugin\GroupJive\Table\GroupTable

You can load it as follows.

Code:
$group = new \CB\Plugin\GroupJive\Table\GroupTable(); $group->load( GROUP_ID_HERE ); if ( ! $group->getInt( 'id', 0 ) ) { return; // group does not exist }

Now you can use the logo and canvas functions as follows on $group.

Code:
canvas( $thumbnail = false, $html = true, $linked = false, $classes = null ) logo( $thumbnail = false, $html = true, $linked = false, $classes = null )

Both output the full HTML by default. If you just want the URL you'd call them as follows.

Code:
$canvas = $group->canvas( false, false ); $logo = $group->logo( false, false );


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.

  • NFA
  • NFA
  • OFFLINE
  • Posts: 84
  • Thanks: 15
  • Karma: 0
2 years 3 months ago - 2 years 3 months ago #330002 by NFA
That works really nice, thank you so much!
  • When using this on a GJ Group page or the groups/category-lists, what is the way to retrieve the $GROUP_ID from the group(="#displayed")?
  • What is the best way to get all CB group members user_id's from the $GROUP_ID
Last edit: 2 years 3 months ago by NFA.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48424
  • Thanks: 8274
  • Karma: 1443
2 years 3 months ago #330010 by krileon

When using this on a GJ Group page or the groups/category-lists, what is the way to retrieve the $GROUP_ID from the group(="#displayed")?

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.

What is the best way to get all CB group members user_id's from the $GROUP_ID

You'll need to use SQL to query for that as there's no utility function for that. Eventually we'll have repository classes for pulling bulk data like that, but for now we don't in most cases.


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.

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

Moderators: beatnantkrileon
Powered by Kunena Forum