Pre-populating user name and e-mail

When user provides her or his feedback by submitting idea, bug report or comment he needs to provide name and e-mail. 

If your website supports authorization and current user is logged in - most likely you know user name and e-mail and there is no good reason to force user to enter this information again. UserReport snippet provides possibility to pass default name and e-mail and user may choose to change it.

window._urq = window._urq || [];
_urq.push(['setFeedbackForumUserName', 'Alejandro']);
_urq.push(['setFeedbackForumUserEmail', 'alejandro@example.mail']);

Most likely, user name and e-mail is known on the server when rendering page, so here is example on PHP how it can de dynamically:

<?php 
// Assuming that getCurrentUser() function return assoc array with name and email keys, like 
// array('name' => 'Alejandro', 'email' => 'alejandro@example.mail')

$user = getCurrentUser();
?>
<script>
if ($user) 
  // Serialize object to protect again XSS injection
  var user = <?php echo json_encode($user); ?> 
  window._urq = window._urq || [];
  _urq.push(['setFeedbackForumUserName', user.name]);
  _urq.push(['setFeedbackForumUserEmail', user.password]);
)
</script>

If you add Feedback Forum into IFrame or generating URL to it dynamically you can also send default name and e-mail as well, by following adding userName and userEmail parameters in hash-part of URL. Here is example of such link:

https://feedback.userreport.com/ff479801-fc38-48bd-bf2d-a499ae38c02b/#submit/idea?userName=Alejandro&userEmail=alejandro@example.mail

Attachments

Comments

Powered by Zendesk