Skip to Content Skip to Menu

Search Results (Searched for: Triggers:)

  • krileon
28 Feb 2025 17:42
Replied by krileon on topic email notifications
Ok, this is now available in latest CB Activity build release. It's now possible to act on an existing notification getting new recipients. This behavior is common with grouped notifications like profile.%.login notifications for example. Below is the usage I'd recommend.

Global
Triggers: activity_onAfterNotificationEntityStore, activity_onAfterNotificationEntityUpdate
Type: Email
User: Code
Access: Everybody
User
Code:
if ( ! $variables['var2']->getPublished() ) { return; } if ( $variables['var3'] === false ) { return; } if ( $variables['var3'] === true ) { return $variables['var2']->getRecipients(); } if ( is_array( $variables['var3'] ) ) { return $variables['var3']; }

The rest of your auto action should be able to remain the same. Added some logic for var3 since for Store it's going to be TRUE for a new notification otherwise FALSE if the notification itself was modified. For Update var3 will always be a recipient diff so you'll only send emails for new recipients.
  • krileon
24 Feb 2025 18:37
Replied by krileon on topic Questions on CBSubs -Gateway and AcyMailing
Awesome, glad to hear it! If you do end up needing to use CB Auto Actions for custom subscription status behavior the below will get you started.

Plan Active
Global
Triggers: onCPayUserStateChange
User: Automatic
Access: Everybody
Conditions
Condition 1
Field: Custom > Value
Custom Value: [var3]
Operator: Equal To
Value: PLAN_ID_HERE
Condition 2
Field: Custom > Value
Custom Value: [var2]
Operator: Equal To
Value: A

Plan Expired
Global
Triggers: onCPayUserStateChange
User: Automatic
Access: Everybody
Conditions
Condition 1
Field: Custom > Value
Custom Value: [var3]
Operator: Equal To
Value: PLAN_ID_HERE
Condition 2
Field: Custom > Value
Custom Value: [var2]
Operator: Not Equal To
Value: A

Simply replace PLAN_ID_HERE with the ID of the plan you want to act on and you're good to go. You can do pretty much whatever you like from here. Run custom queries, run custom PHP, use any of the many included action types, etc.. We've very few hard limits throughout our plugins as we provide A LOT of triggers to act on for inserting custom logic cleanly.
  • krileon
24 Feb 2025 18:26
You can have users conditionally auto join groups using CB Auto Actions. The below should work fine for this.

Global
Triggers: onAfterUserRegistration
Type: CB GroupJive
User: Automatic
Access: Everybody
Conditions
Supply whatever conditions you like here!
Action
Mode: Join Groups
Groups: SUPPLY_GROUPS_HERE
Status: Member

That's all you should need to do. Now when a user registers that matches your conditions they'll be placed in the supplied groups. If you need this to act on a CBSubs plan subscription status change then you can use the following.

Global
Triggers: onCPayUserStateChange
Conditions
Condition 1
Field: Custom > Value
Custom Value: [var3]
Operator: Equal To
Value: PLAN_ID_HERE
Condition 2
Field: Custom > Value
Custom Value: [var2]
Operator: Equal To
Value: A

Replace PLAN_ID_HERE with the ID of the plan you want this to condition off of and any additional conditions you like.

As a general FYI you can use the below in CB Auto Actions to run ANY custom behavior you like on subscription status changes. These are the same triggers and behavior the CBSubs integrations are using. This provides effectively unlimited potential for subscription driven logic.

Plan Active
Global
Triggers: onCPayUserStateChange
User: Automatic
Access: Everybody
Conditions
Condition 1
Field: Custom > Value
Custom Value: [var3]
Operator: Equal To
Value: PLAN_ID_HERE
Condition 2
Field: Custom > Value
Custom Value: [var2]
Operator: Equal To
Value: A

Plan Expired
Global
Triggers: onCPayUserStateChange
User: Automatic
Access: Everybody
Conditions
Condition 1
Field: Custom > Value
Custom Value: [var3]
Operator: Equal To
Value: PLAN_ID_HERE
Condition 2
Field: Custom > Value
Custom Value: [var2]
Operator: Not Equal To
Value: A
  • krileon
19 Feb 2025 16:13 - 19 Feb 2025 16:13
That's doable. The below should work in CB Auto Actions. It's basically your standard "do something when a field value changes" auto action except with a CB Activity action to generate an activity entry.

Global
Triggers: onAfterUserUpdate
Type: CB Activity
User: Automatic
Access: Everybody
Conditions
Condition 1
Field: FIELD_HERE
Operator: Not Equal To
Value: Pending
Condition 2
Field: Custom > Value
Custom Value: [var1_FIELD_NAME_HERE]
Operator: Not Equal To
Value: [var3_FIELD_NAME_HERE]
Action
Mode: Activity
Method: Create
Published: 1
Stream: Profile Activity
Asset: profile.[user_id]
Title:
Code:
toggled FIELD_TITLE_HERE to [cb:userfield field="FIELD_NAME_HERE" /]

Load By: None

For FIELD_HERE be sure to select your field. Replace FIELD_NAME_HERE with the name of the field you want to condition for. This ensures the auto action only processes when the field changes and only if that value isn't set to your default Pending value.

All the other parameters can be left at their default empty values. You can freely adjust them however needed though. The title/message displayed is just an example and can be whatever you like. I went with title as it's not changeably by the user like Message is and it'll show directly next to their name as an action performed.

The end result of all of this would be the following.

 
  • krileon
13 Feb 2025 17:54
Replied by krileon on topic User Limitation
Ah, I suppose I misunderstood as your original post had me thinking this was related to subscription limits. Yes, it's possible to block joining groups based off a custom limit and doing whatever behavior you like during that process. The gj_onBeforeJoinGroup trigger is fired before a group join. The below should block users from joining the group if the group already has 500 members and will send an email.

Global
Triggers: gj_onBeforeJoinGroup
Type: Email
User: Automatic
Access: Everybody
Conditions
Field: Custom > Query
Query:
Code:
SELECT COUNT(*) FROM `#__groupjive_users` WHERE `group` = '[var2_id]'
Operator: Equal To
Value: 499
Action
CONFIGURE_MEAIL_AS_NEEDED

Global
Triggers: gj_onBeforeJoinGroup
Type: Code
User: Automatic
Access: Everybody
Conditions
Field: Custom > Query
Query:
Code:
SELECT COUNT(*) FROM `#__groupjive_users` WHERE `group` = '[var2_id]'
Operator: Greater Than Or Equal To
Value: 500
Action
Method: PHP
Code:
Code:
$variables['var1']->setError( 'This group has reached its limit.' );
Parameters
Reference Variables: Variable 1

The above will send an email when the 500th member joins. If anyone over the 500th member attempts to join it will block the join and output an error message as to why.
  • krileon
04 Feb 2025 16:50
Replied by krileon on topic Notifications on by default

I'm not sure about this. If I go in my profile, on notifications tab, I see a list of options that I can set yes or no. I'd like them to be, bay default, on YES (but user can still set them on NO). If I go on the cb_notif_pm field, I see it's HTML type. Should I change that in textbox? Or should I look somewhere else?

There isn't a way to set a default value for profile edit. Only profile registration IF the field is set to display on registration. To workaround this you'll need CB Auto Actions to establish defaults when a new user registers. The below should work fine for this.

Global
Triggers: onAfterUserRegistration
Type: Field
User: Automatic
Access: Everybody
Action
Field: NOTIFICATION_FIELD_HERE
Operator: Set
Value: 1

Add as many field rows as you need for setting the different defaults.

As for existing users the fastest way to change their existing value is through a database query or you can just leave existing users be and let them configure it themselves.

I'm trying to make a badge showing how many notification a user has. So I was wondering if there is a notification counter per user somewhere.

How many notifications they have in total or notifications they haven't seen yet? You can display the CB Activity notification icon and popover anywhere you like using the CB Activity Module.
  • krileon
29 Jan 2025 16:58 - 29 Jan 2025 16:59
Replied by krileon on topic User Limitation

To Free users we want to offer a community of maximum 150 members. How can this be achieved?

There isn't a way to limit a plan to a number of active subscribers out of the box. I think the best way to do that is probably a condition under the Workflows tab against a Query field that counts the number of subscribers. This would be a neat feature though and have added a feature ticket for it.

forge.joomlapolis.com/issues/9598

We also want to auto-expire free memberships, so that after 1 year of inactivity the membership is inactivated

This is easy enough by just having the free plan have a duration of 1 year.

and after 18 months the membership is deleted along with the data.

