Results 1 to 5 of 5

WordPress and global.php

This is a discussion on WordPress and global.php within the Off-Topic & Chit Chat forums, part of the Focus on Members category; Anyone have any experience with WordPress plugins? I'm trying like crazy to include the global.php file from vB into a ...

  1. #1
    Senior Member Citricguy's Avatar
    Real Name
    Josh
    Join Date
    Nov 2006
    Location
    Maui, Hawaii
    Posts
    143
    Liked
    0 times
    Blog Entries
    7

    WordPress and global.php

    Anyone have any experience with WordPress plugins? I'm trying like crazy to include the global.php file from vB into a plugin so I can do some conditional stuff within my posts but I always tend to get a fatal error any time i use require() or require_once()

    I was hoping it would be as ease as:

    PHP Code:
    $vwd '/path/to/forums';
    $cwd getcwd();
    chdir($vwd);
    //always fails out on the next line.
    require_once('./global.php');
    chdir($cwd); 

  2. #2
    Senior Member briansol's Avatar
    Real Name
    Brian
    Join Date
    Apr 2006
    Location
    Central CT, USA
    Posts
    6,981
    Liked
    8 times
    conditionals, like template conditionals?

    including global.php into wordpress won't help you there.

    wordpress has it's own template engine.


    that said, are you sure you're in the right spot?

    try

    require_once('/public/forums/global.php');

    with whatever your home directory path is

  3. #3
    vBSEO.com Webmaster Mert Gökçeimam's Avatar
    Real Name
    Lizard King
    Join Date
    Oct 2005
    Location
    Istanbul, Turkey, Turkey
    Posts
    23,100
    Liked
    622 times
    Blog Entries
    4
    Try

    PHP Code:
    $vwd '/your/forum/path';
    if (
    $vwd)
    {
        
    chdir($vwd);
    }
    require_once(
    './global.php'); 
    Mert Gökçeimam / Crawlability Inc.

    vBSEO 3.6.0 Alpha Önizlemesi - Including Like Tree
    Unveiling the NEW vBSEO Sitemap Generator 3.0 - available NOW for vBSEO Customers!


    Twitter:@Depkac
    Personal Blog : Mert Gökçeimam

  4. #4
    Senior Member Citricguy's Avatar
    Real Name
    Josh
    Join Date
    Nov 2006
    Location
    Maui, Hawaii
    Posts
    143
    Liked
    0 times
    Blog Entries
    7
    I'm trying to consolidate everything into one plugin. If I include global.php into the wordpress config.php file, this plugin (well the bottom half atleast ) works as intended. But I cannot seem to get the global.php file to load from the plugin script itself.

    They got the global.php file to load in another plugin over at Complete Wordpress/Vbulletin Bridge - Share Users And Postings - vBulletin.org Forum but it is bugged out pretty hard at the moment (due to WordPress updating to 2.6) and is why I wanted to just move the include code over. Otherwise I would just keep using their script with my stuff just appended to the end

    I tried

    PHP Code:
    require_once('/public/forums/global.php'); 

    and

    PHP Code:
    $vwd '/your/forum/path';
    if (
    $vwd)
    {
        
    chdir($vwd);
    }
    require_once(
    './global.php'); 


    but both fail out when run as a wordpress plugin. When run as a standalone php file though they both work fine. I'm sure the path is correct now at least

    Here's my problem code, followed by the full plugin.

    I really appreciate you guys lookin at this. Now back to crawling the WP docs.
    PHP Code:
    // --- Problem Code Start ----//
    //Get vB's global.php
    $cwd getcwd();
    $vwd '/path/to/forums';
    chdir($vwd);
    require_once(
    '/absolute/path/to/forums/global.php');
    chdir($cwd);
    // --- Problem Code End----// 
    And the (unfinished) full plugin for completeness...
    PHP Code:
    <?php
    /* 
    Plugin Name: *
    Plugin URI: *
    Description:  *
    Plugin Version: *
    Plugin Author: *
    Author URI: *
     */ 

    // --- Problem Code Start ----//
    //Get vB's global.php
    $cwd getcwd();
    $vwd '/path/to/forums';
    chdir($vwd);
    require_once(
    '/absolute/path/to/forums/global.php');
    chdir($cwd);
    // --- Problem Code End----//
     
    //WordPress specific stuff
    add_filter('the_content''hidden');

    function 
    hidden($content) { 
    global 
    $post;
    global 
    $vbulletin;
     
    $out=$content

    for (
    $number=1;$number<=9;$number++)
                {
                
    $key="HIDE".$number;
                
    $htmlget_post_meta($post->ID$key,false);
                if (
    $vbulletin->userinfo['usergroupid'] != 6) {
                
    $html=$html[0];
                } else {
                
    $html "<a href='http://".$_SERVER['SERVER_NAME'] . "/expert/external_login.php?r=http://"$_SERVER['SERVER_NAME'] .$_SERVER['REQUEST_URI'] . "&g=6'>TEST</a>";
                }
                
    $find="[".$key."]";
                
    $out=str_replace($find,$html$out); 
                }
        
    return 
    $out;
        }
    ?>

  5. #5
    Senior Member Citricguy's Avatar
    Real Name
    Josh
    Join Date
    Nov 2006
    Location
    Maui, Hawaii
    Posts
    143
    Liked
    0 times
    Blog Entries
    7
    I gave up on the plugin and just added the require() code to wp-config. lol, ill revisit it another day.

    I did want to get your guys feedback though

    3. Creating Your First Blog | Blogger Video Training contains my "members only" message. I can't wait to see what this does for my registrations!

Similar Threads

  1. vb + vbSEo + Wordpress
    By Ky! in forum Deutsch
    Replies: 10
    Last Post: 07-04-2008, 09:56 AM
  2. htaccess for vb and wordpress
    By gdubs12345 in forum URL Rewrite Settings
    Replies: 3
    Last Post: 08-21-2007, 06:55 PM
  3. SEO Advice - Wordpress
    By vol_freak in forum General Discussion
    Replies: 1
    Last Post: 05-04-2007, 01:38 PM
  4. Wordpress 301 Redirect Help Please
    By BamaStangGuy in forum General Discussion
    Replies: 7
    Last Post: 12-13-2006, 06:00 AM
  5. Wordpress installed
    By datarecall in forum Troubleshooting
    Replies: 1
    Last Post: 09-26-2006, 06:46 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •