Here is the updated Wordpress tutorial. We have tested it with Wordpress 4.2.2 and PHPRunner 8.0.

This tutorial assumes that Wordpress and PHPRunner project are located on the same level of web server hierarchy. In our example Wordpress is installed to http://localhost/wordpress and PHPRunner app is installed to http://localhost/phprunner. You will have to adjust the path to Wordpress folder if your setup is different.

If everything is setup properly users logged in to Wordpress will be logged in to PHPRunner application as well. If you do not need this functionality or your PHPRunner project doesn't use security you can skip step 2 and 3.



1. Install and activate embed-iframe Wordpress plugin

This plugin allows to insert an iframe into any post.

2. Modify Wordpress's wp-config.php file adding the line in bold:


Quote
define('WP_DEBUG', false);
define( 'COOKIEPATH', "/" );


This allows to share Wordpress cookies across the whole website.

3. AfterAppInit event of PHPRunner project

define('WP_USE_THEMES', false);
// modify path to Wordpress folder if required
require('../wordpress/wp-blog-header.php');
$user
=wp_get_current_user();
$username
= $user->user_login;
$displayname
= $user->display_name;
$group
= $user->allcaps["administrator"]==1 ? "administrator" : "";
if ($username!="")
{
        $_SESSION
["UserID"] = $username;
        $_SESSION
["GroupID"] = $group;
                $_SESSION
["UserName"] = $displayname;
       
if ($group=='administrator')
                $_SESSION
["AccessLevel"] = ACCESS_LEVEL_ADMIN;
       
else
                $_SESSION
["AccessLevel"] = ACCESS_LEVEL_USER;
}
else
{
   $_SESSION
["UserID"] = "";
   $_SESSION
["AccessLevel"] = "";
   $_SESSION
["GroupID"] = "";
   $_SESSION
["UserName"] = "";
}


4. In any post insert iframe code snippet pointing to one of PHPRunner pages:

[iframe http://localhost/phprunner/documents_list.php 650 400]



If you done everything right you are supposed to see something like this:
Posted Image

If something went wrong you will see PHPRunner's login page in iframe.

Post a Comment