Link to home
Create AccountLog in
Avatar of mikovacic_ikon
mikovacic_ikon

asked on

Trying to bring together Wordpress and JCow

If I could award 1000 points for this I would... I have one domain I am using at ForumUniversal.com. the primary software I am running is JCow (PHP + MySQL). I am trying to add WordPress as a single sign-on addition in another folder. I was thinking of just merging members by having a utility that exports JCOW member list to a csv onto the server, then have wordpress import it, but the user would still have to log into both systems..  I am looking to see if anyone is familiar enough with wordpress where I could, even using a plugin, set up single sign on using JCow...

A little background on JCOW code... The attached code will populate when a user is logged in using Jcow. Can this jcow database query be used to run wordpress?


Any ideas you have even if it does not solve the problem would be a great help!

Thank in advance!

Lost in code.. Mike


<? require_once './includes/boot.inc.php'; 

Echo '<strong>'.$stats['members'].'</strong> '.t('Members strong!').'<br />';
ECHO 'Client ID is: '.$client['id'].'<br>';
ECHO 'Username is: '.$client['uname'].'<br>';
ECHO 'fullname is: '.$client['fullname'].'<br>';
ECHO 'birthmonth is: '.$client['birthmonth'].'<br>';
ECHO 'birthday is: '.$client['birthday'].'<br>';
ECHO 'avatar is: '.$client['avatar'].'<br>';
ECHO 'settings is: '.$client['settings'].'<br>';
ECHO 'profile_permission is: '.$client['profile_permission'].'<br>';
ECHO 'email is: '.$client['email'].'<br>';
ECHO 'Password is: '.$client['password'].'<br>';
ECHO 'Last Login is: '.$client['lastlogin'].'<br>';
ECHO 'level is: '.$client['level'].'<br>';
ECHO 'location is: '.$client['location'].'<br>';
ECHO 'ipaddress is: '.$client['ipaddress'].'<br>';
ECHO 'gender is: '.$client['gender'].'<br><br>';

?>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Julian Matz
Julian Matz
Flag of Ireland image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Or another thing you could do is this:

Make a page template for your wordpress theme. To do this, you can create a blank PHP script and enter a Template Name tag like this...

<?php
/*
 * Template Name: User Registration
 */

// ..........

?>

Open in new window


You then make a new page via the Wordpress dashboard and assign the template to it. For now, this page will be blank.

Then you could add the wp_insert_user(); function along with some security check to make sure only your JCow scripts can access it. You'll also need to catch some POST variables, but I'll get to that in a moment.

http://codex.wordpress.org/Function_Reference/wp_insert_user

You'd also need to modify your user registration script. Add a small cURL snippet that will connect to your Wordpress page. cURL will basically pass the new user details over to Wordpress using the POST method.

http://php.net/manual/en/book.curl.php

Along with the user details, you can create and add an access hash or something to the POST data.

You can then accept the POST data via your Wordpress page and process it via the wp_insert_user() function. The access hash can be verified like, for example:

<?php
/*
 * Template Name: User Registration
 */

$accessKey = '12345H';
$remoteKey = isset($_POST['key']) ? $_POST['key'] : NULL;

if ( $accessKey !== $remoteKey ) :
     die('Permission denied!');
endif;

// ..........

?>

Open in new window


I hope this makes at least some sense. Please bear in mind, I'm not familiar with JCow.