HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

Is it possible to add a user via script or via mysql?

Is it possible to add a user via script or via mysql?

Comments

  • Options
    R_JR_J Ex-Fanboy Munich Admin

    Yes.

    Do you want to create a user from within a Vanilla plugin, with an external PHP script or merely with an SQL query? All of that is possible. I would always recommend to do that from within a plugin.

    When you install Vanilla from scratch, some users are created. The code which does that is located in the "stub" plugin: https://github.com/vanilla/vanilla/blob/master/plugins/stubcontent/class.stubcontent.plugin.php#L213

    It's slightly more complex than creating a single user must be, but it shows how to use Vanillas UserModel

  • Options
    LincLinc Detroit Admin

    Have you considered using the API? I'm not sure what your use case is, but I suspect that will be more beneficial to you.

  • Options
    PWisniaPWisnia New
    edited May 2020

    @Linc And how to use it?

    I would like to use it in a way like this, but it is for a different engine, and how to convert it?

    <?php 
    //By QuantumZ  
      
    require( "../../../initdata.php");  //we need to include this because ipsRegistry requires it 
    include( "sdk/mta_sdk.php" );  //the sdk is a must  
    require( "ipsRegistry.php" );  //this will give us the functions to modify things in the forum platform  
      
    ipsRegistry::init();            
    $input = mta::getInput(); // $input[0] is username, $input[1] is password, $input[2] is e-mail 
    mta::doReturn($input[0]); 
      
    //$passSalt = IPSMember::generatePasswordSalt(5);   
    //$passCompiled = IPSMember::generateCompiledPasshash($passSalt, md5($input[1])); 
    $user = IPSMember::create( array( 'core' => array( 'email' => $input[2], 'password' => $input[1], 'name' => $input[0], 'members_display_name' => $input[0] ) ) ); 
      
    ?>  
    

    or

    <?php

    $o = $_GET['imie'];

    $o2 = $_GET['email'];

    $o3 = $_GET['rodzaj'];

    $o4 = $_GET['tresc'];

    -- forum code

    ?>

Sign In or Register to comment.