Page 1 of 2 1 2 LastLast
Results 1 to 15 of 16

Display Users Viewing non-vBulletin Pages in "Online Users"

This is a discussion on Display Users Viewing non-vBulletin Pages in "Online Users" within the Member Articles forums, part of the Focus on Members category; Hi, I had some non-vBulletin pages integrated to the vb database and i wanted to show the users viewing those ...

  1. #1
    Senior Member NeutralizeR's Avatar
    Real Name
    Mavi KARANLIK
    Join Date
    Feb 2006
    Location
    Ankara/TÜRKİYE
    Posts
    311
    Liked
    1 times

    Post Display Users Viewing non-vBulletin Pages in "Online Users"

    Hi,

    I had some non-vBulletin pages integrated to the vb database and i wanted to show the users viewing those pages in Online Users so i used this piece of code at the top of the non-vBulletin pages:

    PHP Code:
    <?php

    error_reporting
    (E_ALL & ~E_NOTICE);
    define('NO_REGISTER_GLOBALS'1);
    define('THIS_SCRIPT''adv_index');
    define('VBA_PORTAL'true);
    define('VBA_SCRIPT''CMPS');

    $forumpath 'yourforumpath';

    //example = '/home/msxorg/public_html/forum'

    chdir($forumpath);

    $phrasegroups = array();
    $globaltemplates = array();
    $actiontemplates = array();
    $specialtemplates = array();

    require_once(
    './includes/vba_cmps_include_template.php');
    require_once(
    './global.php');

    exec_shut_down();
    ?>
    You can remove the lines related to vBadvanced if you don't have it installed.

    More information can be found here:

    How to create your own vBulletin-powered page! (uses vB templates)


    -----------------------------------------------------------------------------

    Let's say you have a page nothing to do with vBulletin & vBulletin database (wordpress pages, external html pages, even pages of your other domains etc...) and you still want to show the page viewers in Online Users of vBulletin.


    Step - 1


    Create a page called 'extra_online_users.php'.

    Copy these lines in it:
    PHP Code:
    <?php

    error_reporting
    (E_ALL & ~E_NOTICE);
    define('NO_REGISTER_GLOBALS'1);

    $forumpath 'yourforumpath';
    //example = '/home/msxorg/public_html/forum'

    chdir($forumpath);

    $phrasegroups = array();
    $globaltemplates = array();
    $actiontemplates = array();
    $specialtemplates = array();

    require_once(
    './global.php');


    exec_shut_down();
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html dir="ltr" lang="en" xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>Extra Online Users</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <meta name="content-language" content="en" />
    </head>
    <body style="margin: 0px">
    <!-- anything can be put here. a little image, some text, etc... or you may keep it like this -->
    </body>
    </html>
    Save and upload this page to your domain or forum root.

    Step - 2

    Open your non-vbulletin page and copy these lines to the very bottom of your page:
    (Note: Before </body>)

    HTML Code:
    <iframe src="http://www.yourdomain.com/extra_online_users.php" scrolling="no" allowtransparency="true" frameborder="0" width="0" height="0"></iframe>
    Now, anybody visits your non-vbulletin page will be displayed at "Online Users".

    But it will show their location as "Unknown Location". We can fix this of course.

    Step - 3

    Go to your AdminCP > Plugins & Products > Plugin Manager > Add new Plugin

    Product: vBulletin
    Hook Location: online_location_process
    Title: Extra Online Users Process
    Execution Order: 5

    Code:
    PHP Code:
    if ($filename == 'extra_online_users.php')
    {
        
    $userinfo['activity'] = 'extra_online_users';

    Save.

    Go to your AdminCP > Plugins & Products > Plugin Manager > Add new Plugin

    Product: vBulletin
    Hook Location: online_location_unknown
    Title: Extra Online Users Unknown
    Execution Order: 5

    Code:
    PHP Code:
    if ($userinfo['activity'] == 'extra_online_users')
    {
        
    $handled true;
        
    $userinfo['action'] = 'Viewing -your custom page title comes here-';
        
    $userinfo['where'] = '<a href="http://-your custom page url comes here-">-your custom page title-</a>';

    Save.

    If you want to apply this tutorial for more than one page, just create another instance of "extra_online_users.php" and name it like "extra_online_users2.php".

    Don't forget to add the lines to the plugins and make the name changes.

    Demo and screenshots:
    Messenger Blog
    (a wordpress blog - this image at the footer is called by iframe 'extra_online_users.php')

    The viewer is displayed as:


    Feel free to ask any questions realated to this tutorial.

    Display Users Viewing non-vBulletin Pages in "Online Users" tutorial by NeutralizeR @ MsXLabs

    Original thread:
    Display Users Viewing non-vBulletin Pages in "Online Users" - vBulletin.org Forum

  2. #2
    Senior Member basketmen's Avatar
    Real Name
    richie
    Join Date
    Dec 2006
    Location
    SEO Specialist
    Posts
    173
    Liked
    0 times
    great, this what i need

    but it is better if there is simpler methode or vbseo can do that in future feature
    Last edited by basketmen; 02-02-2008 at 09:02 PM.

  3. #3
    vBSEO Staff Ace Shattock's Avatar
    Real Name
    Ace Shattock
    Join Date
    Jul 2005
    Location
    Auckland, New Zealand, New Zealand
    Posts
    4,012
    Liked
    13 times
    Quote Originally Posted by basketmen View Post
    great, this what i need

    but it is better if there is simpler methode or vbseo can do that in future feature




    also in your first php code is this line needed??





    You can remove the lines related to vBadvanced if you don't have it installed.

    More information can be found here:

    How to create your own vBulletin-powered page! (uses vB templates)
    Nope.

  4. #4
    Junior Member
    Real Name
    Wong Tsz Yin
    Join Date
    Feb 2008
    Posts
    1
    Liked
    0 times
    Quote Originally Posted by basketmen View Post
    great, this what i need

    but it is better if there is simpler methode or vbseo can do that in future feature
    Not really related

  5. #5
    Senior Member amenadiel's Avatar
    Real Name
    Felipe CHW
    Join Date
    Feb 2007
    Location
    Santiago, Chile
    Posts
    168
    Liked
    0 times
    will the users appear in the what's going on box?

  6. #6
    Senior Member NeutralizeR's Avatar
    Real Name
    Mavi KARANLIK
    Join Date
    Feb 2006
    Location
    Ankara/TÜRKİYE
    Posts
    311
    Liked
    1 times
    Quote Originally Posted by amenadiel View Post
    will the users appear in the what's going on box?
    Yes.

  7. #7
    Member
    Real Name
    myandy99
    Join Date
    Jun 2008
    Posts
    86
    Liked
    0 times
    I want to add the latest threads to my homepage which is a tpl(html template) page. How to do that?

  8. #8
    Senior Member amenadiel's Avatar
    Real Name
    Felipe CHW
    Join Date
    Feb 2007
    Location
    Santiago, Chile
    Posts
    168
    Liked
    0 times
    you could do that using an iframe.

  9. #9
    Member
    Real Name
    myandy99
    Join Date
    Jun 2008
    Posts
    86
    Liked
    0 times
    Thanks. do you have sample code?

  10. #10
    Senior Member amenadiel's Avatar
    Real Name
    Felipe CHW
    Join Date
    Feb 2007
    Location
    Santiago, Chile
    Posts
    168
    Liked
    0 times
    Let's see, I'd start doing a really basic script. Something like:

    Code:
    <?php
    
    require_once('./global.php');
    
    $cadena="select * from vb_thread order by lastpost desc limit 0,10";
    $getthreads = $db->query_read($cadena);
    
    echo '<div><ul>';
        while($thread = $db->fetch_array($getthreads)) {
            $title=$thread['title'] ;
            $threadid=$thread['threadid'] ;
            echo '<li><a href="showthread.php?t='.$threadid.'">'.$title.'<a></li>';
         }
    echo '</ul></div>';
    
    ?>

  11. #11
    Member
    Real Name
    myandy99
    Join Date
    Jun 2008
    Posts
    86
    Liked
    0 times
    I got following error with the code after putting it on my tpl file:

    Fatal error: Smarty error: [in pages/homepage.tpl line 147]: syntax error: unrecognized tag: $title=$thread['title'] ; $threadid=$thread['threadid'] ; echo '
    '.$title.''; (Smarty_Compiler.class.php, line 439) in /home/sistest/public_html/smarty/Smarty.class.php on line 1095

  12. #12
    Senior Member amenadiel's Avatar
    Real Name
    Felipe CHW
    Join Date
    Feb 2007
    Location
    Santiago, Chile
    Posts
    168
    Liked
    0 times
    you shouldn't paste the code in your tpl, just put it in your vbulletin directory as (for example) lastposts.php and refer it in your tpl as an iframe.

    <iframe src="/forum/lastposts.php"></iframe>

  13. #13
    Member
    Real Name
    myandy99
    Join Date
    Jun 2008
    Posts
    86
    Liked
    0 times
    Thanks. The posts do display this time in a frame. But when I click a post in the forum it opens within the frame, which is not right. How to make it open in current page?

    I will PM you the link so that you can see what I mean.

  14. #14
    Senior Member briansol's Avatar
    Real Name
    Brian
    Join Date
    Apr 2006
    Location
    Central CT, USA
    Posts
    6,981
    Liked
    8 times
    add target="_top" to the link


    echo '<li><a href="showthread.php?t='.$threadid.'" target="_top">'.$title.'<a></li>';



    it should be noted, that using iframes is generally a bad idea, as they are deprecated in xhtml strict.

  15. #15
    Senior Member amenadiel's Avatar
    Real Name
    Felipe CHW
    Join Date
    Feb 2007
    Location
    Santiago, Chile
    Posts
    168
    Liked
    0 times
    I'm aware the proper way of inserting such a block should be with an

    include('/forum/lastposts.php')

    but without knowing what kind of CMS is used in the frontpage, it may result in trouble. For example, using an include with the code I proposed will break postnuke, because it has a global.php of his own.

    well, who uses postnuke anymore btw.

Page 1 of 2 1 2 LastLast

Similar Threads

  1. NEWBIE HERE with Issues On Vbseo Sitemap Do Hicky
    By DieselMinded in forum General Discussion
    Replies: 70
    Last Post: 08-24-2007, 03:32 AM
  2. Sitemap alırken hata alıyorum :(
    By erhanerhan_5 in forum Türkįe
    Replies: 9
    Last Post: 11-15-2006, 08:44 AM

Posting Permissions

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