Jump to content

How to remove IP Adress from ticket?


criat

Recommended Posts

bonus marks for the sentiment in the image! :)

 

it's simple to remove most of what you ask - apart from the actual IP address number (the hidden part in your image).

 

the IP address isn't passed as a variable to the template, nor is it stored in the db separately, but it's added to the ticket message by whmcs - so I think you'd have to do a regex search on the message, pull the IP address into a variable and then you could use it... or alternatively, use a hook to remove the last couple lines from ticket messages.

Link to comment
Share on other sites

My hosting company uses WHMCS and they removed it

i'd be tempted to say ask them how they did it and, if they tell you, share it with the rest of us! :)

 

Any way to interact with {$reply.message} to remove it or something? I don't know about hooks and such, would take ages for me to learn and come up with a fix

I don't know about writing hooks either... no doubt, one day i'll have to play with them... but that day is not upon me yet!

 

one thing that you need to understand is that {$xxx} is not necessarily a simple variable, it can be assembled from any number of separate variables, strings etc - so when it gets called by the template, the individual parts may not be available to us and we're effectively just trying to tweak the output (which has limits).

 

however, try replacing {$reply.message} in viewticket.tpl with...

 

{$reply.message|replace:'----------------------------':''|regex_replace:'/IP Address: (\d|[1-9]\d|1\d\d|2([0-4]\d|5[0-5]))\.(\d|[1-9]\d|1\d\d|2([0-4]\d|5[0-5]))\.(\d|[1-9]\d|1\d\d|2([0-4]\d|5[0-5]))\.(\d|[1-9]\d|1\d\d|2([0-4]\d|5[0-5]))$/':''}

this works for me locally.

Link to comment
Share on other sites

errr.... you didn't think to test it yourself before posting? :?:

 

*sighs*

 

no it will not hide numbers, it will not hide IP addresses - but yes, if a customer is foolish enough to use the *exact* phrase "IP Address: xxx.xxx.xxx.xxx" in their ticket, then it will get removed... but short of running a hacked version of WHMCS, it's probably the best solution you're going to find! :)

Link to comment
Share on other sites

Sorry for the trouble brian, but I'm trying to remove the remaining <br> codes that remains there, here's my try:

 

{$reply.message|replace:'----------------------------':''|regex_replace:'/IP Address: (\d|[1-9]\d|1\d\d|2([0-4]\d|5[0-5]))\.(\d|[1-9]\d|1\d\d|2([0-4]\d|5[0-5]))\.(\d|[1-9]\d|1\d\d|2([0-4]\d|5[0-5]))\.(\d|[1-9]\d|1\d\d|2([0-4]\d|5[0-5]))$/':''|regex_replace:'/<br><br><br>$/':''}

 

 

Didn't work though, lol

 

Actual ticket coding:

<div class="internalpadding clientmsg">

       Let's go!<br>
<br>
<br>




   </div>

 

Maybe the line breaks between <br> are causing regex_replace to miss it?

Link to comment
Share on other sites

actually, as I was coding the solution and saw the break returns in the source code, I thought "he's going to want me to get rid of these too !" :roll:

 

there is a way to get rid of them, but frankly I wouldn't bother - let me explain why...

 

as a test, if you use the following code to replace {$reply.message}

 

{$reply.message|replace:'----------------------------':''|regex_replace:"/<br(\s*)?\/?\>/":""|regex_replace:'/IP Address: (\d|[1-9]\d|1\d\d|2([0-4]\d|5[0-5]))\.(\d|[1-9]\d|1\d\d|2([0-4]\d|5[0-5]))\.(\d|[1-9]\d|1\d\d|2([0-4]\d|5[0-5]))\.(\d|[1-9]\d|1\d\d|2([0-4]\d|5[0-5]))$/':''}

this will remove all break returns from the message - on a live setup, you shouldn't use the above for the obvious reason that it would mess up the format of the ticket text layout... but do so and all the <br/> will be removed.

 

however, the space is still there even when they're removed - so what is creating the space is the css for the <div> - so to reduce that space, you need to edit whmcs.css and alter the following...

 

.whmcscontainer .ticketmsgs .clientmsg {

margin: 0 10px;

padding: 10px 15px;

min-height: 100px;

background: #f4f4f4;

border: 1px solid #ccc;

border-top: 0;

border-bottom: 0;

}

change the line in red to a smaller number - 25px is probably fine for a one-line ticket, but have a play with it in your own template to figure out the most appropriate size.

 

as an aside, you could in theory alter the regex to replace "\n" which is what is generating the break returns, but for the life of me, I couldn't get it to work - then when I found their presence only having a small influence on the output, I gave up trying to fix it! :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated