Skip to Content Skip to Menu

CB Privacy trigger use in Auto Actions

9 years 5 months ago #264037 by davidmarshall15
CB Privacy trigger use in Auto Actions was created by davidmarshall15
Hello,

I want to use a trigger to run a piece of code when a user sets privacy to private.

I am guessing the correct trigger would be: privacy_onAfterUpdatePrivacy

What I don't know is how to identify the condition rule == 99.
I have tried to identify the variable name by pushing output via html and for example testing [var1_rule] but I am getting nowhere with this.

Using the privacy triggers, is it possible to use the rule on the conditions tab and if so what is the variable name?

Thanks

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48478
  • Thanks: 8281
  • Karma: 1443
9 years 5 months ago - 9 years 5 months ago #264063 by krileon
Replied by krileon on topic CB Privacy trigger use in Auto Actions
You'll need to act on both privacy_onAfterCreatePrivacy and privacy_onAfterUpdatePrivacy. If a privacy row doesn't exist already then it's create. If it does then it's update. So you need to make sure you cover both cases. The first variable of the trigger (e.g. [var1_VARIABLE]) is the privacy row. So you'd condition against [var1_rule] being equal to 99, which is private.

You may need to adjust the User parameter. That trigger doesn't supply a user object so you need to set User to User so it uses the viewing user object. So it may have a hard time constructing user object from the user_id variable of the privacy object.

Also enable debug mode and maximum error reporting in Joomla global configuration. Next under parameters of your action enable debug mode. This will allow debugging of the access/conditions of your action.


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: 9 years 5 months ago by krileon.

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

9 years 5 months ago - 9 years 5 months ago #264079 by davidmarshall15
Replied by davidmarshall15 on topic CB Privacy trigger use in Auto Actions
I appreciate the reply but [var1_rule] still doesn't seems to work.
Debug is turned on. The User was set to Automatic and it did bring back the user id, setting it to User doesn't seemed to help.

For testing I have been doing the following:
Set User to user on the Global tab



On the conditions tab, the user ID is set to a my user, ensuring no one is affected.



Action Tab. Ultimately I want to run some php, but for now the action is set to HTML for the purpose of identifying the rule variable



And this is the result of the above settings



Changing the condition tab and specifying [var1_rule]



Results with this




Hope you can see why I'm stuck with this and can find an answer.
Thanks
Last edit: 9 years 5 months ago by davidmarshall15. Reason: Space out and underline to make the post easier to read.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48478
  • Thanks: 8281
  • Karma: 1443
9 years 5 months ago #264085 by krileon
Replied by krileon on topic CB Privacy trigger use in Auto Actions
Seams to be working fine in my tests. CB Privacy will not fire those triggers if the privacy value hasn't changed as well. Ensure CB Privacy is up to date as it's possible an older release had different trigger values. Latest CB Privacy is 4.0.3. Your code won't output unless it's set to var_dump and you've enable Joomla debug mode as well as maximum error reporting as this all happens during a store process before a redirect.


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.

9 years 5 months ago #264091 by davidmarshall15
Replied by davidmarshall15 on topic CB Privacy trigger use in Auto Actions
I still couldn't get it to output the rule when using the Internal Action URL - Click to Execute.
But setting the condition and testing through the front end works. So I'm happy.

Thanks for your help.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48478
  • Thanks: 8281
  • Karma: 1443
9 years 5 months ago #264121 by krileon
Replied by krileon on topic CB Privacy trigger use in Auto Actions
It's not going to output anything with Internal Action URL as that's not how that works. That directly executes the action, which means it has no variables.


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.
The following user(s) said Thank You: davidmarshall15

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

Moderators: beatnantkrileon
Powered by Kunena Forum