HelpSpot Help Desk Software | HelpSpot Blog | HelpSpot Support

"Remember me" on Portal for forums and requests


#1

Would be nice if once a user had entered their name/email/web site/etc on a forum post (or request submission) if there was an option to “Remember me” (via cookie, etc) so they don’t have to re-enter that every time they make a post/submission.


#2

This already happens automatically. A cookie is set with all of the information and used in the forums to pre-populate those fields. The cookie is not used in the request submission form. Is this not working in your installation?


#3

You could use the same cookie information in the submission form, but it’s not used by default for privacy reasons.


#4

How do I use the cookie informaiton on the submission form?


#5

You’ll want to read this to make sure you know where to place the modified files:
http://www.userscape.com/helpdesk/index.php?pg=kb.page&id=9

To use the cookie you’ll need to modify helpspot/templates/rquest.tpl.php (copy it into the custom_templates directory)

On line 60 in the value field use:

<?php echo $this->helper->visitor['name'] ?>

On line 84 for the email use:

<?php echo $this->helper->visitor['email'] ?>

The other cookie value available is:

<?php echo $this->helper->visitor['url'] ?>

For the URL, but you probably won’t need it in that form.


#6

Looks like this cookie is only set when a post is made to a forum?

Feature request: set a cookie with the UserID, name, phone, email (and URL while you’re at it) anywhere they are submitted (if they are passed into the Submit Request, or if they are entered into a Request or a Forum). For cases where privacy isn’t an issue, these would be really handy to create a “soft login” kind of environment.


#7

Yes, that’s correct. However, this is one of the big upsides of the templates being PHP based. I’ve put together a small piece of code below. Put it at the very top of the request.check.tpl.php file (after copying to custom_templates) just after the <?php tag.

//Remember user if no forum cookie set
if(!isset($_COOKIE[‘forumposter’])){
//Get request information
$request = $this->splugin(‘Request_Check’,‘getRequestDetails’,$this->get_id);
//Set user information
$name = $request[‘sFirstName’].’ ‘.$request[‘sLastName’];
$cv = urlencode(serialize(array(‘name’=>$name,‘email’=>$request[‘sEmail’],‘url’=>’’)));
//Set how long cookie should last
$ctime = time()+6060243012*10; //10 years
//Set cookie
setcookie(‘forumposter’,$cv,$ctime);
}

This code will set a forum cookie for the user if one doesn’t already exist. So their name and email will be set.

In the longer term we are looking into various options for a type of soft login system to keep some of this information from having to be retyped.


#8

This was a good start. I now have a cookie and code that will populate the userid, name, email, and phone on a Submit Request. Half-way to a soft login-feature. :slight_smile:

Now for the other half: is there a way (PHP code or PHP function) to create an access key from a request ID?


#9

Sure. The access key is already created to you just have to look it up. HelpSpot uses the ADODB library for database access and you can get an instance of it in the templates, so something like this will get the access key:

$accesskey = $GLOBALS[‘DB’]->GetOne(‘SELECT sRequestPassword FROM HS_Request WHERE xRequest = ?’,array(PUTREQIDHERE));

Also, you could do it using the template plugin to get request info:

$request = $this->splugin(‘Request_Check’,‘getRequestDetails’,$this->get_id);

Then use

$request[‘sRequestPassword’];