Skip to Content Skip to Menu

CB Activity commenting question

  • liaskas
  • liaskas
  • ONLINE
  • Posts: 406
  • Thanks: 37
  • Karma: 3
  • Add-ons
1 day 15 hours ago #340098 by liaskas
CB Activity commenting question was created by liaskas
Hello...
is there a way to exclude a particular user_id (or more) from being able to comment cb_activity posts?

Thank you.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48727
  • Thanks: 8320
  • Karma: 1447
1 day 7 hours ago #340102 by krileon
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.


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