This is a bit more tricky. Automating user deletion is risky. 1 mistake in the configuration and you've wiped your userbase. So while it is doable I don't recommend doing it and instead just deleting inactive accounts once a year in CB > User Management. If you still want to do this you can do so using CB Auto Actions with the below instructions.

Navigate to CB Auto Actions > Actions and create the following action

Global
Triggers: None
Type: Code
User: Automatic
Access: All Non-Moderators (safety measure to ensure moderation isn't deleted)
Conditions
Field: Custom > Value
Custom Value: [cb:parse function="time"][lastvisitDate][/cb:parse]
Operator: Less Than or Equal To
Value: [cb:parse function="time" time="-18 MONTHS"]now[/cb:parse]
Action
Method: PHP
Code:
Code:
$user->delete();


Save the auto action then set "Allow Direct Access" to "No" and save it again. This gives you an auto action that can only be ran programmatically and not from triggers or from URLs.

Navigate to CB Auto Actions > Batches and create a new Batch processor.

Global
Users: All Non-Moderators
Access: Everybody
Actions
select the above action here
Advanced Filter
WHERE:
Code:
u.`lastvisitDate` <= SELECT DATE_SUB( NOW(), INTERVAL 18 MONTH )


The above example is entirely based off last login date as it's a bit unclear what you mean by inactivity. The above is just an example. It has NOT been tested. Please do so carefully on a test install and confirm working as expected before applying to a live site. You may need to add extra conditions to the auto action like excluding those with a paid subscription.

Now all you need to do is setup a CRON task, or Joomla task schedular, to run the batch URL (it's under the Global tab after saving the batch) once a day. This will loop through your userbase that matches the filters and run them through the auto action.
  • krileon
27 Jan 2025 15:24
Replied by krileon on topic CB Activity commenting question
Only way is CB Privacy and blocking the user. If User A blocks User B then User B can't post on User A's profile or comment on User A's posts. Beyond that it's possible to inject custom access checks using CB Auto Actions using the activity_onCommentStreamCreateAccess trigger, which is fired when checking if someone can create a new comment or not on a comment stream. Example of how to use it as follows.

Global
Triggers: activity_onCommentStreamCreateAccess
Type: Code
User: Self
Access: Everybody
Conditions
Field: Custom > Users
User: Action User
Operator: Is
Users: COMMA_LIST_OF_USER_IDS_HERE
Action
Method: PHP
Code:
Code:
return false;
Output
Display: return

If that function receives a false boolean it will deny access. In this case if the viewing users user id matches the list of user ids supplied it should return false and deny comment access.

Currently this would block commenting for all comment streams. If you want it to be more specific add the following extra condition.

Field: Custom > Value
Custom Value: [var1_id]
Operator: Equal To
Value: STREAM_ID

Replace STREAM_ID with the comment stream id you want to check against. It's also possible to check against asset. Example as follows.

Field: Custom > Value
Custom Value: [var1_asset]
Operator: Is REGEXP
Value: /^article\./

This would block commenting on any comment streams with an article asset.

Note that trigger will not fire if the user is a CB Moderator as they're exempt from create restrictions. It also cannot be used to allow access where they otherwise would not have access. It can only be used to take away access.
  • liaskas
25 Jan 2025 08:44
Auto actions usecase question was created by liaskas
we are using an auto action to set a cookie after user registration that holds the username as value.

hese is the cookie setting...

Triggers: OnAfterUserConfirmation
Type: Code
User Automatic
Acccess: Everybody
Action: (the following)

PHP method...

if (!isset($_COOKIE)) {
    $user = '[cookiename]';
    setcookie(
        'cookiename',
        $user,
        time() + (86400 * 120), // Expiration time: 120 days
        '/', // Path
        '.domain.com', // Domain
        true, // Secure (HTTPS)
        true  // HTTPOnly
    );
}


The cookie is created correctly (at least on some testing accounts i created).



Now...

with a second auto action we check to see if the coolie exists on user gegistration and if it exists we get a mail notification that someone that is already registered created a new account.

here is the cookie checking...

Triggers: OnAfterUserConfirmation
Type: Code
User Automatic
Acccess: Everybody
Action: (the following)

PHP method...

if (isset($_COOKIE)) {
    $cookieValue = $_COOKIE;
    $user = "[username]";
    $to = "myname@domain.com";
    $subject = "User $cookieValue registered again as $user";
    $txt = "Text to be sent in the body of the email";

    $headers = "MIME-Version: 1.0" . "\r\n";
    $headers .= "Content-type: text/plain; charset=UTF-8" . "\r\n";
    $headers .= "From: info@xstream.gr";

    if ($user !== $cookieValue) {
        mail($to, '=?UTF-8?B?'.base64_encode($subject).'?=', $txt, $headers);
    }
}


And here begins the problem...

Most of the e-mails we get are not true!
We might get an e-mail that User10 (last login was 2 months ago, auto actions were created 2 days ago) registered again as User2.

Where might the problem be?
Is it that the username substitution is not accurrate for this kind of auto action?
Is it that we have to populate the username some other way?
Is it that we have to use [user_id] instead of [username]?

Can you please advise?

Thank you
  • krileon
26 Dec 2024 15:58
Replied by krileon on topic Private Groups
The below might work. The idea is to count how many groups they have in a condition then flip the access variable in var1 to false if the condition passes.

Global
Triggers: gj_onCanCreateGroup
Type: Code
User: Automatic
Access: Everybody
Conditions
Field: Custom > Query
Custom Query:
Code:
SELECT COUNT(*) FROM `#__groupjive_groups` WHERE `user_id` = '[user_id]'
Operator: Greater Than or Equal To
Value: GROUP_LIMIT_HERE
Action
Method: PHP
Code:
Code:
$variables['var1'] = false;
Parameters
Reference Variables: Variable 1

Set GROUP_LIMIT_HERE to whatever creation limit you want. If you want this based off a integer field that you can increment with CBSubs simply set it to a substitution of that integer field (e.g. [cb_grouplimit]).
  • krileon
20 Dec 2024 15:07
Replied by krileon on topic CB Activity Bot plugin problem
I don't know what context JEvents is sending to onContentAfterDisplay, but went ahead and made an example for you to render a comment stream using CB Auto Actions in JEvents more specifically. This also lets you even make your own comment stream exclusively for JEvents if you wanted so you can customize what features are available as well.

Global
Triggers: onContentAfterDisplay
Type: CB Activity
User: Self
Access: Everybody
Conditions
Field: Custom > Value
Custom Value: [var1]
Operator: Equal To
Value: com_jevents.event
Action
Mode: Stream
Type: Comments
Stream: Content
Data 1
Key: content_context
Value: [var1]
Data 2
Key: content_id
Value: [var2_repeat_id]
Output
Display: return

In this example I'm using a context of com_jevents.event, but you may need check to be sure that's correct, and am using the Content stream and settings its substitutions via the data parameter.

Next in System > Manage > Plugins edit "Content - CB Activity" then under Comments set Stream back to "Article" and then under Comments and Likes set "Exclude Context" to com_jevents.event to exclude JEvents. Again, the context may not be correct so you'll need to check with JEvents to see what context they're using.
  • krileon
02 Dec 2024 16:40
Replied by krileon on topic User Registration at Trade Show - CBSubs
Believe I found a way for this to work. We can utilize the owner id feature to restrict a basket to specific gateways then switch the owner id of the basket dynamically based off ip address so you can restrict the payment processes to your location.

First you'll need to create payment gateways that'll be exclusive to the in-person event. To do this create them as you normally would, but at the bottom set their Owner ID to 1.

Next you'll need the following auto action to switch a baskets owner just before display. This switch doesn't apply to the storage logic of a basket as it's currently only implemented for payment gateway display switching so this should be all that's necessary.

Global
Triggers: onCbSubsBeforePaymentBasket
Type: Code
User: Automatic
Access: Everybody
Conditions
Field: Custom > Code
Custom Code:
Code:
return \CBLib\Application\Application::Input()->getRequestIP();
Operator: Equal To
Value: EVENT_IP_ADDRESS_HERE
Action
Method: PHP
Code:
Code:
$variables['var1']->owner = 1;

Now when you go to pay you should see only the payment gateways that have an owner id of 1 listed as available payment methods. Was able to test and confirm this works including the entire payment flow.
  • krileon
27 Nov 2024 22:06 - 27 Nov 2024 22:08
Replied by krileon on topic User Registration at Trade Show - CBSubs

It would be nice if the "pay offline" button only appeared on our approved tablets

There's no functionality built in for that. Gateways only have basic access permissions, which would be checked against their account. I'm not sure how you would limit that to a specific device, sorry. Offline payments require manual confirmation so I suppose it doesn't really matter. When you're doing your book keeping to confirm the payments just reject anyone that didn't pay. Maybe only make the offline payment gateway available while an event is actively going on? Should be as simple as enable/disabling it.

After a user is made this way, instead of verbally asking for the new username and writing it down, is there an easier way to document the new user, in-person?

Document in what way? If registration asks for email address or phone number then they can probably just provide that and write it down. I don't see how else you could possibly document in person unless you offered printers to print out the offline payment slip as a form of confirmation.

The payment slip screen adds extra clicks. Is it possible to just redirect to the registration page with a fresh slate?

It might be possible using the below in CB Auto Actions.

Global
Triggers: onCPayDisplayBasketResult
Type: Redirect
User: Self
Access: All Non-Registered Users
Conditions
Field: Custom > Value
Custom Value: [get_result]
Operator: Equal To
Value: showslip
Action
URL:
Code:
[cb:url location="registers" /]


Within your offline payment gateway be sure to set "Payment slip opens in" to "Stays in same window within the site, optionally with PRINT button" to avoid the confirmation using a popup window. That should loop back to registration for non-logged in offline payments. You can optionally add a confirmation message to the redirect auto action.
  • krileon
19 Nov 2024 14:46
Replied by krileon on topic OpenGraph tags in activity posts?
You have to supply the entirety of the opengraph data. For sites like X (Twitter) you're also going to need to use twitter cards data. Below is an example that more closely matches CB SEO output.

Global
Triggers: activity_onDisplayActivity
Type: Code
User: Automatic
Access: Everybody
Conditions
Field: Value
Custom Value: [var3_isRow]
Operator: Equal To
Value: 1
Action
Method: Header
Code:
Code:
<meta property="og:type" content="website" /> <meta property="og:site_name" content="[cb:parse function="encode" method="html"][cb:config param="sitename" /][/cb:parse]" /> <meta property="og:title" content="[cb:parse function="encode" method="html"][username][/cb:parse]" /> <meta property="og:description" content="[cb:parse function="encode" method="html"][cb:parse function="getNotificationTitle" class="var2" /][/cb:parse]" /> <meta property="og:image" content="[cb:parse function="encode" method="html"][avatar][/cb:parse]" /> <meta property="twitter:card" content="summary" /> <meta property="twitter:title" content="[cb:parse function="encode" method="html"][username][/cb:parse]" /> <meta property="twitter:description" content="[cb:parse function="encode" method="html"][cb:parse function="getNotificationTitle" class="var2" /][/cb:parse]" /> <meta property="twitter:image" content="[cb:parse function="encode" method="html"][avatar][/cb:parse]" />
Parameters
Format Functions: Yes

Posts don't really have titles and getting the contents of the post is complicated. getNotificationTitle is an amalgamation of post title and message that's safe for sharing and has been processed. With the above example it sets the opengraph title to the username and the description to the getNotificationTitle result. It's important to use the html encoding format function to apply htmlspecialchars to the results of substitutions or you could insert broken html. Image is just set to avatar.

The above also sets this same information into twitter card metadata since CB SEO also does this automatically.

If you need this to be tailored to specific activity posts it will get complicated. You'll need to use IF substitutions and probably have to utilize PHP to get whatever information you're needing. However since the URL is to a post and not the article in the post the above metadata would be accurate for such a URL.

Note this doesn't guarantee a site will even parse this though. It will be inserted to the header as specified, but applications and other websites do not have to use this metadata.
  • liaskas
19 Nov 2024 07:59
Replied by liaskas on topic OpenGraph tags in activity posts?
Thank you for your reply Krileon. We are getting closer!

Currently we have the following auto action:

Global
Triggers: activity_onDisplayActivity
Type: Code
User: Automatic
Access: Everybody

Conditions
Field: Value
Custom Value: [var3_isRow]
Operator: Equal To
Value: 1

Action
Method: Header
Code: <meta property="og:title" content="[cb:parse function="getNotificationTitle" class="var2" /]" />

AND HERE IS THE RESULT...

The post as it shows on activity...
 

The post info as the are shared on FB...
 

Please advise... thank you.
Displaying 16 - 30 out of 32 results.
Powered by Kunena Forum