Hiding article voting from agents

4 コメント

  • Ifra Saqlain
    Community Moderator

    Hey Mark,

    Use this code, just copy and paste at your script template:

     if (HelpCenter.user.role=='agent') { 
    var articleVoteBlock = document.querySelector('.article-votes');
    articleVoteBlock.style.display = 'none';
    }

     

    Team

    2
  • Mark Rickard

    That's awesome, and it tests as expected. What's the syntax if we wanted to include admins as well?

    0
  • Ifra Saqlain
    Community Moderator

    So you can add user-role in the condition of code same as in the given code below.

    Just Copy and paste.

    if (HelpCenter.user.role=='agent' || HelpCenter.user.role == 'manager' ) {
    var articleVoteBlock = document.querySelector('.article-votes');
    articleVoteBlock.style.display = 'none';
    }

     

    If you want you can hide from rest users just adding user-role like this:

    Syntax of user-role:

    if (HelpCenter.user.role=='anonymous' || HelpCenter.user.role=='end-user' || HelpCenter.user.role == 'manager' || HelpCenter.user.role== 'agent'){

     

     

    Team

     

    0
  • Mark Rickard

    Brilliant. Thank you very much!

    0

サインインしてコメントを残してください。

Powered by Zendesk