GroupJive email all group members when there is a new post

2 years 5 months ago #326580 by krileon
You need access to the post on the stream. For activity_onAfterCreateStreamActivity the post is in var3, which is $row. So you'd use [var3_message] to get the message for that post. This assumes there even is one as message isn't required. For example they could just be uploading a photo and not post anything else.


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 to join the conversation.

2 years 4 months ago #327027 by MarlonFungai
So far its working but the client wants it to apply only to groups in a specific category how do I add this condition to the auto action?

Please Log in to join the conversation.

2 years 4 months ago #327037 by beat

MarlonFungai wrote: So far its working but the client wants it to apply only to groups in a specific category how do I add this condition to the auto action?


You would need to change in your CB Auto-action the "$query = ..." part in the "user" tab to something like (where you change 1234567 with the groupjive category id:
$category = 1234567;

$query	=	'SELECT ' . $_CB_database->NameQuote( 'user_id' )
		.	"\n FROM " . $_CB_database->NameQuote( '#__groupjive_users' ) . ' AS u'
		.	"\n INNER JOIN " . $_CB_database->NameQuote( '#__groupjive_groups' ) . ' AS g'
		.	"    ON g." . $_CB_database->NameQuote( 'id' ) . ' = u.' . $_CB_database->NameQuote( 'group' )
		.	"    AND g." . $_CB_database->NameQuote( 'category' ) . ' = ' . (int) $category
		.	"\n WHERE u." . $_CB_database->NameQuote( 'group' ) . " = " . (int) $matches[1]
		.	"\n AND u." . $_CB_database->NameQuote( 'status' ) . " >= 1"
		.	"\n AND u." . $_CB_database->NameQuote( 'user_id' ) . " != " . (int) \CBLib\Application\Application::MyUser()->getUserId();

Please note that as providing code is quite outside the scope of our forum support, I didn't have time to setup and test this query, so please try it on a site clone first.

Beat - Community Builder Team Member

Before posting on forums: Read FAQ thoroughly -- Help us spend more time coding by helping others in this forum, many thanks :)
CB links: Our membership - CBSubs - Templates - Hosting - Forge - Send me a Private Message (PM) only for private/confidential info
The following user(s) said Thank You: MarlonFungai

Please Log in to join the conversation.

2 years 1 month ago #328558 by PaceOnline
We are editing this example to send a request instead of an email we need to be able to identify each user's user id who would be getting the notification in order to add it to the request. How would we access that in substitution?

Please Log in to join the conversation.

2 years 1 month ago #328565 by krileon
The action itself is looped through each user. So you'll be able to use substitutions as normally. For user id that'd just be [user_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.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.281 seconds

Facebook Twitter LinkedIn