Skip to Content Skip to Menu

Autoaction limit to frontend and direct calls only

  • activha
  • activha
  • OFFLINE
  • Posts: 2326
  • Thanks: 117
  • Karma: 13
11 months 3 weeks ago #335564 by activha
I have a php file included with my autoaction using the trigger onBeforeDeleteUser.
This file uses the id of the deleted user as this :
Code:
$userid = $action->string($user, '[var1_user_id]'); $folders = $action->string($user, '[post_folders]'); $cbUser  = CBuser::getInstance($userid, false); $token = $cbUser->getUserData()->getString( 'cb_token_api', '0' ); $url = JURI::base() . 'handle-command'; $ndata = [   'userid' => $userid,     'command' => 'erase-user',   'folders' => $folders ];

All is working fine when a user is deleted, but I would like to use the same php code manually with a button for our mods to trigger the deletion.

In this case, how can I get the user id of the viewed user so that I can pass this to my code ?


 

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48419
  • Thanks: 8274
  • Karma: 1443
11 months 3 weeks ago #335566 by krileon
Add a GET variable to your URL then link to the auto action and include that GET variable. Example as follows.
Code:
index.php?option=com_comprofiler&view=pluginclass&plugin=cbautoactions&action=action&actions=ACTION_ID&delete=USER_ID

You can then access &delete with [get_delete]. So within your code you could do something like the following.
Code:
$userid = (int) $action->string( $user, '[var1_user_id]' ); if ( ! $userid ) { $userid = (int) $action->string( $user, '[get_delete]' ); }


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

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

Moderators: beatnantkrileon
Powered by Kunena Forum