Fork me on GitHub

Bridge or Port?  Bottom

  • I found a module that will be extremely helpful to me with a project im working on. The problem is that its for xoops and not PN. The module is called xdirectory and is a very good yellow pages type module. I think porting the module over to PN would be a little to difficult considering the linking structures of the two different CMS's. Im thinking that maybe just running them independently, but bridging the session/cookies and user tables might be easier.

    Anyone have any advice for bridging in general or even more specific if possible for briding xoops and PN.

    -MACscr

    P.S.
    Postnuke's awesome permissioning system and the Xanthia engine is the reason i cant just use xoops. Its not even close as powerful.
  • When I wanted to do this, I wrote a little intermediate script. Whenever I wanted to send someone to the third party script, I sent them to my intermediate first. This first checked if the user was a member of the third party script, and if not added them. Then it logged them in, and forwarded them on to whatever page had been requested.

    --
    itbegins.co.uk - Zikula Consulting

    birtwistle.me.uk - Personal Blog


    Please read the Support Guide
  • Mind sharing the script with me to see if i can learn anything from it?
  • Sure, it's not very complicated. It did rely a little on the API of the other program, vwar (did it for a friend's clan site).

    I'm not entirely certain this is the working version, but you get the idea

    Code

    <?php
    require 'includes/pnAPI.php';
    pnInit();

    $vwar_root = "modules/vwar/";

    require 'modules/vwar/includes/functions_common.php';

    $dbconn =& pnDBGetConn(true);
    $pntable =& pnDBGetTables();

    // Get user information
    $userscolumn = &$pntable['users_column'];
    $userstable = $pntable['users'];

    $uid = pnUserGetVar('uid');
    $uname = pnUserGetVar('uname');

    $query = "SELECT $userscolumn[pass]
              FROM $userstable
              WHERE $userscolumn[uid] = '"
    . pnVarPrepForStore($uid) ."'";

    $result =& $dbconn->Execute($query);

    if ($result->EOF) {
        return false;
    }

    list($pass) = $result->fields;
    $result->Close();
             
    // Get a list of groups
    // First load Groups API (need .760 for this)
    if (!pnModAPILoad('Groups', 'user')) {
    return pnVarPrepHTMLDisplay(_LOADFAILED);
    }

    $groups = pnModAPIFunc('Groups', 'user', 'getusergroups', array('uid' => $uid));
       
    foreach($groups as $group)
    {
        // group contains an array of group id and group name
        if($group['name'] == 'Administrators' OR $group['name'] == 'YM Members')
        {
            $ismember = 1;
        }
    }

    if($ismember == 1)
    {
        // User is a member, so lets try to log them in...
        $row = $vwardb->query_first("
            SELECT memberid,ismember
            FROM vwar"
    .$n."_member
            WHERE name = '"
    .$uname."'
            AND password = '"
    .$pass."'
            AND status <> '0'
        "
    );

            if ($row['memberid'] == 1)
            {
                SetVWarCookie("vwarid", $row['memberid']);
                SetVWarCookie("vwarpassword", $pass);
            }
            else
            {
                // They don't exist, so lets create...
                $vwardb->query_first("
                    INSERT INTO vwar"
    .$n."_member
                    SET
                    memberid = $uid,
                    name = $uname,
                    ismember = 1,
                    accessgroupid = 4,
                    password = $pass
                "
    );
            }
    }

    switch($action)
    {
        case 'admin':
            $url = 'modules.php?op=modload&name=vwar&file=admin';
        break;
        case 'roster':
            $url = 'modules.php?op=modload&name=vwar&file=member';
        break;
        case 'calendar':
            $url = 'modules.php?op=modload&name=vwar&file=calendar';
        break;
        case 'futmatch':
            $url = 'modules.php?op=modload&name=vwar&file=index&action=nextaction';
        break;
        case 'pastmatch':
            $url = 'modules.php?op=modload&name=vwar&file=index';
        break;
        case 'challenge':
            $url = 'modules.php?op=modload&name=vwar&file=challenge';
        break;
        case 'stats':
            $url = 'modules.php?op=modload&name=vwar&file=stats';
        break;
        default:
            $url = 'modules.php?op=modload&name=vwar&file=index';
        break;
    }

        pnRedirect($url);

    exit;
    ?>


    --
    itbegins.co.uk - Zikula Consulting

    birtwistle.me.uk - Personal Blog


    Please read the Support Guide
  • Thanks, i might actually be able to use this script for a different project for a buddy of mine. He wants to use vwar for his PN site too.
  • well, that isn't the working version, so you might need to change it a little ;)

    --
    itbegins.co.uk - Zikula Consulting

    birtwistle.me.uk - Personal Blog


    Please read the Support Guide
  • lol, sheesh, come on simon, u cant even give me working code? wink
  • can't even remember if I ever got it working ;) Should I, then I'll give you a working version!

    --
    itbegins.co.uk - Zikula Consulting

    birtwistle.me.uk - Personal Blog


    Please read the Support Guide
  • So your example might be one that doesnt even work? ah poo
  • 0 users

This list is based on users active over the last 60 minutes.