Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 11-12-2010, 07:23 PM
darsalles darsalles is offline
 
Join Date: Oct 2009
Posts: 45
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Vb4 Recent Post Block (sidebar)

I was wondering where I can extract this code from my forum, to display the same thing on a wordpress page.

1.- Both installation uses the same datatabase, username,pass y dbname
2.- The Wordpress is installed on / and forum on /foro/

Please someone could help me please.
Reply With Quote
  #2  
Old 11-12-2010, 07:56 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

All the code for the forum blocks are in the includes/block directory.
Reply With Quote
  #3  
Old 11-12-2010, 08:23 PM
darsalles darsalles is offline
 
Join Date: Oct 2009
Posts: 45
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks, I have just found the code I need (newposts.php) any tips for including it on my site :s

I paste it on it but im getting this error:
Quote:
Fatal error: Class 'vB_BlockType' not found in /xxx/xxxxx....
Supose that like the config.php its on /foro/includes/ and the site on / it doesnt recognice the stylevars of vbulletin, tables, etc.

Please help ^^
Reply With Quote
  #4  
Old 11-12-2010, 08:27 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You'll have to create any css you may need and add it to the page.

If it includes another file, then make sure you put in the correct path to the file.
Reply With Quote
  #5  
Old 11-12-2010, 09:14 PM
darsalles darsalles is offline
 
Join Date: Oct 2009
Posts: 45
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok im having this code:

PHP Code:
<?php

