Skip to Content Skip to Menu

Need datetime field and logged in user ID

  • apdt
  • apdt
  • OFFLINE
  • Posts: 92
  • Thanks: 2
  • Karma: 3
12 years 9 months ago - 12 years 9 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:
Code:
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:
Code:
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?
Last edit: 12 years 9 months ago by apdt.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48437
  • Thanks: 8275
  • Karma: 1443
12 years 9 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:
Code:
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 or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum