Hi all,

Before I explain everything, I want to be clear, I am not asking someone to do this for me. I want to build this mod myself to do 2 things: Further my education and actually solve an issue I am having. I just need some guidance.......
I have found a solution to an issue that I am having. Yes it is with the Email functionality. I have been able to configure my current installation to have all tickets (newly created and all replies) go to a specific mailbox. from there is gets distributed to all the support staff. This is intentional as we don not have any requirements for departments, SLA's or many other feature a larger company would find useful.

My intention now is that I have an email scheme that I want to follow when creating users. I know the email must be unique which is why I have come up with this:

3 letter prefix 6 digit generated number Email domain
LWA 012010 @leswilkins.com

The focus is on the 6 digit generated number. My intention is to create a mod that will generate this 6 digit number, build the email and compare it to the emails in the database. I do not want it to be sequential as I want it to look for one that is actually not being used just in case a user gets deleted.

What I need help with is how to find the routine called to check these emails. Since they will all have the same scheme (LWA000000@leswilkins.com) all I should have to check for are the number. (Not sure if that would make it faster or not) I have a pretty good idea on how to build the string for the email and inject it into the form when its called, I am just having a terrible time figuring out what routine OST calls to run the comparison. So now that you know all this....

Is there a manual/papers/schematic that I can read up on to possibly get a clue to how this portion of the software works so that I can at least come up with some code and test?

Thank you,
Wiz

    Wizdos Not sure what happen but the editor took out spaces and separated part of my post. I didn't know it was going to do that.

    I know you folks are busy but just wanted to ask 2 questions.

    The setup:
    I have figured out how to access the table User_Email thru some pretty rough code (not using OST native code). I have been able to reconstruct a unique email. I am using this recontructed email to insert in the "New User" form. This created 2 issues that needs to be resolved:

    Issue 1 - The form that gets dynamically created I believe is called from the filename "user-lookup.tmpl.php" and creates this line -

    input type="email" id="_UNIQUE-ID" size="40" placeholder="" name="dd11b2b4e6299f" value=""

    This line is the "EMAIL" field in the lookup form when creating a new user. I have a script that targets the UNIQUE-ID and inserts my generated email into that field. It worked great, until I found out that the ID is dynamic. So I need to be able to get the value of the UNIQUE-ID to make my script consistent.

    My question for this is: Where is the file or code that actually generates this form?

    Issue 2 - In reference to the "rough code" from above, the way I have been accessing the DB is thru a hard coded line which includes the DB-NAME, PASSWORD and USER_NAME unto which I know that this is a very large NO NO and I did it this way just for testing purposes. Now that I have proven that I can actually get the information I need, I would like to re-write the code correctly so that it does not expose that information.

    I have done many searches that yielded the answer to use "db_query('your query')". I was under the impression that the line would go something like this:

    db_query('SELECT * FROM table")

    However, I am confident that this is not correct. I am unsure of the syntax to be used here and was wondering if you could provide an example for me to follow? Every time I have changed my code, the form just does not show up telling me that there is an error and I get no additional information after that.

    Thank you very much for any help,

    Craig. (Wizdos)

    Figured out issue #2. No longer an issue. Found in older posted assisted by ntozier.
    I was not assigning the function to a variable, as it now obvious in my example from above. Corrected by using:
    $link = db_query('your query')

    • Craig.
    Write a Reply...