Skip to content

Instantly share code, notes, and snippets.

@mpstenson
mpstenson / BlackBoxPortal.php
Created July 15, 2020 14:43
This blackbox portal file loads a different ldap configuration based on the portal you are visiting. Useful for if you need multiple configurations of adldap.php for different domains
if (cMULTIPORTAL == 1) {
//if in secondary portal id 1 load adLDAP-1.php
require_once("adLDAP-1.php");
}
else{
//if we are not in a secondary portal load the default file.
require_once("adLDAP.php");
}
@mpstenson
mpstenson / timeToStatus.sql
Created November 8, 2018 15:50
Gets the time for a request to reach a certain status in HelpSpot
SELECT HS_Request.xRequest,
Cast(Floor(Round((ClosedEvents.ClosedTime-dtGMTOpened) / 60.0, 0) * 60 /
86400)
AS VARCHAR(10))
+ 'd '
+ CONVERT(VARCHAR(5), Dateadd(second,
Round((ClosedEvents.ClosedTime-dtGMTOpened) / 60.0, 0) * 60, '19000101'),
8) AS
opentime
FROM HS_Request
@mpstenson
mpstenson / blue.js
Created August 1, 2018 19:22
Set the customer id based on the select of a custom field select list
$jq(document).ready(function(){
$jq(document.body).on('change', '#Custom2' ,function(){
{
$jq("#sUserId").val($jq("#Custom2").val());
}});
});
@mpstenson
mpstenson / add-subject-line-to-portal.php
Created November 22, 2017 16:03
Add the subject line to a HelpSpot portal
<?php if ($this->hd_allowSubject): ?>
<p><label for="sCC" class="datalabel"><?php echo lg_portal_req_subject ?></label><br />
<?php echo $this->helper->showError('sTitle','<br />') ?>
<input type="text" name="sTitle" size="40" maxlength="250" value="<?php echo $this->request_sTitle ?>" />
</p>
<?php endif; ?>
@mpstenson
mpstenson / cc-in-portal.php
Created November 22, 2017 15:59
Code to add CC to a HelpSpot Portal
<?php if ($this->hd_allowCc): ?>
<p><label for="sCC" class="datalabel"><?php echo lg_portal_req_cc_email ?></label><br />
    <?php echo $this->helper->showError('sCC','<br />') ?>
    <input type="text" name="sCC" size="40" maxlength="250" value="<?php echo $this->request_sCC ?>" />
</p>
<?php endif; ?>

Keybase proof

I hereby claim:

  • I am mpstenson on github.
  • I am mpstenson (https://keybase.io/mpstenson) on keybase.
  • I have a public key ASBIAZwRpGeCVY8qjlnM2QXzpyCMiDvpDxyzkiho7thMiwo

To claim this, I am signing this object:

@mpstenson
mpstenson / index.tpl.php
Last active November 14, 2017 16:38
Require Login Before Creating Request
<?php
switch($this->get_page){
case "home":
include $this->loadTemplate('home.tpl.php');
break;
case "request":
if($this->splugin('Request_Check','isLoggedIn')){
include $this->loadTemplate('request.tpl.php');
}
<?php
//Set page title
$this->assign('pg_title',$this->get_id . ' : ' . lg_portal_checkrequest);
include $this->loadTemplate('header.tpl.php');
include $this->loadTemplate('navigation.tpl.php');
?>
<?php if($this->splugin('Request_Check','accessKeyIsValid',$this->get_id)): ?>
<h1><?php echo lg_portal_accessidheader ?> : <?php echo $this->get_id ?></h1>
@mpstenson
mpstenson / custom_field_date_comparison.sql
Created November 21, 2016 20:27
Compare a custom field's date (plus an offset) to the current date
dateadd(MINUTE,10,dateadd(S, Custom1, '1970-01-01')) < GETUTCDATE() and Custom1 <> 0;
@mpstenson
mpstenson / blue.js
Last active November 17, 2016 22:15
Helspot Admin Theme JS to add google analytics tracking code.
var analytics_script=document.createElement('script');
analytics_script.type='text/javascript';
analytics_script.text="(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');ga('create', 'UA-xxxxxxxx-x', {'siteSpeedSampleRate': 100});ga('send', 'pageview');";
document.head.appendChild(analytics_script);