Skip to Content Skip to Menu

🎃 Happy Halloween! Treat yourself with an awesome discount on memberships! Get 20% off now with code SPOOKY-2024!

[SOLVED] GroupJive Event expiration

  • mjplowcha
  • mjplowcha
  • OFFLINE
  • Posts: 30
  • Thanks: 1
  • Karma: 0
11 years 8 months ago #221322 by mjplowcha
Replied by mjplowcha on topic GroupJive Event expiration
How can I view the array for 'grp_access' in the $row ? Once it is all put together as an array within an array, I am having trouble getting the results to output. (just not enough experience yet). I think that is the step I am missing. Ideally I just need to verify that the person joined the group and then use that info to filter out the events so it will only display affiliated groups for the user.

I can see everything I need in SQL as far as the groups and the members in them. 'grp_access' seems the most logical place to look for that data, but I am clueless as to how to echo that data so I can see what it is and use it for my filter.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48459
  • Thanks: 8280
  • Karma: 1443
11 years 8 months ago #221353 by krileon
Replied by krileon on topic GroupJive Event expiration
The first variable is access controls, they're built into GJ. Check the getAuthorization function in GJs class file for the various access, they're all commented with what the grant access to. The various integrations also extend this in their getAuthorization functions when editing them. Review the module and the Event integration to see their current usages and adjust as necessary. Once you've the data call done properly it'll give you an array of events that you foreach loop through and display (see module for example usage).


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.

  • mjplowcha
  • mjplowcha
  • OFFLINE
  • Posts: 30
  • Thanks: 1
  • Karma: 0
11 years 8 months ago #221416 by mjplowcha
Replied by mjplowcha on topic GroupJive Event expiration
Ok thanks for the info. I wasn't sure how that was setup.

I have no problem making foreach loops and have already figured out how to filter out the events module by expiration date and by event attendance. So far that is working well, but what I really need is to show something along the lines of "If $user is member of group, then continue" and not "If user joined an event, then continue" It just makes more sense for me to want to display all events for a users group and not just the events he/she already joined in my case.

What I can't figure out is how to call the information I need from the ##__groupjive_users SQL data file and tag it onto the $user info. There are a lot of variables between the tables that have the same shared name, but looking at gj_users, this doesn't seem to be included in the array so I can't run any foreach loops to cycle out the data. I tested this theory out by looking for 'status' from the gj_users table inside the $users variable and couldn't pull that up either.

Now I can see both the group ID and the user ID in the other fields, but without a specific call to the database to the gj_users table along the lines of
$currentusergroups = "SELECT group FROM `##_groupjive_users` WHERE user_id = '$user_id'"
Then in my foreach loop I would only need to do something like:
foreach ($currentusergroups as $currentusergroup )....

How would you recommend I pull that table data into that module? :huh:

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48459
  • Thanks: 8280
  • Karma: 1443
11 years 8 months ago #221478 by krileon
Replied by krileon on topic GroupJive Event expiration

but what I really need is to show something along the lines of "If $user is member of group, then continue" and not "If user joined an event, then continue" It just makes more sense for me to want to display all events for a users group and not just the events he/she already joined in my case.

It already does this. It shows the user all the events they have access to. Not the ones they joined or created.

What I can't figure out is how to call the information I need from the ##__groupjive_users SQL data file and tag it onto the $user info. There are a lot of variables between the tables that have the same shared name, but looking at gj_users, this doesn't seem to be included in the array so I can't run any foreach loops to cycle out the data. I tested this theory out by looking for 'status' from the gj_users table inside the $users variable and couldn't pull that up either.

You don't query, ever, in GJ; it has full data API to handle all the queries and push the results to database objects. See the below to pull a users Group User.
Code:
$row = cbgjData::getUsers( array( array( 'grp_access', 'mod_lvl2' ), $user ), array( 'group', '=', (int) $groupId, 'user_id', '=', (int) $userId ), null, null, false );

First variable is always the access permissions you want the $user object to have before pulling the user. If no access, then the result is remove (list output) or set to empty database object. The second variable is the $where statement that is parsed and added directly to the query. You can find usages of both all throughout GJ as examples for further usage. This handles all API calls, triggers, everything for you.

In your case you'd just add the above usage to your foreach loop as the Event contains "group" column so you'd access it with $event->get( 'group' ) for example. The user id can be $_CB_framework->myId() for current viewing user.

Note the Group User database object won't tell you if the user joined the group or not. For that you need to call $event->getAttendees() and it'll give you an array with sub-arrays for yes, no, and maybe. You'd loop though this to find if they are attending or not and what their attendance status is. Example of this as follows.
Code:
$attendees = $row->getAttendees(); $userStatus = null; if ( $attendees ) foreach ( $attendees as $attendance => $attendances ) { if ( $attendances ) foreach ( $attendances as $attendee ) { if ( $attendee == $user->id ) { $userStatus = $attendance; } } }


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.

  • mjplowcha
  • mjplowcha
  • OFFLINE
  • Posts: 30
  • Thanks: 1
  • Karma: 0
11 years 8 months ago #221489 by mjplowcha
Replied by mjplowcha on topic GroupJive Event expiration
I think where the confusion here now is that I ONLY want to show the events for groups a user joined or groups the user created. Basically...

User1 registers to the site. He then sees the category 'awesome groups' and sees a group in that category called 'We like to kayak' and decides to join. On the module, he is seeing events for the group 'We like to climb' as well as the 'We like to kayak' with expired and current events from both categories because they are open groups.

What I am trying to achieve is 1)filter out the events that are expired (Done); 2)only show events for the 'We like to kayak' group for User1, even if he hasn't selected his attendance for that event.

I figured out the 'attending' event pretty easily already, but that's only a temporary fix as it doesn't show the 'we like to kayak' group events that have not been marked at all. Once User1 marks his attendance yes/no/maybe then it shows up on the module, but not before as a null answer.

I'll try out your code for this, just in case it is different from mine. Thanks for the updates as always!

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48459
  • Thanks: 8280
  • Karma: 1443
11 years 8 months ago - 11 years 8 months ago #221511 by krileon
Replied by krileon on topic GroupJive Event expiration

I think where the confusion here now is that I ONLY want to show the events for groups a user joined or groups the user created. Basically...

Then you'd just do the below for that.
Code:
$rows = cbgjEventsData::getEvents( array( array( 'grp_usr_active' ), $user ), $include_exclude, null, $display );

The above access checks that they're an active user of the group. Owners are always active users so should give the desired results.


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.
Last edit: 11 years 8 months ago by krileon.

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

Moderators: beatnantkrileon
Powered by Kunena Forum