Another attempt at integrating Phorum and Wordpress
Posted by achim
All files from this thread
| File Name | File Size | Posted by | Date | ||
|---|---|---|---|---|---|
| phorum.php | 6.5 KB | open | download | achim | 11/16/2006 | Read message |
| header.tpl | 2.6 KB | open | download | achim | 11/16/2006 | Read message |
| footer.tpl | 392 bytes | open | download | achim | 11/16/2006 | Read message |
|
Another attempt at integrating Phorum and Wordpress November 16, 2006 10:27AM |
Registered: 19 years ago Posts: 7 |
Hey,
I needed to integrate Phorum and Wordpress for a project I am working on. The existing solution
1) Is an ugly hack; phorum pages will not validate since the css is at the very top of the page, even before the <html> tag.
2) user authentication did never work for me.
No offense intended! Kudos to the developers of the first solution, I have reused much of your code and ideas.
Here's what I did:
- modified my template's header.tpl so that it properly includes wordpress headers, sidebar, and footer. you will have to do this part on your own, I can only provide mine for reference. Basically, take the header of your wordpress template (from template/<name>/header.php and copy it to the phorum template. add
add phorum stuff such as
in the body, you will need the wordpress sidebar somewhere:
for the footer, close all divs and use
I have attached my complete header/footer.tpl for reference. note that i used a static stylesheet obtained by running generateStaticCSS.php in the phorum scripts/ dir
- modified the existing user sync plugin for wordpress so that users are logged into phorum when they log in with wordpress. same for logout. please not that i only used cookie auth, i am not sure if uri session ids will work with an embedded phorum (it definitely does not as of now). in order for the plugin to work you will have to set use cookies to yes and probably also use tighter auth to no in your phorum settings. the plugin assumes that users in both forums have the same id. Should not be an issue if you do user signup and login through wordpress and use the sync plugin.
- in order to use the plugin you will have to add a custom hook into wordpress authentication. the original hook which is called after login only provides a username, but no password. without the password, a phorum session cannot be created.
in wp-login.php, find
the modified phorum.php is attached. feel frtee to ask any questions here.
cheers,
achim.
I needed to integrate Phorum and Wordpress for a project I am working on. The existing solution
1) Is an ugly hack; phorum pages will not validate since the css is at the very top of the page, even before the <html> tag.
2) user authentication did never work for me.
No offense intended! Kudos to the developers of the first solution, I have reused much of your code and ideas.
Here's what I did:
- modified my template's header.tpl so that it properly includes wordpress headers, sidebar, and footer. you will have to do this part on your own, I can only provide mine for reference. Basically, take the header of your wordpress template (from template/<name>/header.php and copy it to the phorum template. add
<?php
require('../wp-blog-header.php');
?>
at the very beginning. in the head, use standard wordpress stuff such as
<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />
<?php wp_head(); ?>
add phorum stuff such as
<style type="text/css">
{include css}
</style>
{IF URL->RSS}
<link rel="alternate" type="application/rss+xml" title="RSS-Feed" href="{URL->RSS}" />
{/IF}
{LANG_META}
{HEAD_TAGS}
in the body, you will need the wordpress sidebar somewhere:
<?php get_sidebar(); ?>
for the footer, close all divs and use
<?php do_action('wp_footer'); ?>
I have attached my complete header/footer.tpl for reference. note that i used a static stylesheet obtained by running generateStaticCSS.php in the phorum scripts/ dir
- modified the existing user sync plugin for wordpress so that users are logged into phorum when they log in with wordpress. same for logout. please not that i only used cookie auth, i am not sure if uri session ids will work with an embedded phorum (it definitely does not as of now). in order for the plugin to work you will have to set use cookies to yes and probably also use tighter auth to no in your phorum settings. the plugin assumes that users in both forums have the same id. Should not be an issue if you do user signup and login through wordpress and use the sync plugin.
- in order to use the plugin you will have to add a custom hook into wordpress authentication. the original hook which is called after login only provides a username, but no password. without the password, a phorum session cannot be created.
in wp-login.php, find
do_action('wp_login', $user_login);
immediately after that, add
do_action('wp_login_with_cred', array($user_login, $user_pass));
this will be the hook used by the modified sync plugin.
the modified phorum.php is attached. feel frtee to ask any questions here.
cheers,
achim.
|
Re: Another attempt at integrating Phorum and Wordpress January 25, 2007 04:31AM |
Registered: 19 years ago Posts: 16 |
Excellent, another attempt to get WordPress and Phorum playing nicely. If you can get a plugin/bridge that works without the hackiness of the original, you have my full support (I'm pretty sure I'm the only person working on improving the original plugin, and about all I've done to it is minor bug fixes).
Personally, I'm actually going to continue to use the first one, simply because hacking the WordPress files sucks for upgrading. However, please keep us updated as to whether or not you find a more elegant solution to the integration problem!
Aside from general ugliness in the code, I think templating is the biggest hurdle to integrating WordPress and Phorum, and was certainly where I had to tear the most hair out.
Edit: took a peek at your code. You should definitely grab the most recent version of the original WordPress-Phorum bridge that I've thrown up and snag the code that creates a WordPress Options screen. It's much easier for the user than editing the source code.
Beckism
One Crayon :: Beckism.com :: Tagamac
WordPress-Phorum Bridge
Edited 1 time(s). Last edit at 01/25/2007 04:34AM by Beckism.
Personally, I'm actually going to continue to use the first one, simply because hacking the WordPress files sucks for upgrading. However, please keep us updated as to whether or not you find a more elegant solution to the integration problem!
Aside from general ugliness in the code, I think templating is the biggest hurdle to integrating WordPress and Phorum, and was certainly where I had to tear the most hair out.
Edit: took a peek at your code. You should definitely grab the most recent version of the original WordPress-Phorum bridge that I've thrown up and snag the code that creates a WordPress Options screen. It's much easier for the user than editing the source code.
Beckism
One Crayon :: Beckism.com :: Tagamac
WordPress-Phorum Bridge
Edited 1 time(s). Last edit at 01/25/2007 04:34AM by Beckism.
|
Re: Another attempt at integrating Phorum and Wordpress January 25, 2007 01:18PM |
Registered: 19 years ago Posts: 7 |
thanks for your feedback!
i wasn't aware of a newer version of the bridge. will have a look at it sometime. an option page definitely sounds great!
maybe the recent wordpress 2.1 release will allow for a more elegant integration, without any code changes. unfortunately i'm quite busy now, so it'll take some time until i will be able to have a look.
as for templating, it totally agree. designing a one-fits-it-all template was definitely the most challenging part. i recommend using a css framework such as yaml (http://www.yaml.de, apparently not available in english). i am looking forward to a new release of your bridge, especially because of the integration template you announced!
achim.
i wasn't aware of a newer version of the bridge. will have a look at it sometime. an option page definitely sounds great!
maybe the recent wordpress 2.1 release will allow for a more elegant integration, without any code changes. unfortunately i'm quite busy now, so it'll take some time until i will be able to have a look.
as for templating, it totally agree. designing a one-fits-it-all template was definitely the most challenging part. i recommend using a css framework such as yaml (http://www.yaml.de, apparently not available in english). i am looking forward to a new release of your bridge, especially because of the integration template you announced!
achim.
Sorry, only registered users may post in this forum.