Skip to main content
Koen Sterken
Helper ⭐️⭐️
April 19, 2019

Awesome third party scripts

  • April 19, 2019
  • 15 replies
  • 1344 views



In this topic you can share cool third party scripts so we can learn from each other!

Format of the posts
Image
When you have a script that produces a visual outcome, add a screenshot! In Holland some people say 'Met plaatjes maak je maatjes', which translated to English means 'Images creates friends'.

Purpose
Why did you need the script? What problem were you trying to solve, or what cool idea did you have?

Code
The third party code itself. Please be so kind to add some comments so that other people also know what you have done.

Style
The custom styling you've added to make thinks look nice and position them.



Sidenote:
Third party scripts work for the version of the Insided software it was created for. When Insided changes its code, the scripts can fail. This is not the responsibility of Insided :)

Sidenote 2:
When copy/pasting my scripts I noticed that the text editor removes some html texts. So keep in mind that if you see
code:
jQuery : variable.html('this could be your text');

or
code:
Vanilla javascript: variable.innerHTML = 'this could be your text';

there could be missing some html tags. But I think adding html that way is kind of like bad practice (which I sometimes use as well) anyway.

15 replies

SmartlyGreg
Helper ⭐️⭐️⭐️
January 15, 2022

@DannyPancratz absolutely! I’ve done this on a few occasions actually.

This is the script:

<!-- Determine which HTML element is shown to what role -->
<script>
if (inSidedData.user.role == 'Member') {
$('#memberContent').removeClass().removeAttr('style');
} else if (inSidedData.user.role == 'Customer') {
$('#customerContent').removeClass().removeAttr('style');
} else if (inSidedData.user.role == 'Smartlie' || inSidedData.user.role == 'Service Ops') {
$('#smartlieContent').removeClass().removeAttr('style');
} else {
$('#defaultContent').removeClass().removeAttr('style');
}
</script>

And then you just need to have the top HTML element for each have the following:
1. The ids:

  • memberContent for role Member
  • customerContent for role Customer
  • smartlieContent for role Smartlie or Service Ops
  • defaultContent for all other roles

2. Have attribute ‘style=”display:none;”’

This will ensure nothing is displlayed unless you match a rule and the display none is removed by the script!

 

Note: Obviously you can change the ids you use and the roles need to match your own, but it should give you a pretty good sample of what is possible!

UPDATE: After I started using a secondary role for some users this meant the rule above did not work so I had to update it to use “includes()” instead of “==” as below:

if (inSidedData.user.role.includes('Customer')) { SCRIPT HERE }

 

DannyPancratz
VIP ⭐️⭐️⭐️⭐️⭐️
January 18, 2022

Thanks, @SmartlyGreg

FYI: I am no longer active in this community
DannyPancratz
VIP ⭐️⭐️⭐️⭐️⭐️
February 8, 2022


​​​​How to hide the 0 replies box

 

Here’s a script for hiding the 0 replies box for all topic types and move the Reply editor/composer WYSIWYG widget right below the original post. The amazing @matt enbar helped me implement this based on the conversation on this idea: 

 

FYI: I am no longer active in this community
SmartlyGreg
Helper ⭐️⭐️⭐️
March 23, 2022

@DannyPancratz for your previous request of doing things by custom role or role I have learnt that actually it might be safer/ more scalable to use “includes()” instead of “==”. This change allows for the cases where multiple roles are assigned to still work. (This was something we had not intended on doing at first but the discreet nature of roles actually allows us to use it as a kind of Tag now.)

So one role determines the users’ permissions and the other is just for back-end filtering/ analytics. This has resulted in breaking the role based rules I’d written with “==” because a Customer can have more than just one role, so using the “includes()” means we can catch any user with the role of customer without caring for the secondary role we added.

if (inSidedData.user.role.includes('Customer')) { SCRIPT HERE }

Update added to the content above too!

Hope this helps!

sleslie99
Contributor ⭐️⭐️⭐️
April 22, 2026

Gosh I Love all of these ideas and people sharing code. I’m going live this week with my recently migrated community and it was like pulling teeth to get people to share code with my old platform. 

Thank you everyone!!!

I love working with communities of people- online and in person!!!