Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

osTicket v1.10 (stable) and Maintenance Release v1.9.15 are now available! Go get it now

Inserting publicly accessible KB link into agent's reply

When an agent wants to insert link to a KB article they browse/search "Knowledgeable" for that article and the only way (that I see) to get link is to copy it from browser's address bar. So result it something like:

<site_url>/osticket/scp/faq.php?id=1

This link works for agent because he/she is logged in, but when a customer clicks on this link in their session they are redirected to login page.

If that article is public then agent would want to insert the following link into their response:
<site_url>/osticket/kb/faq.php?id=1
which will take customer directly to the article without login request

But how can agent get this link other than manually replacing "scp" part with "kb" each time they need to send it to customer?

Am I missing something here or it is worth adding feature request to https://github.com/osTicket/osTicket/issues?
For example I can think about searching for a publicly accessible link in the "Insert  link" form
Another option is having "get public link" button/link/just string on the article's page




Comments

  • You could add a textbox that contain the link or maybe make a button that will copy it for the agent

    <input value="<?php echo sprintf('http://domain.com/kb/faq.php?cid=%d', $category->getId())?>"/>
  • Or I would think that you could toggle the requirement to be logged into view KB articles.
  • @Micke1101: Thank you for the suggestion, I am now trying to implement it but with no success - that change is not reflect on article's page when I reload it. Should I clear cache?

    @ntozier: Thanks, can you please elaborate where I should do this?
  • Admin panel -> Settings -> Knowledgebase
    uncheck "require Client Login"
    Click Save Changes
  • Thank you ntozier, but I have "require Client Login" unchecked already. This does not help when customer receives link like <site_url>/osticket/scp/faq.php?id=1
    As far as I understand this only removes login requirement for link like <site_url>/osticket/kb/faq.php?id=1 and my question is how can an agent easy get the later link. Currently agent gets former one while they are logged in (being an agent)
  • Copy Link.  
    Paste Link.  
    Edit Link to change scp to kb.  
    Send response.
  • Thanks ntozier, that's exactly what I want to avoid as I wrote in the first post here:

    "But how can agent get this link other than manually replacing "scp" part with "kb" each time they need to send it to customer?"

    Agents send tons of replies every day. Basically that's why "canned reposes" and btw kb itself were invented... Agent may forget to do this replace or worse - make a mistake (typo) and send broken link to customer  
  • Put the correct link in the canned response.
    Save it.  Use the canned response.
  • Thanks ntozier, it is certainly an option. But over some time KB will have hundreds if not thousand articles, which are organized into categories and searchable. With single drop-down list of all canned responses it won't be that easy to find needed one
  • @michaelvi that's strange i just tried to add the code to a live site and it seems to work for me, you can try clearing the cache, depending on plugins on your server that could be the issue.

    2017-07-13 07-20-47.jpg
    1108 x 463 - 77K
  • edited July 13
    @Micke1101: Thanks, I have found that mod you suggest reflects on category page. 

    That's also useful, but I want to add this link to a particular article, i.e at kb.php?id=X, not kb.php?cid=X

    So I added the <input value="<?php echo sprintf('http://domain.com/kb/faq.php?cid=%d', $faq->getId())?>"/> to faq-view.inc.php at line 98 (after "Last updated")

    I believe there is some variable that expand to site public url? Or I should hard code part "domain.com"?



  • Just replacing cid with id should change that.

    Yea if you can access $cfg, you can get the sites url <input value="<?php echo sprintf('%s/kb/faq.php?cid=%d'$cfg->getUrl(), $faq->getId())?>"/>
  • Thanks Micke1101,

    it works, just one note: result of '$cfg->getUrl()' includes trailing slash, so finally I use:

    <a href="<?php echo sprintf('%skb/faq.php?id=%d', $cfg->getUrl(), $faq->getId())?>"><?php echo __('Public link');?></a>

    Next step is to make it clickable button that would copy url to clipboard (like "permalink" buttons I saw on other sites), working on it... Thank you for your help!
  • Correction: it is not '$cfg->getUrl()' that includes trailing slash. The result returned by this function is exactly what admin entered in settings. Since '$cfg->getUrl()' is probably used in other places it may give unexpected results. 
    Are there any rules/conventions/etc. about how URLs should be filled in settings?
  • edited July 30

    Hello michaelvi,


    i have a solution:

    edit: /var/www/html/include/staff/faq-categories.inc.php

    see 01.jpg

    edit: /var/www/html/include/staff/faq-category.inc.php

    see 02.jpg

    Now the agent can copy the link in "Public Link for: ... " and paste it in the ticket with the correct url. The best is ... drag and drop is possible for a categorie or a kb entry.

    Result:

    see 03.jpg

    see 03.jpg

    see 05.jpg

    Best Regards citrixraptor

  • the the jpg's
    01.jpg
    1054 x 316 - 39K
    02.jpg
    757 x 351 - 34K
    03.jpg
    554 x 445 - 40K
    04.jpg
    663 x 271 - 30K
    05.jpg
    823 x 450 - 51K
  • edited August 6
    @citrixraptor ,

    Thank you for your comment and code samples and sorry for so late reply, I was busy with other activities these days.

    It looks like we have a bit different versions of code. For example, in your screenshots I see code like $row['faq-id'] and my installation $faq->getId() is used, but I tried to apply your mod to my faq-category.inc.php adjusting for those differences:

        foreach ($faqs as $faq) {
    // citrixraptor's mod:
    echo sprintf(
       '<li><strong>Public link for:&nbsp;&nbsp;<a href="../kb/faq.php?id=%d>%s <span>%s</span>"></a></strong></li>',
    $faq->getId(),$faq->getQuestion(),$faq->isPublished() ? __('Published'):__('Internal'));
    // end of citrixraptor's mod
      echo sprintf('
                <li><strong><a href="faq.php?id=%d" class="previewfaq">%s <span>- %s</span></a> %s</strong>',
                $faq->getId(),$faq->getQuestion(),$faq->isPublished() ? __('Published'):__('Internal'),
                $faq->attachments ? '<i class="icon-paperclip"></i>' : ''
            );
    // my mod, 'adding public link':
    if ($faq->isPublished()) echo sprintf('<a href="%skb/faq.php?id=%d">public link</a>', $cfg->getUrl(), $faq->getId());
    // end of my mod 'adding public link'
    echo '</li>';
        }

    I now see your line with text "Public link for:" added to my page, but without following text, only link icon, and when I that link to an agent answer form it does add anything there (chrome). Do you have an additional tip of what I did wrong? A possibility to drag link is very attractive!

    Thank you again!

  • Hello michaelvi,

    here my version:

    Server Information
    osTicket Version v1.9.15 (70898b3) — Up to date
    Web Server Software Apache/2.4.10 (Debian)
    MySQL Version 5.5.57
    PHP Version 5.6.30-0+deb8u1


    Best Regards 
    citrixraptor
  • @citrixraptor ,

    thank you, I am running version 1.10 and that probably explains slight difference in the code...
  • Hello michaelvi,


    line 55-60:

    foreach ($faqs as $faq) {
            echo sprintf('
                <li><strong><a href="faq.php?id=%d" class="previewfaq">%s <span>- %s</span></a> %s</strong></li>',
                $faq->getId(),$faq->getQuestion(),$faq->isPublished() ? __('Published'):__('Internal'),
                $faq->attachments ? '<i class="icon-paperclip"></i>' : ''
            );


    is this your org. php code?

    Best Regards 
    citrixraptor


  • Hello citrixraptor,

    yes, and my mod is immediately after this:

    // my mod, 'adding public link':
    if ($faq->isPublished()) echo sprintf('<a href="%skb/faq.php?id=%d">public link</a>', $cfg->getUrl(), $faq->getId());
    // end of my mod 'adding public link'
     
  • Hello michaelvi,

    change your line from:

    if ($faq->isPublished()) echo sprintf('<a href="%skb/faq.php?id=%d">public link</a>', $cfg->getUrl(), $faq->getId());

    to:
    if ($faq->isPublished()) echo sprintf('<a href="../kb/faq.php?id=%d">public link</a>', $faq->getId());


    i think this will close your problem

    Best Regards 
    citrixraptor

  • Hello citrixraptor,

    so basically you suggest to use "../" instead of  $cfg->getUrl()?
    but I see that I am getting correct url from $cfg, and final result in href is correct. Or am I missing something?

    Thank you again,
    Michael
  • Hello michaelvi,

    what is the href  with our code line ($cfg->getUrl()   ):

    if ($faq->isPublished()) echo sprintf('<a href="%skb/faq.php?id=%d">public link</a>', $cfg->getUrl(), $faq->getId());


    compare it with my picture:



    Best Regards 
    citrixraptor


  • >> so basically you suggest to use "../" instead of  $cfg->getUrl()?
    As a test :-)

    >> but I see that I am getting correct url from $cfg, and final result in href is correct. 
    Ok ...


    >> Or am I missing something?
    mh ...

  • Hello citrixraptor,

    I am getting:

    <a href="http://support.<mycompany>.com/kb/faq.php?id=1">
                                  public link
                               </a>
    as expected. This is correct working link. 
    The problem is only that I cannot drag it into agent's response form (as you suggested in your first comment)
    But it IS draggable to, for example, Notepad++
Sign In or Register to comment.