Skip to Content Skip to Menu

Search Results (Searched for: Triggers:)

  • 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.
  • liaskas
16 Nov 2024 13:01
Replied by liaskas on topic OpenGraph tags in activity posts?
Thank you for your reply Krileon but not so helpful for me that i am not a programmer!

So let me put things in an order so that i can understand what to do...

Created type Code auto action. Triggers: activity_onDisplayActivity, User: Automatic, Access Everybody.
Conditions... Field: Value, Custom Value: [var3_isRow], Operator: Equal To, Value: 1.

Now regarding your blog post, you mention...

Simply add &format=jsonapi to the auto action URL

Where do i have to add it? Somewhere inside the above Code Auto Action? Where is the Auto Action URL?

Thank you.
  • krileon
08 Nov 2024 16:01 - 08 Nov 2024 16:02
Replied by krileon on topic SEO CB plug in
The below should work for outputting whatever metadata you like on profiles.

Global
Triggers: onBeforeUserProfileDisplay
Type: Code
User: Automatic
Access: Everybody
Action
Method: Metadata
Row 1
Name: description
Content: [cb_description]

The above for example would set the metadata description to the field with a name of cb_description. You may need to use the onAfterUserProfileDisplay trigger instead though if menu metadata is being applied to be able to override the menu metadata.
  • krileon
07 Oct 2024 14:29

1. How do I get them into the free plan manually (There are only 3 or 4 of them where this is applied)

You should be able to just edit them in CB > User Management and give them a subscription to your free plan.

2. How do make sure when members expire the subscription plans also change to the free version? Would this require an Auto Action?

If you want to move them to a different active subscription when they expire then yes you'd need CB Auto Actions for that. You can use the below to execute behavior on a plans subscription state change where you could use a CB Paid Subscriptions auto action to change their subscription.

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

Replace PLAN_ID_HERE with the plan id of the plan you want to act on.
  • krileon
26 Sep 2024 15:26 - 27 Sep 2024 15:05
Within your plan under Access tab you configure what usergroup the plan gives to the user. When they expire/unsubscribe that usergroup will be removed. If you want to remove that usergroup and replace it with a different one you'll need to use CB Auto Actions for that. The below should work.

Global
Triggers: onCPayUserStateChange
Type: Usergroup
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
Action
Action 1
Mode: Remove Usergroups
Usergroups: REMOVE_USERGROUP_HERE
Action 2
Mode: Add Usergroups
Usergroups: ADD_USERGROUP_HERE

Replace PLAN_ID_HERE with your plans id. That auto action should then fire when their plan expires. If you know they'll only have those 2 usergroups you can just use the Replace Usergroups mode.
  • krileon
18 Sep 2024 14:21
It will depend on your level of experience as a developer as it requires coding. The easiest way to log new activity entries is to use CB Auto Actions. The below for example will log a new activity entry when a comment is created.

Global
Triggers: activity_onAfterCommentStreamCreate
Type: CB Activity
User: Automatic
Access: Everybody
Conditions
Field: Custom > Value
Custom Value: [var3_asset]
Operator: Is REGEXP
Value: /^easyblog\.\d+$/
Action
Mode: Activity
Method: Create
Stream: Profile Activity
Asset: [var3_asset]

This assumes your comment stream is rendering in EasyBlog with an asset of "easyblog.POST_ID". This should then for example create a new activity entry when commenting on a stream with that asset.

Now that the activity entry exists it needs to be customized to output custom content like all the core activity entries. This is done from a set of template files to minimize the amount of work. This is where coding comes in. Your starting point will be the example file provided below.

/components/com_comprofiler/plugin/user/plug_cbactivity/templates/default/activity/custom/example.php

In it it describes how to override all aspects of the activity display. Using the above asset you'd need to have the following file.

/components/com_comprofiler/plugin/user/plug_cbactivity/templates/default/activity/custom/easyblog.php

From there you can call EasyBlog API to render your blog post inline or however you like. For examples of how core activity does this take a look at the files in the below folder.

/components/com_comprofiler/plugin/user/plug_cbactivity/templates/default/activity/core

If you need to apply custom access restrictions to that asset then you can use the below template structure to run various functionality like context checks, access checks, custom grouping logic, or source object construction.

/components/com_comprofiler/plugin/user/plug_cbactivity/templates/default/assets

Examples are provided in each of those functions within that folder as "example.php" and are extensively documented directly in their code so should be a reasonable starting point. They are also working examples by simply creating an activity entry with "example.1" asset you'll see them function.

So as you can see it's a bit of work to implement custom activity rendering. I'm planning on trying to implement a UI for this in a future CB Activity release to try and simplify it some more, but there's only so much I can do about rendering content from unknown extensions and data sources.
Displaying 16 - 30 out of 31 results.
Powered by Kunena Forum