USER_ID via Auto Action

12 years 1 month ago #192786 by lumberjack_rene
USER_ID via Auto Action was created by lumberjack_rene
Hi,

I have a problem with the Plugin Auto Action. Hopefully I can find an approach to that problem by this way.

explenation:

I want to calculate the age of an user after successfully login. Therefor I use the Auto Action (Type Code). I wrote an php script which calculates the age as a function of birthday and the current date. So far no problem, it works but only when I write the user_id of the logged in rider manuelly in my php script.

part of my sql query from the php script:

(...WHERE `user_id`='1124'...)

Now my question:

How can I get the user_id of the logged in user automatically.

something like that (unfortunately it didn't work by this way):

(...WHERE `user_id`='$user_id'...)

Up to now I couldn't found a solution to include the user_id of the current logged in user in my php script.

Do you have a solution for that problem?

Thanks in advance!

Please Log in to join the conversation.

12 years 1 month ago #192790 by creezi
Replied by creezi on topic Re: USER_ID via Auto Action
Hi there,

Why not use the cb age field and display as age and not birthdate?

Please Log in to join the conversation.

12 years 1 month ago #192808 by krileon
Replied by krileon on topic Re: USER_ID via Auto Action
If you're using a Code action to perform a query then just use a Query action. Substitutions work in Code actions as well (e.g. [user_id]). Please see tutorials within my signature for further substitution usage information. If you're wanting to populate $user_id inside your PHP then you need to use normal Joomla/CB APIs to get $user_id (e.g. $_CB_Framework->myId()).


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: lumberjack_rene

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.506 seconds

Facebook Twitter LinkedIn