3. A forum in a blog ?

 

At first it was all good, we had our users who were able to login, viewing the site, make comments and create posts on the forum. The next step was to make sure that the forum was surrounded by our wordpress theme.

When viewing our site you saw the nice header, a sidebar and a footer navigation designed for a flawless ux. If you visited the forum all of this was gone; the forum goes fullscreen and al your handy navigation was “lost”.

 

 

A solution was needed and a few tricks were able to provide this.

WordPress point of view

WordPress consist of pages with a certain content. This content could be standard text, images, embedded video’s and even php if necessary.

Baddest idea:
Using a php plugin which allows php written in a post. Logically, copy-pasting the content of our index.php doesn’t work.

Badder idea:
Using a combination of wp-load.php and a new php file with the following content:

  1. <?php
  2. require_once(dirname(__FILE__) . '/wp-load.php');
  3. get_header();
  4. ?>
  5. <head>
  6. <style type="text/css">
  7. #content-body {
  8. display:none !important;
  9. }
  10.  
  11. #content_next_event {
  12. display:none !important;
  13. }
  14.  
  15. #test {
  16. display:inline-block;
  17. margin-top: 10px;
  18. padding-bottom: 10px;
  19. background: #FFFFFF;
  20. height: auto !important;
  21. border-bottom: 20px solid #EDEDED;
  22.  
  23. }
  24. </style>
  25. <script language="JavaScript">
  26. <!--
  27. function calcHeight()
  28. {
  29. //find the height of the internal page
  30. var the_height=
  31. document.getElementById('the_iframe').contentWindow.
  32. document.body.scrollHeight;
  33.  
  34. //change the height of the iframe
  35. document.getElementById('the_iframe').height=
  36. the_height;
  37. }
  38. //-->
  39. </script>
  40.  
  41. </head>
  42. <div id="the_iframe">
  43. <?php
  44. $a = file_get_contents('/forum/index.php');
  45. echo ($a);
  46. ?>
  47. </div>
  48.  
  49. <?php
  50. get_footer();
  51. ?>

Although the function “file_get_contents” does give me a forum inside wordpress, the functionality is zero.

Bad idea:
Using the iframe plugin for wordpress. I’m not beginning to discuss the advantage/disadvantage of an iframe, but this worked for me. Wel… at least for 70%

the forum is loaded in an iframe (with the setting   [iframe same_height_as=”content”]) but this can lead to some “funky” results. Loading a topic halfway and then rendering the page with a height of that topic but completely blank, not adjusting heights when opening attachments etc.

Not to mention the problem you’ll have with Google Analytics of not indexing.

We skip the good idea and go straight to the

Best idea:
Instead of bringing a forum to wordpress, why not do it the other way ?

4. A blog in a forum ?

Well, not fully a blog but only the header and the footer. But how do we achieve this ? By changing a few files in Smf.

in /forum:

index.php

add the following line above “$forum_version = ‘<your smf version’;>

require_once('/path/to/wp-load.php');

Now wait, when looking for this stuff, wordpress tells me I’ve to use:

<?php
require('/the/path/to/your/wp-blog-header.php');
?>

What’s the difference ? In this case when using wp-blog-header.php, I received false 404 headers on my external page.

A quick fix is either using wp-load.php or … deconstruct it into its component functions, excluding the bad ones.

WordPress is instantiated by calling the WP class.  Use the following: require_once(“/wp-config.php”);
$wp->init();
$wp->parse_request();
$wp->query_posts();
$wp->register_globals();
$wp->send_headers();

From the documentation:
init() — set up the current user.
parse_request() — Parse request to find correct WordPress query.
query_posts() — Set up the Loop based on the query variables.
register_globals() — Set up the WordPress Globals.
send_headers() — Sets the X-Pingback header, 404 status (if 404), Content-type. If showing a feed, it will also send last-modified, etag, and 304 status if needed.

And obviously, we’re leaving out handle_404().
handle_404() — Issue a 404 if a request doesn’t match any posts and doesn’t match any object (e.g. an existing-but-empty category, tag, author) and a 404 was not already issued, and if the request was not a search or the homepage. Otherwise, issue a 200.

Now, our page work as expected.

In /forum/Themes/<yourTheme>/

index.template.php

Look for “function template_html_above()” and add above:

require_once('/path/to/your/wordpress/theme/header.php');

Score ! We now have a fully functional forum with a wordpress header. Ofcourse we need to do alot of css styling to make sure that everything is proper in place. (Not to mention to remove the second doctype which is located in index.template.php)

Additional problem:

Buddypress was still giving some small issues.

The BuddyPress “rewriting” system is quite intricate (it’s called a “URI catcher”), in this case it breaks the request down and searches for an exact match in page slugs to provide the final URL, and the page slug in this case is register.

because of this rewrite rules. It changes “/forum/index.php?action=register” into “/register”, giving an error 404

So how to fix this ?

/wp-config.php:
at the bottom ad the following

define( 'BP_SKIP_REGISTRATION_REDIRECT', true );

/wp-content/plugins/bus/buddypress/bp-members/bp-members-signup.php:
paste the following at the end of the file, overwriting the excisting  function

