vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   vBulletin-WordPress Bridge (https://vborg.vbsupport.ru/showthread.php?t=94443)

Gellpak 10-26-2005 08:49 PM

Quote:

Originally Posted by rsuplido
I understand that some of you would like to see user integration but why? Users with Wordpress accounts (authors and contributors) are very minimal. Majority of the blog sites probably just has one author. Why integrate the user database to vB then?

With this hack, you should:

1. Create accounts for blog authors in WordPress so they can create blog entries
2. Members register in vBulletin so they can reply

What's so difficult about that?

Oh, it's not, and it's what I'm doing now, but it makes building an admin control panel with everything at your fingertips a bit tougher. It would just be a much more elegant solution... I'm honestly suprised that given the popularity of both these programs that noone has done it already.

chanzero 11-18-2005 03:18 PM

loving this hack!

anybody have any hints or ideas on how to modify comments in lightpress or K2? i'd really like to try it with them...

99SIVTEC 11-18-2005 05:44 PM

I love this hack. It's the single best addition to my sites. The ONLY thing I would like to improve is the ability to post html to the forums. I always format my wordpress posts in html, but it posts to the forums in plain text. I have to go in and insert the html by hand into the forum post which isn't a huge deal, but it would be nice if it did it for me.

RyanC 11-18-2005 08:54 PM

Stupid question, but can you chose which blog entries have threads automatically started in your VB forum? It would be great if only the entries I designate are given a comment area and a thread in by forum...

Thanks!

chanzero 11-19-2005 05:17 PM

Quote:

Originally Posted by chanzero
loving this hack!

anybody have any hints or ideas on how to modify comments in lightpress or K2? i'd really like to try it with them...

i mean, modify it to show vb comments if that wasn't clear

and also, anyone have any idea how to possibly modify post pages (not necessarily in lightpress or K2) to show the comment form like a vb quick reply?

muf 12-07-2005 07:36 PM

In case anyone's interested, I've successfully gotten the bridge to associate WordPress nicknames with vB usernames. The condition for this to work is that your WP nicks *must* correspond with their vB nicks.
Just add this to the bridge block in admin/post.php:
PHP Code:

$vb_posterid $wpdb->get_var("SELECT userid FROM " $vb_dbprefix "user WHERE username = '" $user_nickname "'"); 

Then proceed to replace all occurrances (in post.php) of $vb_username with $user_nickname and all occurrances of $vb_userid with $vb_posterid. If no userid can be found for the nickname (WP-vB mismatch), the entry in the database will be set at 0 and the postbit will display the user as "Guest" and with "Posts: n/a". Of course, you add this modification at your own risk, the only guarantee you have is that it *works for me*. It is a little hackish (since I use $vb_posterid while i should abolish the $vb_username and $vb_userid in vb3-settings.php and do it all correctly, blah blah), so if anyone feels it should be done prettier, by all means go ahead.

rsuplido 12-07-2005 07:38 PM

LOL muf,

I was just doing the same change just now. Really!

Will post ist soon. :D

rsuplido 12-07-2005 07:53 PM

Posted the new version:

v1.2 (12/7/2005):
Uses correct vB user id and user name of the blog author. This will work only if the username of the Wordpress user is exactly the same as the vB username. If not, it uses $vb_userid and $vb_username defined in the settings.


Here's the updated code in post.php:
Code:

        // VB Bridge Start
                if ($vb_bridge) {
                        if ($post_title == "") {
                                return;
                        }

                        $saveid = $vb_userid;
                        $savename = $vb_username;

                        $author_name = $wpdb->get_var("SELECT `user_login` FROM $wpdb->users WHERE `id` = '$post_author'");
                       
                        if ($author_name != ""){
                                $vb_authorid = $wpdb->get_var("SELECT `userid` FROM " . $vb_dbprefix . "user WHERE `username` = '$author_name'");
                                if ($vb_authorid != ""){
                                        $saveid = $vb_authorid;
                                        $savename = $author_name;
                                }
                        }
                        $curtime = time();
                        $sql = "INSERT INTO `{$vb_dbprefix}thread`
                                        SET `title`='{$post_title}',`lastpost`='{$curtime}', `forumid`='{$vb_forumid}', `open`='1', `postusername`='{$savename}', `postuserid`='{$saveid}', `lastposter`='{$savename}', `dateline`='{$curtime}', `visible`='1'";
                        $vbresult = $wpdb->query($sql);
                        $vb_threadid = $wpdb->insert_id;
                       
                        if ($excerpt == ""){
                                $moreflag = strpos($content,'<!--more-->');
                                if ($moreflag === false) {
                                        $introtext = $content;
                                } else {
                                        $introtext = substr($content, 0, $moreflag);
                                }
                                $bbcontent = '[quote'.']'.strip_tags($introtext).'['.'/quote]';
                        } else {
                                $bbcontent = '[quote'.']'.strip_tags($excerpt).'['.'/quote]';
                        }
                        $bbcontent .= '[URL='.get_permalink($post_ID).']['.'b]'.$vb_readmessage.'['.'/b]['.'/URL]';                               
                        $sql = "INSERT INTO `{$vb_dbprefix}post`
                                        SET `threadid`='{$vb_threadid}', `username`='{$savename}', `userid`='{$saveid}', `title`='{$post_title}', `pagetext`='{$bbcontent}', `ipaddress`='{$REMOTE_ADDR}', `allowsmilie`='1', `iconid`='1',`visible`='1', `dateline`='{$curtime}'";
                        $vbresult = $wpdb->query($sql);
               
                        $sql = "UPDATE `{$vb_dbprefix}forum` SET `threadcount`=`threadcount`+1, `lastpost`='{$curtime}', `lastposter`='{$savename}', `lastthread`='{$post_title}', `lastthreadid`='{$vb_threadid}', `lasticonid`='1' WHERE `forumid`='{$vb_forumid}' LIMIT 1";
                        $vbresult = $wpdb->query($sql);
               
                  $sql = "UPDATE $wpdb->posts SET `vb_threadid`={$vb_threadid} WHERE `ID`='{$post_ID}'";
                        $vbresult = $wpdb->query($sql);
                }       
        // VB Bridge End


muf 12-08-2005 07:15 AM

Quote:

Originally Posted by rsuplido
Posted the new version:

v1.2 (12/7/2005):
Uses correct vB user id and user name of the blog author. This will work only if the username of the Wordpress user is exactly the same as the vB username. If not, it uses $vb_userid and $vb_username defined in the settings.


Here's the updated code in post.php:

Nice. But why do you get the username from the database when it is already fetched and ready for use as $user_nickname ? The code looks good but a little complicated :ninja:.

rsuplido 12-08-2005 12:55 PM

Quote:

Originally Posted by muf
Nice. But why do you get the username from the database when it is already fetched and ready for use as $user_nickname ? The code looks good but a little complicated :ninja:.

Actually, while they look the same, I wasn't sure if the 'user_nickname' is the same as 'user_login'. Isn't the nickname an alias and can be user defined? I just wanted to make sure.

The code got a bit complicated since I had to check if the wp username corresponds to a vB username. If not, I still use the default username and id defined in the settings.

Thanks.


All times are GMT. The time now is 03:30 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01335 seconds
  • Memory Usage 1,761KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (1)bbcode_php_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete