Latest Register Log In

+ Advanced Search


05/22/11 (Edited 05/17/18)

Update: Most of this can now be accomplished more easily simply by installing WSN as a wordpress plugin using the plugins downloadable from

To have WSN use WordPress member logins, just go to Admin Panel -> Members -> Integration and select wordpress from the pre-supplied options. Important Note: With WordPress, the usergroup is called user level. 10 is the user level value for admins, 1 for contributors, 0 for subscribers, 2 for authors and 7 for editors -- be sure to use those values when mapping usergroups. There's no need to mape group 10 (admins) because the integration file already maps that to the administrators group automatically, and makes everybody else a regular member.

To display topics from WSN inside your wordpress, you can either use the javascript export or install a wordpress rss reader plugin so that you can call data from WSN's rss feeds (which can be crafted to produce whatever you need). Conversely, to display content from wordpress inside WSN you can use WSN's template rss parser (the url for a wordpress rss feed is your wordpress url plus /?feed=rss).

Cookie Integration

WSN can't get or set wordpress login cookies, because their format is complex and poorly documented. Fortunately there's an alternative that gets us most of the way there: have wordpress set WSN login cookies when users login to wordpress, and clear them when users logout of wordpress. We can do this by adding a plugin to wordpress. Follow these steps:

1. Via your FTP client, navigate to wordpress' wp-content/plugins/ subdirectory and create a subdirectory named wsnlogincookiesforwordpress in there.

2. With your desktop text editor (such as notepad), create a wsnlogincookiesforwordpress.php file with this content:

* @package WSN Login Cookies For Wordpress
* @version 1.0
Plugin Name: WSN Login Cookies For Wordpress
Plugin URI: [url=][/url]
Description: Sets and unsets WSN login cookies on wordpress login and logout.
Author: Paul Knierim
Version: 1.0
Author URI: [url=][/url]

$wsninfo['cookiepath'] = "";
$wsninfo['cookiedomain'] = "";

function setwsnlogincookies($user_login, $user)
global $wpdb, $wsninfo;
$id = $user->ID;
$hash = $wpdb->get_var( "SELECT user_pass FROM $wpdb->users WHERE ID=$id" );
if ($_REQUEST['rememberme']) $expiration = time()+86400*365*7; // 7 years
else $expiration = 0; // session only

setcookie("wsnuser", $id, $expiration, $wsninfo['cookiepath'], $wsninfo['cookiedomain']);
setcookie("wsnpass", $hash, $expiration, $wsninfo['cookiepath'], $wsninfo['cookiedomain']);

function unsetwsnlogincookies()
global $wsninfo;
$expiration = time() - 86400*365; // last year
setcookie("wsnuser", "", $expiration, $wsninfo['cookiepath'], $wsninfo['cookiedomain']);
setcookie("wsnpass", "", $expiration, $wsninfo['cookiepath'], $wsninfo['cookiedomain']);

add_action('wp_login', 'setwsnlogincookies', 10, 2);
add_action('wp_logout', 'unsetwsnlogincookies');


Make sure you don't have any leading or trailing whitespace.

3. If you've got a cookie path or cookie domain at Admin -> Settings -> System Configuration -> Cookie Info, fill in $wsninfo['cookiepath'] and $wsninfo['cookiedomain'] above.

4. Upload the wsnlogincookiesforwordpress.php file to the wsnlogincookiesforwordpress subdirectory you created.

5. Login to your wordpress admin panel, go to the plugins section, find the WSN Login Cookies For Wordpress plugin and click the "activate" link to enable it.

6. You may want to remove the login/logout/register links from your WSN via Admin -> Customizations -> Menu Manager (if the integrated wordpress theme already has wordpress versions of those links in the header/footer), or to change those to link to the wordpress versions.

Theme integration

The most important task is to make both parts of your site look alike as part of a unified whole website. If you check the box when WSN asks you if you want theme integration when you're integrating your members, this'll be done for you by replacing your stylesheet and automatically replacing sections of your wrapper template with the wordpress header, sidebar and footer.

If for some reason you're having to do this manually later, go to Admin Panel -> Themes -> Manage Templates -> "Wrapper" and insert this just below the <body> tag: {FUNC_WORDPRESSHEADER[/path/to/wordpress/]}. Make sure you change /path/to/wordpress to the appropriate file path of your wordpress installation. Relative paths are allowed, so if your WSN is a subdirectory of your wordpress you can use {FUNC_WORDPRESSHEADER[../]}. Next, insert {FUNC_WORDPRESSSIDEBAR[/path/to/wordpress]}{FUNC_WORDPRESSFOOTER[/path/to/wordpress/]} just above the </body> closing tag at the bottom of the wrapper. Again replace /path/to/wordpress/ with your path.

Have a look at your WSN front end now and you'll see your WSN site will be encapsulated in your wordpress header and footer. You may want to remove some redundant bits from your WSN wrapper template or menus.

Finally, you'll need to link to your WSN in an approprite place on a wordpress menu or page so people find it on your site.

Description Using WSN and WordPress together effectively.
Views 1621 views. Averaging 1 view per day.