
Using WP-United to Integrate WordPress with PHPBB3.0
- June 15, 2016
- Leave a comment
PHPBB is a forum developed in PHP that provides support for multiple database engines, user groups, plugins and various notification options, etc. This article will take you through a guide to integrate WordPress with PHPBB version 3.0.x, so that the user (who logged-in WordPress already) can automatically log-in to PHPBB forum (same in the case of log-out). If a user registers for WordPress, at the same time a user account will also be created in PHPBB forum and vice versa.
In order to integrate WordPress with PHPBB3.0, you need to have WP-United WordPress Plugin, WP-United MOD for PHPBB3.0 and FTP Access. Follow the steps mentioned below while modifying PHPBB forum files:
1- Install WP-United plugin in your WordPress. Once installation is done, activate the plugin. Now go to plugin Dashboard and select PHPBB installation config.php file.
2- You need to install WP-United MOD in PHPBB manually by downloading it from Github. Once it is downloaded, you can modify or add the following files in PHPBB forum:
- phpbb_forum_root/includes/functions_content.php
- phpbb_forum_root/memberlist.php
- phpbb_forum_root/viewtopic.php
- phpbb_forum_root/includes/functions.php
- phpbb_forum_root/includes/functions_user.php
- phpbb_forum_root/includes/acp/acp_main.php
- phpbb_forum_root/style.php
- phpbb_forum_root/styles/prosilver/template/overall_header.html
- phpbb_forum_root/styles/prosilver/template/overall_footer.html
- phpbb_forum_root/styles/prosilver/template/memberlist_view.html
- phpbb_forum_root/styles/prosilver/template/viewtopic_body.html
- phpbb_forum_root/styles/prosilver/template/editor.js
- phpbb_forum_root/styles/prosilver/theme/common.css
After that, include the following files in MOD:
- root/includes/hooks/hook_wp-united.php
- root/language/
- root/styles/
- root/wp-united/
Now copy /root/includes/hooks/hook_wp-united.php file to phpbb_forum_root/includes/hooks/hook_wp-united.php, /root/language/ file to phpbb_forum_root /language/, /root/styles/ file to phpbb_forum_root/styles/ and /root/wp-united/ file to phpbb_forum_root/wp-united/ respectively. After this, refresh the WP-United Admin Dashboard page and click on Connect button.
The MOD is installed but not connected yet.
3- You need to modify the functions oriented files (like PHP files) mentioned below to get the MOD activated, using the following manual instructions carefully:
- Open includes/functions_content.php file, find function make_clickable($text, $server_url = false, $class = ‘postlink’) line of code and replace it with:
1234567891011if (!function_exists('make_clickable')){function make_clickable($text, $server_url = false, $class = 'postlink'){global $wpu_actions, $phpbb_root_path, $phpEx;require_once($phpbb_root_path . 'wp-united/wpu-actions.' . $phpEx);return $wpu_actions->do_make_clickable($text, $server_url, $class);}}function phpbb_make_clickable($text, $server_url = false, $class = 'postlink') - Open memberlist.php file, find the following lines of code:
12if (!empty($profile_fields['row'])){
Now add the following before the above mentioned lines of code:
12require_once($phpbb_root_path . 'wp-united/wpu-actions.' . $phpEx);$GLOBALS['wpu_actions']->generate_profile_link($member['user_wpublog_id'], $template); - Open viewtopic.php file, find the following lines of code:
12345}$db->sql_freeresult($result);// Load custom profile fieldsif ($config['load_cpf_viewtopic'])
Now add the following before the above mentioned lines of code:
12require_once($phpbb_root_path . 'wp-united/wpu-actions.' . $phpEx);$GLOBALS['wpu_actions']->generate_viewtopic_link($row['user_wpublog_id'], $user_cache[$poster_id]);
In the same file, find the following lines of code:
12// Dump vars into template$template->assign_block_vars('postrow', $postrow);
Now add the following before the above mentioned lines of code:
1$GLOBALS['wpu_actions']->show_viewtopic_link($user_cache[$poster_id], $postrow); - Open includes/functions.php file, find the following lines of code:
12function phpbb_check_hash($password, $hash){
Now put the following after the above mentioned lines of code:
12345678910111213141516171819202122232425/*** Modified by WP-United to allow portability between phpBB and other packages, as phpBB* applies htmlentities to inbound passwords via it's request_var function.*/$result = wpu_original_phpbb_check_hash($password, $hash);if($result){return $result;}$portable_password = isset($_REQUEST['password']) ? (string) $_REQUEST['password'] : '';$portable_password = (!STRIP) ? addslashes($portable_password) : $portable_password;if(empty($portable_password) || ($portable_password == $password)){return $result;}return wpu_original_phpbb_check_hash($portable_password, $hash);}function wpu_original_phpbb_check_hash($password, $hash){ - Open includes/functions_user.php file, find function validate_username($username, $allowed_username = false) line of code and replace it with the following:
12345678if(!function_exists('validate_username') && (!defined('WPU_BLOG_PAGE'))){function validate_username($username, $allowed_username = false){return phpbb_validate_username($username, $allowed_username);}}function phpbb_validate_username($username, $allowed_username = false) - Open includes/acp/acp_main.php file, find $cache->purge(); line of code and add the following after it:
12require_once($phpbb_root_path . 'wp-united/wpu-actions.' . $phpEx);$GLOBALS['wpu_actions']->purge_cache();
4- Now, edit the following remaining files to complete the integration:
- Open style.php file, find echo $theme[‘theme_data’]; line of code and add the following before it:
12require_once($phpbb_root_path . 'wp-united/wpu-actions.' . $phpEx);$theme['theme_data'] = $GLOBALS['wpu_actions']->css_magic($theme['theme_data']); - Open styles/prosilver/template/overall_header.html file, find <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”> line of code and replace it with <!– IF WP_DTD –>{WP_DTD}<!– ELSE –><!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”><!– ENDIF –>.Now find <title>{SITENAME} • <!– IF S_IN_MCP –>{L_MCP} • <!– ELSEIF S_IN_UCP –>{L_UCP} • <!– ENDIF –>{PAGE_TITLE}</title> line of code and add the following after it:
1<!-- IF PHPBB_BASE --><base href="{PHPBB_BASE}" /><!-- ENDIF →
Find <script type=”text/javascript”> line of code and add the following before it:
1<!-- IF WP_HEADERINFO_EARLY -->{WP_HEADERINFO_EARLY}<!-- ENDIF -->
Find </head> and add the following before it:
1<!-- IF WP_HEADERINFO_LATE -->{WP_HEADERINFO_LATE}<!-- ENDIF -->
Find <li class=”icon-faq”><a href=”{U_FAQ}” title=”{L_FAQ_EXPLAIN}”>{L_FAQ}</a></li> and add the following after it:
1<!-- IF S_BLOG --><li class="icon-members"><a href="{U_BLOG}" title="{L_BLOG}">{L_BLOG}</a></li><!-- ENDIF → - Open styles/prosilver/template/overall_footer.html file, find <!– IF TRANSLATION_INFO –><br />{TRANSLATION_INFO}<!– ENDIF → line of code and add the following after it:
1<!-- IF WP_CREDIT --><br />{WP_CREDIT}<!-- ENDIF --> - Open styles/prosilver/template/memberlist_view.html file, find the following lines of code:
12<dt>{postrow.PROFILE_FIELD1_NAME}:</dt> <dd>{postrow.PROFILE_FIELD1_VALUE}</dd><!-- ENDIF →
Now add the following after the above mentioned lines of code:
123<!-- IF U_BLOG_LINK --><dt>{L_BLOG}:</dt> <dd><a href="{U_BLOG_LINK}" title="{L_VISIT_BLOG}" >{L_VISIT_BLOG}</a></dd><!-- ENDIF --> - Open styles/prosilver/template/viewtopic_body.html file, find the following lines of code:
12<dd><strong>{postrow.PROFILE_FIELD1_NAME}:</strong> {postrow.PROFILE_FIELD1_VALUE}</dd><!-- ENDIF →
Now add the following after the above mentioned lines of code:
123<!-- IF postrow.U_BLOG_LINK --><dd><strong>{L_BLOG}:</strong> <a href="{postrow.U_BLOG_LINK}" title="{L_VISIT_BLOG}" >{L_VISIT_BLOG}</a></dd><!-- ENDIF --> - Open styles/prosilver/template/editor.js file, find document.write(‘<td bgcolor=”#’ + color + ‘” style=”width: ‘ + width + ‘px; height: ‘ + height + ‘px;”>’); line of code and replace it with document.write(‘<td bgcolor=”#’ + color + ‘” style=”width: ‘ + width + ‘px; height: ‘ + height + ‘px; background-color: #’ + color + ‘;”>’);.Note: Make this alteration only if you are using template integration because it is done for the compatibility of PHPBB forum with default WordPress template.
- Open styles/prosilver/theme/common.css file, find the following lines of code:
12h1 {/* Forum name */
Now replace it with the following:
1234h1, #page-header h1 {/* Forum name */padding: 0;text-align: left;
In the same file, find #site-description { line of code and add the following after it:
1text-align: left;
5- Go to WP-United Admin Dashboard, refresh it and then click on Connect button. You are done as WordPress and PHPBB 3.0 are integrated now.
6- Before doing any testing, complete the steps mentioned below:
- Remove PHPBB cache. For this, go to phpbb_root_dir/cache/ folder and delete all the files.
- Open phpbb_root_dir/rokbb3.php file and find the following code on line number 153:
1function get_avatar()
Now wrap the function deceleration with the following code:
1if(!function_exists(get_avatar())) - Now try to login from WordPress and check that a login session has been created automatically or not while navigating towards PHPBB forum in PHPBB forum.
- Similarly try to login from PHPBB forum and check that a login session has been created automatically or not while navigating towards WordPress in WordPress.
- If you get an error message like:
You need to remove this error. For this, open phpbb_root_dir/includes /startup.php file and find the following code in line number 22:
1error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);
Now replace it with error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT); code. If you have activated a different theme in your PHPBB forum rather than prosilver, then repeat the same steps with the activated theme as you have done with prosilver.
7- In case of any error, make sure that your PHPBB Server Settings (especially “script path“) and WordPress Settings are correct. After that, try re-installing.
If you are getting blank pages, turn on PHP error reporting or look into your Server log so that you can find the underlying cause of problem that persists.
User Comments