News:

Support the VirtueMart project and become a member

Main Menu

How to create vm user by API function

Started by mhs_pro, January 20, 2019, 18:28:30 PM

Previous topic - Next topic

mhs_pro

Hi
I want create user with API function in vm 3

I checked how a user was register
in public_html/administrator/component/com_virtuemart/models/user.php there is a function named store(&$data).

public function store(&$data){

$message = '';
==> vRequest::vmCheckToken('Invalid Token, while trying to save user');

if(empty($data)){
vmError('Developer notice, no data to store for user');
return false;
}

This function checks vRequest::vmCheckToken

How can I fill out the vRequest?

Studio 42

You need to call 2 times the server to do something secured
First time using JSession::getFormToken(); to get the form field name and you have to set it to 1
Using CURL you need to  send POST datas.
Some explain to get token here : https://docs.joomla.org/How_to_add_CSRF_anti-spoofing_to_forms
You can perhaps set this directly in the server POST datas using Joomla or virtuemart input function.