Customer Portal

Get Involved. Join the Conversation.

Topic

    BillD415
    Creating an account from the Ask a Question pageAnswered
    Topic posted March 27, 2009 by BillD415 Red Ribbon: 250+ Points, last edited October 29, 2011 
    4583 Views, 33 Comments
    Title:
    Creating an account from the Ask a Question page
    Content:

    We are preparing for an upgrade to November '08 and will be switching to the Portal page set as part of that upgrade.  For 2 of our interfaces, we don't have Pass-Through-Authentication, so we need for visitors to easily create an account and log their question from the Ask a Question page.  I have followed the instructions on pages 89-91 of the Nov '08 Portal Guide to add the email field to the AAQ page so that it will create a new contact if necessary or add the incident to the current contact if it already exists.

     

    This appears to work in that it creates a new contact if the email address does not exist, but because it does not put anything in the "login" field in the contact record, the customer can not log in to the My Stuff pages to check on their previously submitted incident.  Is there any way to either:

     

    1. Have the login field added during the contact creation from the AAQ page

    2. Modify the login widget so that it looks at the email field rather than the login field?  We always use the email as our login and don't use a password for the sites in question.

     

    Any insight would be appreciated.

     

    Bill Dailey

     

     

     

     

     

     

     

     

    Best Comment

    Ernie Turner
    I think you could probably accomplish what you're looking for by using the 'pre_contact_create' hook. In that hook, you could duplicate the email address into the login field on the contact object, and then users could log in using their email address. I haven't tried this, but I think it should work. I'm not sure what you would do for the password field though, unless you populated it with a random value and sent an email to the contact telling them what it is.

    Comment

    • Ernie Turner
      The process for users to obtain a login/password after performing an email only AAQ is to use the Account Assistance page. There is a button on the login form page which will take users to the correct spot. From there they can fill out their email address and continue with the rest of the account creation process (i.e create a username/password or any other information).
    • BillD415

      Hi Ernie,


      Thanks for the response. We don't want them to have to create another login/password since they already have two of them on our main website and that is confusing enough.  On our May '08 RN site (with the classic page set), they are able to both log an incident and view their previous incidents using only their email address.  This particular customer group is not very technical, so we are hoping to find a way to replicate the current behavior of the site and only require an email address to both log and look up previous incidents.

       

      Bill

       

       

    • Ernie Turner
      I think you could probably accomplish what you're looking for by using the 'pre_contact_create' hook. In that hook, you could duplicate the email address into the login field on the contact object, and then users could log in using their email address. I haven't tried this, but I think it should work. I'm not sure what you would do for the password field though, unless you populated it with a random value and sent an email to the contact telling them what it is.
    • BillD415

      Thanks, Ernie. 

       

      I will explore creating a 'pre_contact_create' hook to duplicate the email address into the login field.  We are not concerned about the password field at his point.

       

      Bill 

    • BillD415

      Just wanted to follow-up and let everybody know that I got this working by creating a pre_contact_create hook.

       

      Here is the code: 

       

      In the Development -> Config -> hooks.php file

       

       $rnHooks['pre_contact_create'][] = array(
              'class' => 'create_contact_custom',
              'function' => 'createContact',
             'filepath' => ''
          );

       

      In the Development -> Models -> Custom -> create_contact_custom.php file:

       

      <?

      class create_contact_custom extends Model
      {
          function create_contact_custom ()
          {
              parent::Model();
          }

        function createContact ($contact) {
       // Take the email field and add it to the login field before contact is created
       // This will allow users to log into MyStuff later
       $email = $contact['data']->email->value;
       $contact['data']->login->value = $email;
       }

      }

      ?>

       

      Thanks for the great tips, Ernie!

       

      Bill

    • chekwa
      hi bill, where would i put the pre_contact_create hook line though? thanks much for your help.
    • chekwa

      bump. so what i'm trying to do is basically is populate the "login" field with the "email" field. so in ask a question or create account, if a user fills in the email that would also be their login.

       

      thanks for your helps guys 

    • BillD415

      Hi Chekwa,

       

      You set up the hook in the hooks.php files which is in the Development > Config folder.

       

      Bill

    • chekwa

      hi bill, thanks for your response. i actually saw your previous post re: hooks. i'm sorry i may need a bit of  hand holding here

       

      so ok, let's say i have the hook.php file written with the code u wrote, as well as the contract_custom file.

       

      my question is, how do i call these files? is there a line of code i should be adding somewhere in the ask a question page?

       

      i really appreciate your help on this.

    • Ernie Turner
      If you have the code filled out in the hooks.php file, there shouldn't be anything else you need to do. The hook will automatically run at the predetermined location, based on the hook name (in your case right before a contact is created).
    • chekwa

      ok guys, here's what i did...

       

      on the hooks.php file, i cleaned everything out and put in bill's code.

       

      <?

       $rnHooks['pre_contact_create'][] = array(
              'class' => 'create_contact_custom',
              'function' => 'createContact',
             'filepath' => ''
          );


      ?>

       

       

      created a create_contract_custom.php file with this code inside

       

      <?

      class create_contact_custom extends Model
      {
          function create_contact_custom ()
          {
              parent::Model();
          }

        function createContact ($contact) {
       // Take the email field and add it to the login field before contact is created
       // This will allow users to log into MyStuff later
       $email = $contact['data']->email->value;
       $contact['data']->login->value = $email;
       }

      }

      ?>

       

       

      tried it and i'm getting a request error and action could not be completed. any help would be great. u know how it is when that's the last missing piece before you're golden? that's where im at right now. haha =) thanks!

    • BillD415

      I'm afraid that I'm at a loss as to what would cause that error.  Any of your more experienced folks have any ideas how to troubleshoot?

       

      Bill

    • Stdranwl

      Hi Bill,

       

      Can you please help me for the same case in August '08 version of CP, I am not able to find out hook.php in my version, where could I change so that same functionality could be achived in August '08 version.

       

      Thanks in advance,

      Stdranwl

       

       

    • Ernie Turner

      @chekwa - Could you use Firebug to determine what was returned in the request? There is probably information in there that would help debug the problem.

       

      @stdranwl - The hooks feature is only supported in the November '08 release and later. That is why you aren't seeing the hooks file in your version.

    • chekwa

      hi ernie, i used httpfox, not sure where in firebug i can see the error.

       

      in httpfox under "content" data this is what i got

       


      <div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;">

      <h4>A PHP Error was encountered</h4>

      <p>Severity: Warning</p>
      <p>Message:  Cannot modify header information - headers already sent by (output started at /cgi-bin/sandisk_en.cfg/scripts/euf/application/development/source/config/hooks.php:12)</p>
      <p>Filename: rightnow/optimized_includes.php</p>
      <p>Line Number: 380</p>

      </div>
      <div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;">

      <h4>A PHP Error was encountered</h4>

      <p>Severity: Warning</p>
      <p>Message:  Cannot modify header information - headers already sent by (output started at /cgi-bin/sandisk_en.cfg/scripts/euf/application/development/source/config/hooks.php:12)</p>
      <p>Filename: rightnow/optimized_includes.php</p>
      <p>Line Number: 380</p>

      </div>
      {"sessionParm":"","table":"incident","action":"create","i_id":22587,"status":1}

       

       

       

       for reference, this is the code in create_contact_custom.php

       

       

      <?

      class create_contact_custom extends Model
      {
          function create_contact_custom()
          {
              parent::Model();
          }

        function createContact ($contact) {
       // Take the email field and add it to the login field before contact is created
       // This will allow users to log into MyStuff later
       $email = $contact['data']->email->value;
       $contact['data']->login->value = $email;
       }

      }

      ?>

       

      the funny thing is the "login" field in our workspace does get filled up by the email. so it does work in the backend but in the front end we see this error. 

       

       i hope this helps in debugging. let me know if there's more info u need. thank u very much.

       

      -ben