Need datetime field and logged in user ID

12 years 4 months ago - 12 years 4 months ago #187480 by apdt
I need to capture 2 information: approval date and the user ID of the admin that approve the member.

For approval date, is it possible to capture both date & time? The dropdown list in Field Management only has 'Date' which corresponds to database field type 'DATE'.

For the admin ID, the [user_id] substitution will replace it with the ID of the user being approved. Is there any way I can get the admin's user ID?

UPDATE:
I created new trigger through CB Queries. The following SQL works and the cb_approvaldate is populated correctly:
UPDATE jos_comprofiler SET cb_approvaldate = NOW() WHERE user_id = [user_id];

However, the following doesn't. The whole query fails to execute so it must be the cb:userfield substitution that's wrong:
UPDATE jos_comprofiler SET cb_approvaldate = NOW(), cb_approvedby = [cb:userfield field="user_id" user="#me" /] WHERE user_id = [user_id];

The filed type of 'cb_approvedby' is Text. Any idea?

Please Log in to join the conversation.

12 years 4 months ago #187573 by krileon
Replied by krileon on topic Re: Need datetime field and logged in user ID
CB Queries is depreciated (no longer maintained). Please upgrade to CB Auto Actions using a Query action. I recommend the below CB Auto Action.

Type: Query
Triggers: onAfterUserApproval
User: Automatic
Access: Everybody
Query:
UPDATE `#__comprofiler` SET `cb_approvaldate` = NOW(), `cb_approvedby` = [cb:userdata field="user_id" user="#me" /] WHERE `user_id` = [user_id];
Mode: Internal


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 to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.180 seconds

Facebook Twitter LinkedIn