function bp_core_wpsignup_redirect() {
	$action = !empty( $_GET['action'] ) ? $_GET['action'] : '';
 
	// Not at the WP core signup page and action is not register
	if ( false === strpos( $_SERVER['SCRIPT_NAME'], 'wp-signup.php' ) && ( 'register' != $action ) )
		return;
 
	if ( defined( 'BP_SKIP_REGISTRATION_REDIRECT' ) and BP_SKIP_REGISTRATION_REDIRECT ) return;
	// Redirect to sign-up page
	if ( locate_template( array( 'registration/register.php' ), false ) || locate_template( array( 'register.php' ), false ) )
		bp_core_redirect( bp_get_signup_page() );
}
//add_action( 'bp_init', 'bp_core_wpsignup_redirect' );

 

  76 Responses to “[EN] Integrate SMF in WordPress (and vice versa)”

  1. A program on numerous tools and applications for locksmiithing could play a role
    in your educational program.

    Look at myy pagve locksmith Chicago company, pixelhub.me,

  2. The Center announced in August that Lytle would tip
    down once his successor was called.

    Alsoo visit my web-site … Vascular Clinic

  3. It’s fantastic that you are getting thoughts from this
    paragraph as well as from our discussion made at this place.

  4. If you live where you get a lot of precipitation and snow you need to make sure that it will hold up to these
    type of conditions. Most times, when a new roof is installed on a building
    or home structure, it will be a big task. With little or no
    knowledge about roofing services, it can become
    difficult to understand the reliability and capabilities of a company.

  5. Great blog you have got here.. It’s hard to find good quality writing like yours nowadays.
    I seriously appreciate people like you! Take care!!

  6. For example, programming language principle considers numerous approaches to the
    outline of computation, whereas the research of computer programming itself investigates numerous
    features of the usage of programming language and sophisticated systems Human-computer interplay considers
    the challenges in making computers and computations useful, usable, and universally accessible to humans.
    Computer science started to be established as a
    definite educational self-discipline in the fifties and early
    sixties.

  7. Good post! We wil be linking to this particularly great post on our website.
    Keeep up the gret writing.

  8. In Acts of Creation: America’s Best Hand Craftsmen at Work, Walt Harrington particulars the work lives of fourteen American artisans, experts of their chosen crafts.

  9. There are literally thousands of movies out there, so your movie marathon night time can be whatever you want it to be.
    The movies offered under are just among the collections available.
    The subsequent time you’ve gotten a free evening why not strive
    a solo movie evening marathon.

  10. Most people assume they’re one other form of cable, and they’re close but the expertise behind their supply is different.
    The Secure 5, Buckshot, and Privates will all be
    obtainable direct from Outside Tech in July.

  11. MTV itself now provides streams of artists’ music movies, while AOL ‘s
    lately launched AOL Music features a huge collection of promoting supported streaming
    movies. Quotation wanted At its launch, Apple ‘s iTunes Retailer supplied
    a bit of free music videos in prime quality compression to be watched through the iTunes software.
    The Intercourse Pistols ‘ video for ” God Save the Queen ” was banned by the BBC for calling the United Kingdom
    a fascist regime.

  12. They difficulty licenses in two classes, specifically the S (Salesperson) and E (Estate
    agent) class.

  13. Preschoolers will like to ski, as long as their specific needs are saved in thoughts!

  14. Given that interest associated with online game increases,
    then your fascination to score leading things inside game increases and
    this makes people to search for the cheats the games by the
    assistance that they are able to get large scores without informing others about their particular hacking application.

  15. Hi thee everyone, it’s my first pay a quick visit at tthis web site, and post is in fact
    fruitful in support of me, keep up posting these typess oof
    posts.

  16. This piece of writing presents clear idea in support of the
    new viewers of blogging, that genuinely how to do running
    a blog.

  17. This hack works superb on all Android and iOS products,
    therefore don’t worry regarding the device. Hack doesn’t need root
    or jailbreak the device, so it’s easy and really fast to utilize
    a pleasant hacked hands per hour!

  18. I was wondering if you ever considered changing the layout of your site?
    Its very well written; I love what youve got to say. But maybe you could
    a little more in the way of content so people could connect with it better.
    Youve got an awful lot of text for only having 1 or 2 images.
    Maybe you could space it out better?

  19. Tombstone: this is the lifetime that have actually
    reduced to be less than 40 seconds from the 60 seconds used prior to.

    This is the second change from the offense over
    defense change and the skeletal system boost below
    is going to assist in maintaining the balance of the tombstone.

  20. Howdy I am so excited I found your website, I really found you by error, while I was
    searching on Yahoo for something else, Nonetheless I am here now and would
    just like to say cheers for a marvelous post and a
    all round enjoyable blog (I also love the theme/design), I don’t have time to read it all at the minute but I have saved it and
    also added in your RSS feeds, so when I have time I will be back to read more, Please do keep up the
    superb job.

  21. For the duration of latter year’s playoffs she was initially rooting contrary to the T. A. Kings. “They get an excess of. ” The woman stated. I must acknowledge the woman with slightly clairvoyant although I do not imagine she has been predicting a second pot upset ? result. The lady was entertaining for your Mn Outdoors.

  22. Robert/Nick: Very good opinions. Outlined on our site be interested to listen to associated with any kind of advantages in your SEARCH ENGINE MARKETING activities the moment this really is integrated.

  23. Start playing freerolls pokerstars italy download software
    program at french room of all.

  24. The second edition of PokerGuru Online League (PGOL) Season four concluded with an enormous
    INR sixty five.55 lakhs being awarded in prizes throughout
    the 5-day series. Over 2,200 gamers took in the 20 occasion schedule.

  25. La mayor parte dde las compañías no conceden microocréditos
    a loss clientes que están en ficheros de
    morosos como ASNEF,RAI EXPERIAN, aunque cadca vez hay más compañías que dejan dinero a los solicitantes con deudas impagadas registrados een las
    lustas de morosidad.

    Also visit mmy web-site … software Para gestión de créditos y Préstamos personales

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)

 
© 2012 Ceekes boarderline Suffusion theme by Sayontan Sinha