{
    
$settings = array(
        
'newposts_limit' => array(
            
'defaultvalue' => 5,
            
'displayorder' => 1,
            
'datatype'     => 'integer'
        
),
        
'newposts_titlemaxchars' => array(
            
'defaultvalue' => 35,
            
'displayorder' => 2,
            
'datatype'     => 'integer'
        
),
        
'newposts_messagemaxchars' => array(
            
'defaultvalue' => 200,
            
'displayorder' => 3,
            
'datatype'     => 'integer'
        
),
        
'newposts_forumids' => array(
            
'defaultvalue' => -1,
            
'optioncode'   => 'selectmulti:eval
$options = construct_forum_chooser_options(0, fetch_phrase("all_forums", "vbblock"));'
,
            
'displayorder' => 4,
            
'datatype'     => 'arrayinteger'
        
),
        
'datecut' => array(
            
'defaultvalue' => 30,
            
'displayorder' => 5,
            
'datatype'     => 'integer'
        
)
    );
    
    function 
getData()
    {
        
        if (
$this->config['newposts_forumids'])
        {
            if (
in_array(-1$this->config['newposts_forumids']))
            {
                
$forumids array_keys($this->registry->forumcache);
            }
            else
            {
                
$forumids $this->config['newposts_forumids'];
            }
        }
        else
        {
            
$forumids array_keys($this->registry->forumcache);
        }

        foreach (
$forumids AS $forumid)
        {
            
$forumperms =& $this->registry->userinfo['forumpermissions']["$forumid"];
            if (
$forumperms $this->registry->bf_ugp_forumpermissions['canview']
                AND (
$forumperms $this->registry->bf_ugp_forumpermissions['canviewothers'])
                AND ((
$forumperms $this->registry->bf_ugp_forumpermissions['canviewthreads']))
                AND 
verify_forum_password($forumid$this->registry->forumcache["$forumid"]['password'], false)
                )
            {
                
$forumchoice[] = $forumid;
            }
        }

        if (!empty(
$forumchoice))
        {
            
$forumsql "AND thread.forumid IN(" implode(','$forumchoice) . ")";

            
// remove threads from users on the global ignore list if user is not a moderator
            
$globalignore '';
            if (
trim($this->registry->options['globalignore']) != '')
            {
                require_once(
DIR '/includes/functions_bigthree.php');
                if (
$Coventry fetch_coventry('string'))
                {
                    
$globalignore "AND post.userid NOT IN ($Coventry) ";
                }
            }

            
$datecut TIMENOW - ($this->config['datecut'] * 86400);

            
$posts $this->registry->db->query_read_slave("
                SELECT post.dateline, post.pagetext AS message, post.allowsmilie, post.postid,
                    thread.threadid, thread.title, thread.prefixid, post.attach,
                    forum.forumid,
                    user.*
                    " 
. ($this->registry->options['avatarenabled'] ? ",avatar.avatarpath, NOT ISNULL(customavatar.userid) AS hascustomavatar, customavatar.dateline AS avatardateline,customavatar.width AS avwidth,customavatar.height AS avheight" "") . "
                FROM " 
TABLE_PREFIX "post AS post
                JOIN " 
TABLE_PREFIX "thread AS thread ON (thread.threadid = post.threadid)
                JOIN " 
TABLE_PREFIX "forum AS forum ON(forum.forumid = thread.forumid)
                LEFT JOIN " 
TABLE_PREFIX "user AS user ON (post.userid = user.userid)
                "  
. ($this->registry->products['vbcms'] ? " LEFT JOIN " TABLE_PREFIX "cms_nodeinfo AS info ON info.associatedthreadid = thread.threadid \n" :  '')
            . (
$this->registry->options['avatarenabled'] ? "LEFT JOIN " TABLE_PREFIX "avatar AS avatar ON(avatar.avatarid = user.avatarid) LEFT JOIN " TABLE_PREFIX "customavatar AS customavatar ON(customavatar.userid = user.userid)" "") . "
            WHERE 1=1
                
$forumsql
                AND thread.visible = 1
                AND post.visible = 1
                AND thread.open <> 10
                AND post.dateline > 
$datecut
                
$globalignore
                " 
. ($this->userinfo['ignorelist'] ? "AND post.userid NOT IN (" implode(','explode(' '$this->userinfo['ignorelist'])) . ")"'')
            . (
$this->registry->products['vbcms'] ? " AND info.associatedthreadid IS NULL " :  '') . "
            ORDER BY post.dateline DESC
            LIMIT 0," 
intval($this->config['newposts_limit']) . "
            "
);

            while (
$post $this->registry->db->fetch_array($posts))
            {
                
//$post['url'] = fetch_seo_url('thread', $post, array('p' => $post['postid'])) . '#post' . $post['postid'];
                //$post['newposturl'] = fetch_seo_url('thread', $post, array('goto' => 'newpost'));

                // trim the title after fetching the urls
                //$post['title'] = fetch_trimmed_title($post['title'], $this->config['newposts_titlemaxchars']);

                
$post['date'] = vbdate($this->registry->options['dateformat'], $post['dateline'], true);
                
$post['time'] = vbdate($this->registry->options['timeformat'], $post['dateline']);

                
$post['message'] = $this->get_summary($post['message'], $this->config['newposts_messagemaxchars']);

                
// get avatar
                
$this->fetch_avatarinfo($post);

                
$postarray[$post['postid']] = $post;
            }
            return(
$postarray);
        }
    }
    
    function 
getHTML($postinfo false)
    {
        if (!
$postinfo)
        {
            
$postinfo $this->getData();
        }
        
        if (
$postinfo)
        {
            
            foreach (
$postinfo as $key => $post)
            {
                
$postinfo[$key]['url'] = fetch_seo_url('thread'$post, array('p' => $post['postid'])) . '#post' $post['postid'];
                
$postinfo[$key]['newposturl'] = fetch_seo_url('thread'$post, array('goto' => 'newpost'));
                
                
// trim the title after fetching the urls
                
$postinfo[$key]['title'] = fetch_trimmed_title($post['title'], $this->config['newposts_titlemaxchars']);
            }

            
$templater vB_Template::create('block_newposts');
                
$templater->register('blockinfo'$this->blockinfo);
                
$templater->register('posts'$postinfo);
            return 
$templater->render();
        }

    }

    function 
getHash()
    {
        
$context = new vB_Context('forumblock' ,
            array(
                
'blockid' => $this->blockinfo['blockid'],
                
'permissions' => $this->userinfo['forumpermissions'],
                
'ignorelist' => $this->userinfo['ignorelist'],
                
THIS_SCRIPT)
            );

        return 
strval($context);
    }
}
?>
Now its not throwing any error on the site, but it doesnt show anything, what could it be
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:38 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.03819 seconds
  • Memory Usage 2,285KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (5)postbit
  • (5)postbit_onlinestatus
  • (5)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete