1
StarShaper
vBulletin-XOOPS Registration
  • 2006/5/19 5:31

  • StarShaper

  • Just popping in

  • Posts: 29

  • Since: 2005/7/25


Because there is no module/plugin to integrate a vBulletin 3.5.x Board into XOOPS I decided to write a registration and login bridge. If you want to do the registration only about your vBulletin form you can use the following plugin:

<?xml version="1.0" encoding="ISO-8859-1"?>

<plugins>
    <plugin active="1" product="vbulletin">
        <title>XOOPS_Registration_First</title>
        <hookname>register_addmember_complete</hookname>
        <phpcode><![CDATA[// Define tables and database
define("XOOPS_TABLE_PREFIX", "xoops__");

$tmp_xoops_uid = "NULL";
$tmp_xoops_uname = $vbulletin->GPC['username'];
$tmp_xoops_loginname = $vbulletin->GPC['username'];
$tmp_xoops_name = "";
$tmp_xoops_email = $vbulletin->GPC['email'];
$tmp_xoops_user_avatar = "blank.gif";
$tmp_xoops_pass = $vbulletin->GPC['password_md5'];  // Since vB uses md5(md5(password . salt)),
                                                    // we have to do this and call a second plugin later!
$tmp_xoops_rank = 0;
$tmp_xoops_level = 1;

// Fill in data into XOOPS user table
$db->query_write("INSERT INTO " . XOOPS_TABLE_PREFIX . "users (uid, uname, loginname, name, email, user_avatar, pass, rank, level)
                  VALUES ('$tmp_xoops_uid',
                          '$tmp_xoops_uname',
                          '$tmp_xoops_loginname',
                          '$tmp_xoops_name',
                          '$tmp_xoops_email',
                          '$tmp_xoops_user_avatar',
                          '$tmp_xoops_pass',
                          '$tmp_xoops_rank',
                          '$tmp_xoops_level')");

// Data for XOOPS user_profile table
$tmp_xoops_profileid = "NULL";
$tmp_xoops_umode = "nest";
$tmp_xoops_uorder = 1;
$tmp_xoops_notify_method = 2;
$tmp_xoops_notify_mode = 0;
$tmp_xoops_user_regdate = 0;    // TODO: Add this variable later!
$tmp_xoops_posts = 0;
$tmp_xoops_attachsig = 0;
$tmp_xoops_timezone_offset = "0";
$tmp_xoops_user_mailok = 0; // TODO: Add this variable later!
$tmp_xoops_theme = "0";
$tmp_xoops_actkey = substr(md5(uniqid(mt_rand(), 1)), 0, 8);    // This is from XOOPS source
$tmp_xoops_last_login = 0;    // TODO: Add this variable later!
$tmp_xoops_user_aim = "";
$tmp_xoops_user_icq = "";
$tmp_xoops_user_from = "";
$tmp_xoops_user_sig = "";
$tmp_xoops_user_viewemail = 0;
$tmp_xoops_user_yim = "";
$tmp_xoops_user_msnm = "";
$tmp_xoops_bio = "";
$tmp_xoops_user_intrest = "";
$tmp_xoops_user_occ = "";
$tmp_xoops_url = "";
$tmp_xoops_newemail = "";
$tmp_xoops_pm_link = "<a href="java script:openWithSelfMain(''{X_URL}/modules/pm/pmlite.php?send2=1&to_userid={X_UID}'', ''pmlite'', 550, 450);" title="Write a message to {X_UNAME}"><img src="{X_URL}/modules/pm/images/pm.gif" alt="Write a message to {X_UNAME}" /></a>";

// Fill in data into XOOPS user_profile table
$db->query_write("INSERT INTO " . XOOPS_TABLE_PREFIX . "user_profile
                  (profileid, umode, uorder, notify_method, notify_mode, user_regdate, posts, attachsig, timezone_offset,
                   user_mailok, theme, actkey, last_login, user_aim, user_icq, user_from, user_sig, user_viewemail,
                   user_yim, user_msnm, bio, user_intrest, user_occ, url, newemail, pm_link)
                   VALUES ('$tmp_xoops_profileid',
                           '$tmp_xoops_umode',
                           '$tmp_xoops_uorder',
                           '$tmp_xoops_notify_method',
                           '$tmp_xoops_notify_mode',
                           '$tmp_xoops_user_regdate',
                           '$tmp_xoops_posts',
                           '$tmp_xoops_attachsig',
                           '$tmp_xoops_timezone_offset',
                           '$tmp_xoops_user_mailok',
                           '$tmp_xoops_theme',
                           '$tmp_xoops_actkey',
                           '$tmp_xoops_last_login',
                           '$tmp_xoops_user_aim',
                           '$tmp_xoops_user_icq',
                           '$tmp_xoops_user_from',
                           '$tmp_xoops_user_sig',
                           '$tmp_xoops_user_viewemail',
                           '$tmp_xoops_user_yim',
                           '$tmp_xoops_user_msnm',
                           '$tmp_xoops_bio',
                           '$tmp_xoops_user_intrest',
                           '$tmp_xoops_user_occ',
                           '$tmp_xoops_url',
                           '$tmp_xoops_newemail',
                           '$tmp_xoops_pm_link')");]]></phpcode>
    </plugin>
    <plugin active="1" product="vbulletin">
        <title>XOOPS_Registration_Second</title>
        <hookname>register_activate_process</hookname>
        <phpcode><![CDATA[define("XOOPS_TABLE_PREFIX", "xoops__");

// Fetch data from vB user table
if ($tmpvbresults = $db->query_first("SELECT username, joindate, lastvisit FROM " . TABLE_PREFIX . "user WHERE userid = " . $vbulletin->GPC['u']))
{                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             $tmp_xoops_actkey = substr(md5(uniqid(mt_rand(), 1)), 0, 8);    // This is from XOOPS source
    // Fetch data from XOOPS users table, insert into groups_users_link and update user_profile
    if ($xoopsresults = $db->query_first("SELECT uid FROM " . XOOPS_TABLE_PREFIX . "users WHERE uname = '" . $tmpvbresults['username'] . "'"))
    {
        $db->query_write("INSERT INTO " . XOOPS_TABLE_PREFIX . "groups_users_link (linkid, groupid, uid) VALUES ('NULL', '2', '" . $xoopsresults['uid'] . "')");                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            $tmp_xoops_actkey = substr(md5(uniqid(mt_rand(), 1)), 0, 8);    // This is from XOOPS source
        $db->query_write("UPDATE " . XOOPS_TABLE_PREFIX . "user_profile SET user_regdate = " . $tmpvbresults['joindate'] . ", user_mailok = '1', last_login = " . $tmpvbresults['lastvisit'] . " WHERE profileid = " . $xoopsresults['uid']);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             $tmp_xoops_user_aim = "";
    }
}]]></phpcode>
    </plugin>
</plugins>


You have to set the prefix of your XOOPS tables (in this case it's set to "xoops__")! This simple instance assumes that the XOOPS tables are in the same database like the vBulletin tables. So we only have to do a simple query with an existing vB database object. If not, you have to create a new vB database instance and connect with the XOOPS database. vB 3.5.x uses a different User Hash (not a simple md5), so we have to call the plugin on two different Hook Locations. The first plugin will add a new XOOPS user when the vB registration process is complete. The second plugin will activate the user automatically in your XOOPS System as soon as the user sends his activation key via email.

Now you only have to insert a redirect to the vB Register form. Open the file register.php in your xoops/modules/profile/ directory and write something like this:

include '../../mainfile.php';
include_once 
'include/functions.php';

redirect_header(XOOPS_URL.'/forum/register.php'6"Please register on our forum.");


Fell free to change the values of the plugin. I'm using the vb connector.zip from vBulletin.org to handle a user login (session, cookies...). It acts as a bridge between vB and XOOPS. Thats all!

Regards
StarShaper



2
StarShaper
Automatic Thumbnails (Popup) using [thumb] tag
  • 2006/5/12 14:59

  • StarShaper

  • Just popping in

  • Posts: 29

  • Since: 2005/7/25


You could use a pretty good script for generating quick thumbs and popups under XOOPS. Take a look at http://phpthumb.sourceforge.net/.

Just write something like this:
[thumb=http://www.mysite.com/mypic.jpg]Title of picture[/thumb]


There are only 4 lines to change in module.textsanitizer.php. You could extend the script.

See: Demo

Download: phpThumb for XOOPS



3
StarShaper
Re: Bulletin Question
  • 2006/5/12 14:28

  • StarShaper

  • Just popping in

  • Posts: 29

  • Since: 2005/7/25


I wouldn't recommend to integrate vBulletin under XOOPS. I am using vB and XOOPS separately, too. You would have to do some ugly hacks to achieve the integration. Since vB 3.5.x supports plugins you could write a plugin for XOOPS without modifying the vB Code. Unfortunately you will have to check every XOOPS and vB Version for changes. It would be a quite annoying task. Additionally it isn't easy to write a good bridge plugin.

Actually I know that Mambo/Joomla provide a Connector/Bridge for vBulletin. Take a look at http://www.vbulletin.org/forum/index.php.



4
StarShaper
Re: Databse abstraction class (Multitype)
  • 2006/3/27 15:23

  • StarShaper

  • Just popping in

  • Posts: 29

  • Since: 2005/7/25


Quote:
However, this doesn't mean we're ignoring your suggestion. In the next major release, PHP 5.1's PDO will be supported...


Wow, this are pretty nice news ! How do you suppose to implement PDO? Will there be an option to switch between the database classes?


What do you mean with "In the next major release"? (june, july...)?



5
StarShaper
How stopping XOOPS from replacing & through & a m p ; (Ampersand)?
  • 2006/3/25 19:22

  • StarShaper

  • Just popping in

  • Posts: 29

  • Since: 2005/7/25


-- problem solved --



6
StarShaper
Re: News 1.44 RSS bug?
  • 2005/12/24 6:23

  • StarShaper

  • Just popping in

  • Posts: 29

  • Since: 2005/7/25


I just have made an update from 1.42 to 1.44. I can confirm your problem. The reason for this behaviour is that the news module is caching RSS files.

Take a look at the function in backendt.php:

...
header ('Content-Type:text/xml; charset=utf-8');
$story = new NewsStory();    
$tpl = new XoopsTpl();
$tpl->xoops_setCaching(2);
$tpl->xoops_setCacheTime(3600);
if (!
$tpl->is_cached('db:system_rss.html')) {
    
$xt = new NewsTopicT($topicid);
...
}
$tpl->display('db:system_rss.html');


If you set caching for this template on the if clause won't be called and you always get the last result of the category which has been cached. This cached file is:

--> %%0B^0B9^0B9E10B9%%db%3Asystem_rss.html

One possibility to solve this problem is to disable caching. But usually it is better to make an individual rss file for every category. It seems that the template engine only generates one file. The file above. This is insufficient for caching.

I'm not a php coder but the php syntax is very similar to C/C++. So it isn't really difficult to solve this problem. The Smarty template engine supports CacheID's. It is the second parameter. So we only have to give the name of the actual category as the cache id.

Replace the last code in backendt.php through this one:

header ('Content-Type:text/xml; charset=utf-8');
$story = new NewsStory();
$tpl = new XoopsTpl();
$tpl->xoops_setCaching(2);
$tpl->xoops_setCacheTime(3600);
$xt = new NewsTopic($topicid);
if (!
$tpl->is_cached('db:system_rss.html'htmlspecialchars($xt->topic_title(), ENT_QUOTES) )) {
    
$sarray $story->getAllPublished($newsnumber0$restricted$topicid);
    if (
is_array($sarray) && count($sarray)>0) {
        
$sitename htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES);
        
$slogan htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES);
        
$tpl->assign('channel_title'xoops_utf8_encode($sitename));
        
$tpl->assign('channel_link'XOOPS_URL.'/');
        
$tpl->assign('channel_desc'xoops_utf8_encode($slogan));
        
$tpl->assign('channel_lastbuild'formatTimestamp(time(), 'rss'));
        
$tpl->assign('channel_webmaster'checkEmail($xoopsConfig['adminmail'],true));    // Fed up with spam
        
$tpl->assign('channel_editor'checkEmail($xoopsConfig['adminmail'],true));    // Fed up with spam
        
$tpl->assign('channel_category'htmlspecialchars($xt->topic_title(), ENT_QUOTES));
        
$tpl->assign('channel_generator''XOOPS');
        
$tpl->assign('channel_language'_LANGCODE);
        
$tpl->assign('image_url'XOOPS_URL.'/images/logo.gif');
        
$dimention getimagesize(XOOPS_ROOT_PATH.'/images/logo.gif');
        if (empty(
$dimention[0])) {
            
$width 88;
        } else {
            
$width = ($dimention[0] > 144) ? 144 $dimention[0];
        }
        if (empty(
$dimention[1])) {
            
$height 31;
        } else {
            
$height = ($dimention[1] > 400) ? 400 $dimention[1];
        }
        
$tpl->assign('image_width'$width);
        
$tpl->assign('image_height'$height);
        
$count $sarray;
        foreach (
$sarray as $story) {
            
$storytitle htmlspecialchars($story->title(), ENT_QUOTES);
            
$description htmlspecialchars($story->hometext(), ENT_QUOTES);
            
$tpl->append('items', array('title' => xoops_utf8_encode($storytitle), 'link' => XOOPS_URL.'/modules/news/article.php?storyid='.$story->storyid(), 'guid' => XOOPS_URL.'/modules/news/article.php?storyid='.$story->storyid(), 'pubdate' => formatTimestamp($story->published(), 'rss'), 'description' => xoops_utf8_encode($description)));
        }
    }
    
$tpl->display('db:system_rss.html'htmlspecialchars($xt->topic_title(), ENT_QUOTES));
}
else
    
$tpl->display('db:system_rss.html'htmlspecialchars($xt->topic_title(), ENT_QUOTES));
?>


This solves the bug in the news module.

cu



7
StarShaper
Re: Hostname of the database server - Unable to connect to database...
  • 2005/11/16 17:53

  • StarShaper

  • Just popping in

  • Posts: 29

  • Since: 2005/7/25


Problem fixed . There was a strange problem with the database which was fixed by my provider. Know it works fine.

Big Thx to m0nty for your help!

Regards
StarShaper



8
StarShaper
Re: Hostname of the database server - Unable to connect to database...
  • 2005/11/16 17:05

  • StarShaper

  • Just popping in

  • Posts: 29

  • Since: 2005/7/25


Quote:

m0nty wrote:
that seems strange.. i hate puzzling problems like that.. lol


I know what you mean .

Quote:

m0nty wrote:
i'm thinking now that it maybe the table character set correlation.. with an existing db, compared to the 1 you just installed..

xoops was tempremental i believe in some areas, altho i don't think XOOPS was to blame, more of how many changes were made from in between sql versions when they changed to 4.1


Hmmm, indeed it could be an incompability with the collation. Unfortunately I don't have enough Knowledge in MySQL to check this.



9
StarShaper
Re: Hostname of the database server - Unable to connect to database...
  • 2005/11/16 16:41

  • StarShaper

  • Just popping in

  • Posts: 29

  • Since: 2005/7/25


Quote:

m0nty wrote:
doublecheck mainfile.php to see if you made a typo somewhere or missed something out.. or added a / after the db host name server..


This was the first I did. Checked both files with Beyond Compare. Files are identical, except the path to XOOPS is different. But this doesn't matter



10
StarShaper
Re: Hostname of the database server - Unable to connect to database...
  • 2005/11/16 16:17

  • StarShaper

  • Just popping in

  • Posts: 29

  • Since: 2005/7/25


This is really strange! I have installed XOOPS in a seperate folder with the same database settings. It's working without any problems. But my original XOOPS Installation still produce the connection error .




TopTop
(1) 2 3 »



Login

Who's Online

185 user(s) are online (108 user(s) are browsing Support Forums)


Members: 1


Guests: 184


heyula,

more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits