Home Forums Newsletter Plugin Support subscribe in php

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #60405
    daggelito
    Participant

    Hey,
    is there a way to create a new user in php?
    I searched you plugin and found

    
    $request = array("name": "Username", "email": "user@email.com");
    $module = NewsletterUsers::instance();
    
      $request['status'] = 'C';
      $request['sex'] = 'n';
    
      unset($request['name']);
    
      $user = $module->save_user($request);
    

    but this code returns me the “mysqli_real_escape_string() expects parameter 2 to be string, array given” error.
    Can you help me?
    Cheers Leo

    #60428
    Stefano
    Keymaster

    Do a var_dump of your $request and check its structure. It must be an associatve arrau with at least the “email” key.
    Stefano.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.