Results 1 to 4 of 4

Thread: How to make a user hash

  1. #1
    UnionDatacom is offline Member
    Join Date
    Jun 2005
    Posts
    6

    Default How to make a user hash

    After hours off trying unsuccessfully to get leadCapture.php to work effectively, I am working on a more-or-less standalone web form that can write directly to the MySQL database, but I am not having much luck. I am having a time trying to duplicate the encryption code Sugar uses outside of Sugar to make new user IDs. But…

    I found this bit of code comment in utils.php

    Code:
    /**
     * A temporary method of generating GUIDs of the correct format for our DB.
     * @return String contianing a GUID in the format: aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee
     *
     * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
     * All Rights Reserved.
     * Contributor(s): ______________________________________..
    */
    Does anyone know a way I could utilize the utils.php to just generate a user ID in the format Sugar likes, without having to use the rest of leadCapture.php. I want to make a simple script to get a user new ID, and then submit all the additional data I need via another application. ???

  2. #2
    Superman's Avatar
    Superman is offline Sugar Community Member
    Join Date
    Oct 2005
    Location
    Kazakhstan
    Posts
    852

    Default Re: How to make a user hash

    PHP Code:
    $user = new User();
    $user->id create_guid();
    $user->new_with_id true;
    $user->last_name 'Gump';
    $user->user_name 'Forrest';
    $user->title "Forrest Gump";
    $user->status 'Active';
    $user->is_admin 'off';
    $user->user_password $user->encrypt_password("run forrest!");
    $user->user_hash strtolower(md5("run forrest!"));
    $user->email 'forrest@apple.com';
    $user->save(); 
    Farkhad Rakhimzhanov
    E-mail: farkhad@gmail.com
    Skype: rakikama

    SuperTimesheet and Invoicing — timesheet tool with invoicing for SugarCRM.
    Book time against Cases, Project Tasks and Projects.
    Create invoice regarding booked time, print it in PDF or HTML,
    customize template as you like.

  3. #3
    ggraubins is offline Member
    Join Date
    Nov 2008
    Posts
    13

    Smile Re: How to make a user hash

    Could someone tell me if the SugarCRM / PHP function call create_guid() provides the same result as shown in the Wiki below?

    http://en.wikipedia.org/wiki/Uuid

    Looking further, from this URL:

    http://php.net/manual/en/function.com-create-guid.php

    It appears they are the same, except one (com_create_guid) provides the curly braces around the output?

    Thanks in advance!

    -Gregg

  4. #4
    jmertic is offline Sugar Community Manager
    Join Date
    Dec 2007
    Posts
    2,224

    Default Re: How to make a user hash

    Yes it does have the same output. However, com_create_guid() is only available on the Windows platform

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •