Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Integrate osticket-with-wordpress-3.5.1
1. KodeLibrary.com
Just another code snippets library.
Menu
Integrate osTicket with WordPress
14 Replies
This guide ext ends t he st eps provide by Luciel from osTicket Forums.
The guide below is t est ed wit h lat est version of osTicket as of t his day, 1.7.0 and WordPress 3.5.1
I suggest first t o simply read (Only read) all st eps from t here first t o make your self familiarize, BUT follow t he st eps I ment ion below.
Luciel guide was helpful t o me t o creat e t his one for new osTicket version, so t hanks t o him.
NOTE:
1. osTicket t o be inst alled in a folder in root direct ory of WordPress.
2. You can name t he folder anyt hing, but need t o make sure we creat e a new empt y WordPress page wit h t he same name.
3. osTicket and WordPress should use same Dat abase.
4. Below code refers t o set up of osTicket inst alled in folder called t icket s
5. When you open t he URL, you see osTicket page wit hout any errors.
CHANGES:
St ep 1 = Open File main.inc.php (From root folder of osTicket )
PDFmyURL.com
2. Look for t his lines of codes:
PHP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include required files
require(INCLUDE_DIR.'class.osticket.php');
require(INCLUDE_DIR.'class.ostsession.php');
require(INCLUDE_DIR.'class.usersession.php');
require(INCLUDE_DIR.'class.pagenate.php'); //Pagenate helper!
require(INCLUDE_DIR.'class.log.php');
require(INCLUDE_DIR.'class.m crypt.php');
require(INCLUDE_DIR.'class.m isc.php');
require(INCLUDE_DIR.'class.tim ezone.php');
require(INCLUDE_DIR.'class.http.php');
require(INCLUDE_DIR.'class.nav.php');
require(INCLUDE_DIR.'class.form at.php'); //form at helpers
require(INCLUDE_DIR.'class.validator.php'); //Class to help with basic form input validation...please help im prove it.
require(INCLUDE_DIR.'class.m ailer.php');
require(INCLUDE_DIR.'m ysql.php');
Just below t hose lines past e t his code:
PHP
1
2
3
4
if (!strpos($_SERVER["SCRIPT _FILENAM E"], "/scp/")) {
$_SERVER["REQUEST _URI"]="/tickets/"; //replace tickets with sim ilar to any page nam e you want and should also m atch osT icket f
include(ROOT _DIR.'../wp-blog-header.php');
}
St ep 2 = Open header
.inc.php (From /include/client /)
Add a new line on very t op as:
PHP
1 <?php get_header(); ?>
Remove: All t he next lines below it t ill
PDFmyURL.com
3. 1 <body>, including <body> tag also
(Reason for t his: We do not want t wo head t ags, one coming from WordPress and anot her of osTicket , so we use from WordPress)
Aft er t hose changes, first few lines will look like:
PHP
1 <?php get_header(); ?>
2
<div id="container">
3
<div id="header">
St ep 2 = Open foot er
.inc.php (From /include/client /)
Add a new line at t he bot t om of t he file as:
PHP
1 <?php get_footer(); ?>
Remove: 2 lines from t he code you added above which are:
1 </body>
2 </htm l>
(Reason for t his: We do not want mult iple closing body and ht ml t ags, one from WordPress and anot her of osTicket , so we use from
WordPress which comes by calling get _foot er)
St ep 4 = Open open.php (From root folder of osTicket )
PDFmyURL.com
4. Delet e Line 48: $inc=’t hankyou.inc.php’;
And Add t his code in t hat place:
PHP
1 $n = $vars['nam e'];
2 $e = $vars['em ail'];
3 @header('Location: thankyou.php?n='.$n.'&e='.$e);
Aft er Removing and Adding Looks Like:
PHP
1
2
3
4
5
6
7
8
9
...
@header('Location: tickets.php?id='.$ticket->getExtId());
}
//T hank the user and prom ise speedy resolution!
$n = $vars['nam e'];
$e = $vars['em ail'];
@header('Location: thankyou.php?n='.$n.'&e='.$e);
}else{
...
St ep 5 = Creat e new file in osTicket folder wit h name as t hankyou.php
Add This Code inside:
PHP
1
2
3
4
5
6
7
8
9
<?php
//if(!defined('OST CLIENT INC') || !is_object($ticket)) die('Kwaheri rafiki!');
//Please custom ize the m essage below to fit your organization speak!
require('client.inc.php');
define('SOURCE','Web'); //T icket source.
require(CLIENT INC_DIR.'header.inc.php');
?>
PDFmyURL.com
5. 10
11
12
13
14
15
16
17
18
19
20
21
22
<div style="m argin:5px 100px 100px 0;">
<?php echo $_GET ['n']; ?>,<br>
<p>
T hank you for contacting us.<br>
A support ticket request has been created and a representative will be getting back to you shortly if necessary.</p>
<p>Support T eam </p>
</div>
<?php
require(CLIENT INC_DIR.'footer.inc.php');
?>
NOTE: If you enabled Aut oResponder t hen use t his code which shows email as well.
PHP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
//if(!defined('OST CLIENT INC') || !is_object($ticket)) die('Kwaheri rafiki!');
//Please custom ize the m essage below to fit your organization speak!
require('client.inc.php');
define('SOURCE','Web'); //T icket source.
require(CLIENT INC_DIR.'header.inc.php');
?>
<div style="m argin:5px 100px 100px 0;">
<?php echo $_GET ['n']; ?>,<br>
<p>
T hank you for contacting us.<br>
A support ticket request has been created and a representative will be getting back to you shortly if necessary.</p>
<p>An em ail with the ticket num ber has been sent to <b><?php echo $_GET ['e']; ?></b>.
You'll need the ticket num ber along with your em ail to view status and progress online.
</p>
<p>
If you wish to send additional com m ents or inform ation regarding sam e issue, please follow the instructions on the em ail.
</p>
<p>Support T eam </p>
</div>
<?php
require(CLIENT INC_DIR.'footer.inc.php');
PDFmyURL.com
6. 27
28 ?>
That ’s it , now t est t he page.
PLEASE NOTE: The page format may be dist urbed but it is because of css file not being applied. You need t o handle t hat yourself.
Guiding on t he same would be anot her t opic.
You may find css code in asset sdefault css. You can copy codes from t here, and add it t o your WordPress t heme css file which is
st yle.css
Please leave your comment s or quest ions here.
Rating: 8.1/10 (10 votes cast)
Rating: +5 (from 5 votes)
Int egrat e osTicket wit h WordPress, 8.1 out of 10 based on 10 rat ings
This entry was posted in osTicket, PHP, WordPress and tagged osTicket, osTicket 1.7.0, osTicket WordPress Guide, osTicket WordPress Integration,
WordPress, WordPress 3.5.1 on May 26, 2013 by Dhruwal Patel.
← Remove WordPress Generat or Met a Tag as Securit y Precaut ion
14 t hought s on “Int egrat e osTicket wit h WordPress”
Carson
PDFmyURL.com
7. July 17, 2013 at 2:12 pm
perfect guide, worked well. good one.
t hanks.
Rating: 4.0/5 (1 vote cast)
Rating: +1 (from 1 vote)
Reply ↓
Jim
July 22, 2013 at 6:21 pm
Hi,
Thank you, t hank you for t his. I’ve now managed t o int egrat e OSTicket int o my wordpress t heme.
I’ve st ill got t he Error 404 Not Found in t he header of my ost pages, but apart from t hat it works great .
Rating: 5.0/5 (1 vote cast)
Rating: +1 (from 1 vote)
Reply ↓
KodeLibrary.com Admin
July 22, 2013 at 6:25 pm
PDFmyURL.com
8. Great .
404 on which ost pages? Send det ails on info@kodelibrary.com
Rating: 0.0/5 (0 votes cast)
Rating: 0 (from 0 votes)
Reply ↓
Jim
July 22, 2013 at 7:43 pm
Dhruwal, t hanks for your help, creat ing t he empt y wordpress page Support fixed it for me.
Thanks again.
Jim
Rating: 5.0/5 (1 vote cast)
Rating: +1 (from 1 vote)
Reply ↓
andrew
August 12, 2013 at 11:41 am
Hi,
I’d like t o use OSt icket for my wordpress websit e. Will it use t he same user account ?
PDFmyURL.com
9. I want t o give t his support only for regist ered wordpress users.
Please advise. Many t hanks.
andrew
Rating: 0.0/5 (0 votes cast)
Rating: 0 (from 0 votes)
Reply ↓
KodeLibrary.com Admin
August 12, 2013 at 11:51 am
Current ly you may get 2 separat e users login. WordPress and OSTicket logins are not merged.
However few simple codes can make WordPress add a new user t o OSt icket user t able as well t o keep in sync since t hey are under
same dat abase.
t his way you can achieve what you looking for
.
Rating: 0.0/5 (0 votes cast)
Rating: 0 (from 0 votes)
Reply ↓
SJ
September 20, 2013 at 12:49 pm
PDFmyURL.com
10. Can you also add st eps how t o int egrat e login syst em? So t hat it act s as SSO?
Thank you!
Rating: 0.0/5 (0 votes cast)
Rating: 0 (from 0 votes)
Reply ↓
chris
September 21, 2013 at 5:15 am
Ive followed t hese st eps wit h wp3.6.0 and ost 1.7.1.2 but no love… whenever i t ry t o access t icket s from t he client side t he login form
just refreshes wit h no errors. The ost log shows a successful user login but t he t icket doesn’t act ually display. any help would be great ly
appreciat ed
Rating: 0.0/5 (0 votes cast)
Rating: 0 (from 0 votes)
Reply ↓
Páll Svansson
October 18, 2013 at 11:13 pm
Hi! Great t ut orial and everyt hing works but when I act ivat e knowledgebase somet hing funky happens t o t he front page. Body does not
PDFmyURL.com
11. enfold – st ops at t he menu.
Rating: 0.0/5 (0 votes cast)
Rating: 0 (from 0 votes)
Reply ↓
Craig
October 25, 2013 at 8:36 am
What version did you use t o make t his conversion? I have read and re-read your inst ruct ions and compared t hem t o ot hers who have
done t he same. t here is not any difference. I am using OSTicket 1.7.0. I t hought t he downgrade from 1.7.2 would do t he t rick but I st ill
get maybe 10 lines of code and t he rest seems like it get s t runcat ed. Any advise on what I am doing wrong? Thanks in advance.
Rating: 0.0/5 (0 votes cast)
Rating: 0 (from 0 votes)
Reply ↓
KodeLibrary.com Admin
November 28, 2013 at 9:24 pm
I used 1.7.0 and WordPress 3.5.1.
I will t ry t o updat e t his post t o support new version of WordPress and OSTicket .
Rating: 0.0/5 (0 votes cast)
PDFmyURL.com
12. Rating: 0 (from 0 votes)
Reply ↓
swk
December 12, 2013 at 1:21 pm
it s been awhile since t he new version came out . would be cool if you updat ed.
Rating: 0.0/5 (0 votes cast)
Rating: 0 (from 0 votes)
Reply ↓
Danny
December 13, 2013 at 6:48 pm
Seems t he 1.8 OsTicket main.inc.php file has change quit e a bit . I was t rying t o see if I could just modify t he “Landing Page” but I got
side t racked.
Rating: 0.0/5 (0 votes cast)
Rating: 0 (from 0 votes)
Reply ↓
Danny
PDFmyURL.com
13. December 14, 2013 at 4:41 pm
This is what I did for t he main.inc.php
#Cleanup magic quot es crap.
if(funct ion_exist s(‘get _magic_quot es_gpc’) && get _magic_quot es_gpc()) {
$_POST=Format ::st rip_slashes($_POST);
$_GET=Format ::st rip_slashes($_GET);
$_REQUEST=Format ::st rip_slashes($_REQUEST);
}
if (!st rpos($_SERVER["SCRIPT_FILENAME"], “/scp/”)) {
$_SERVER["REQUEST_URI"]=”/support /”; //replace t icket s wit h similar t o any page name you want and should also mat ch osTicket
folder name.
include(ROOT_DIR.’../wp-blog-header
.php’);
Rating: 0.0/5 (0 votes cast)
Rating: 0 (from 0 votes)
Reply ↓
Leave a Reply
Your email address will not be published. Required fields are marked *
Name *
PDFmyURL.com
14. Email *
Websit e
Comment
You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title=""
data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">
Po s t Co mment
Searc h
KODELIBRARY C AT EGORIES
PDFmyURL.com
15. Development Language
PHP
Development Platform
osTicket
WordPress
General
REC ENT C ODE POS T S
Integrate osTicket with WordPress
Remove WordPress Generator Meta Tag as Security Precaution
Hide Top Admin Bar for all the WordPress Users
Add ‘Edit’ Link below the content in WordPress
Add Meta Tags in Header without Plugin in WordPress
REC ENT C OMMENT S
Danny on Integrate osTicket with WordPress
Danny on Integrate osTicket with WordPress
swk on Integrate osTicket with WordPress
KodeLibrary.com Admin on Integrate osTicket with WordPress
KodeLibrary.com Admin on Add Meta Tags in Header without Plugin in WordPress
KODELIBRARY T AG C LOUD
PDFmyURL.com
16. Add Meta Tags c o de library c o de s nippets Edit Co ntent Func tio n.php Func tio ns .php Go o gle CDN Header hello wo rld Hide Admin Bar jQuery jQuery 1.8.3 o s Tic ket
o s Tic ket 1.7.0 o s Tic ket Wo rdPres s Guide o s Tic ket Wo rdPres s Integratio n
Generato r Meta Tag Sec urity Prec autio n s nippets library
WordPress Code Snippet
PHP Remo ve Generato r Meta Tag Remo ve Wo rdPres s Generato r Meta Tag RSS
Without Plugin
WordPress WordPress 3.5.1
Wo rdPres s Admin Bar
Wo rdPres s Co ntent Wo rdPres s Edit Link Wo rdPres s Generato r Meta Tag Wo rdPres s Hide Admin Bar
Proudly powered by WordPress
PDFmyURL.com