Announcement

Collapse
No announcement yet.

Display Friends in a different page, VB3.7

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Display Friends in a different page, VB3.7

    Ive been looking like crazy at vb.org for something, and nobody answered my questions so Ill try here. I just need few kicks so I can get it, I dont need anybody to make the mod for me just heads up

    So the new tab system is not what I need for now, I decided to add a new page to display the full list of friends, so I got this php code called friends.php

    PHP Code:
    <?php
    // ####################### SET PHP ENVIRONMENT ###########################
    error_reporting(E_ALL & ~E_NOTICE);
    // #################### DEFINE IMPORTANT CONSTANTS #######################
    define('THIS_SCRIPT''friends');
    define('BYPASS_STYLE_OVERRIDE'1);
    // ################### PRE-CACHE TEMPLATES AND DATA ######################
    // get special phrase groups
    $phrasegroups = array(
    'wol',
    'user',
    'messaging',
    'itrader',
    'cprofilefield',
    'reputationlevel',
    'infractionlevel',
    'posting',
    );
    // get special data templates from the datastore
    $specialtemplates = array(
    'smiliecache',
    'bbcodecache'
    );
    // pre-cache templates used by all actions
    $globaltemplates = array(
    'MEMBERINFO',
    'memberinfo_membergroupbit',
    'im_aim',
    'im_icq',
    'im_msn',
    'im_yahoo',
    'im_skype',
    'bbcode_code',
    'bbcode_html',
    'bbcode_php',
    'bbcode_quote',
    'editor_css',
    'editor_clientscript',
    'editor_jsoptions_font',
    'editor_jsoptions_size',
    'postbit_reputation',
    'postbit_onlinestatus',
    'userfield_checkbox_option',
    'userfield_select_option',
    'memberinfo_block',
    'memberinfo_block_aboutme',
    'memberinfo_block_albums',
    'memberinfo_block_contactinfo',
    'memberinfo_block_friends',
    'memberinfo_block_friends_mini',
    'memberinfo_block_groups',
    'memberinfo_block_infractions',
    'memberinfo_block_ministats',
    'memberinfo_block_profilefield',
    'memberinfo_block_visitormessaging',
    'memberinfo_block_recentvisitors',
    'memberinfo_block_statistics',
    'memberinfo_css',
    'memberinfo_friends',
    'memberinfo_infractionbit',
    'memberinfo_profilefield',
    'memberinfo_profilefield_category',
    'memberinfo_visitormessage',
    'memberinfo_small',
    'memberinfo_socialgroupbit',
    'memberinfo_tiny',
    'memberinfo_visitorbit',
    'memberinfo_albumbit',
    'memberinfo_imbit',
    'memberinfo_publicgroupbit',
    'memberinfo_visitormessage_deleted',
    'memberinfo_visitormessage_ignored',
    'memberinfo_usercss',
    'showthread_quickreply',
    );
     
    // pre-cache templates used by specific actions
    $actiontemplates = array();
    if (
    $_REQUEST['do'] == 'vcard'// don't alter this $_REQUEST
    {
    define('NOHEADER'1);
    }
    // ######################### REQUIRE BACK-END ############################
    require_once('./global.php');
    require_once(
    DIR '/includes/class_postbit.php');
    require_once(
    DIR '/includes/functions_user.php');
    require_once(
    DIR '/includes/functions_itrader.php');
    // #######################################################################
    // ######################## START MAIN SCRIPT ############################
    // #######################################################################
    if (!($permissions['forumpermissions'] & $vbulletin->bf_ugp_forumpermissions['canview']) OR !($permissions['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canviewmembers']))
    {
    print_no_permission();
    }
    $vbulletin->input->clean_array_gpc('r', array(
    'find' => TYPE_STR,
    'moderatorid' => TYPE_UINT,
    'userid' => TYPE_UINT,
    'username' => TYPE_NOHTML,
    ));
    (
    $hook vBulletinHook::fetch_hook('member_start')) ? eval($hook) : false;
    if (
    $vbulletin->GPC['find'] == 'firstposter' AND $threadinfo['threadid'])
    {
    if ((!
    $threadinfo['visible'] AND !can_moderate($threadinfo['forumid'], 'canmoderateposts')) OR ($threadinfo['isdeleted'] AND !can_moderate($threadinfo['forumid'])))
    {
    eval(
    standard_error(fetch_error('invalidid'$vbphrase['thread'], $vbulletin->options['contactuslink'])));
    }
    if (
    in_coventry($threadinfo['postuserid']) AND !can_moderate($threadinfo['forumid']))
    {
    eval(
    standard_error(fetch_error('invalidid'$vbphrase['thread'], $vbulletin->options['contactuslink'])));
    }
    $forumperms fetch_permissions($threadinfo['forumid']);
    if (!(
    $forumperms $vbulletin->bf_ugp_forumpermissions['canview']))
    {
    print_no_permission();
    }
    if (!(
    $forumperms $vbulletin->bf_ugp_forumpermissions['canviewothers']) AND ($threadinfo['postuserid'] != $vbulletin->userinfo['userid'] OR $vbulletin->userinfo['userid'] == 0))
    {
    print_no_permission();
    }
    exec_header_redirect('member.php?' $vbulletin->session->vars['sessionurl_js'] . "u=$threadinfo[postuserid]");
    }
    else if (
    $vbulletin->GPC['find'] == 'lastposter' AND $threadinfo['threadid'])
    {
    if ((!
    $threadinfo['visible'] AND !can_moderate($threadinfo['forumid'], 'canmoderateposts')) OR ($threadinfo['isdeleted'] AND !can_moderate($threadinfo['forumid'])))
    {
    eval(
    standard_error(fetch_error('invalidid'$vbphrase['thread'], $vbulletin->options['contactuslink'])));
    }
    if (
    in_coventry($threadinfo['postuserid']) AND !can_moderate($threadinfo['forumid']))
    {
    eval(
    standard_error(fetch_error('invalidid'$vbphrase['thread'], $vbulletin->options['contactuslink'])));
    }
    $forumperms fetch_permissions($threadinfo['forumid']);
    if (!(
    $forumperms $vbulletin->bf_ugp_forumpermissions['canview']))
    {
    print_no_permission();
    }
    if (!(
    $forumperms $vbulletin->bf_ugp_forumpermissions['canviewothers']) AND ($threadinfo['postuserid'] != $vbulletin->userinfo['userid'] OR $vbulletin->userinfo['userid'] == 0))
    {
    print_no_permission();
    }
    require_once(
    DIR '/includes/functions_bigthree.php');
    $coventry fetch_coventry('string');
    $getuserid $db->query_first_slave("
    SELECT post.userid
    FROM " 
    TABLE_PREFIX "post AS post
    WHERE post.threadid = 
    $threadinfo[threadid]
    AND post.visible = 1
    "
    . ($coventry "AND post.userid NOT IN ($coventry)" '') . "
    ORDER BY dateline DESC
    LIMIT 1
    "
    );
    exec_header_redirect('member.php?' $vbulletin->session->vars['sessionurl_js'] . "u=$getuserid[userid]");
    }
    else if (
    $vbulletin->GPC['find'] == 'lastposter' AND $foruminfo['forumid'])
    {
    $_permsgetter_ 'lastposter fperms';
    $forumperms fetch_permissions($foruminfo['forumid']);
    if (!(
    $forumperms $vbulletin->bf_ugp_forumpermissions['canview']))
    {
    print_no_permission();
    }
    if (
    $vbulletin->userinfo['userid'] AND in_coventry($vbulletin->userinfo['userid'], true))
    {
    $tachyjoin "LEFT JOIN " TABLE_PREFIX "tachythreadpost AS tachythreadpost ON " .
    "(tachythreadpost.threadid = thread.threadid AND tachythreadpost.userid = " $vbulletin->userinfo['userid'] . ')';
    }
    else
    {
    $tachyjoin '';
    }
    // check if there is a forum password and if so, ensure the user has it set
    verify_forum_password($foruminfo['forumid'], $foruminfo['password']);
    require_once(
    DIR '/includes/functions_misc.php');
    $forumslist $forumid ',' fetch_child_forums($foruminfo['forumid']);
    require_once(
    DIR '/includes/functions_bigthree.php');
    // this isn't including moderator checks, because the last post checks don't either
    if ($coventry fetch_coventry('string')) // takes self into account
    {
    $globalignore_post "AND post.userid NOT IN ($coventry)";
    $globalignore_thread "AND thread.postuserid NOT IN ($coventry)";
    }
    else
    {
    $globalignore_post '';
    $globalignore_thread '';
    }
    cache_ordered_forums(1);
    $datecutoff $vbulletin->forumcache["$foruminfo[forumid]"]['lastpost'] - 30;
    $thread $db->query_first_slave("
    SELECT thread.threadid
    . ($tachyjoin ', IF(tachythreadpost.lastpost > thread.lastpost, tachythreadpost.lastpost, thread.lastpost) AS lastpost' '') . "
    FROM " 
    TABLE_PREFIX "thread AS thread
    $tachyjoin
    WHERE thread.forumid IN (
    $forumslist)
    AND thread.visible = 1
    AND thread.sticky IN (0,1)
    AND thread.open <> 10
    . (!$tachyjoin "AND lastpost > $datecutoff'') . "
    $globalignore_thread
    ORDER BY lastpost DESC
    LIMIT 1
    "
    );
    if (!
    $thread)
    {
    eval(
    standard_error(fetch_error('invalidid'$vbphrase['user'], $vbulletin->options['contactuslink'])));
    }
    $getuserid $db->query_first_slave("
    SELECT post.userid
    FROM " 
    TABLE_PREFIX "post AS post
    WHERE threadid = 
    $thread[threadid]
    AND visible = 1
    $globalignore_post
    ORDER BY dateline DESC
    LIMIT 1
    "
    );
    if (!(
    $forumperms $vbulletin->bf_ugp_forumpermissions['canviewothers']) AND ($getuserid['userid'] != $vbulletin->userinfo['userid'] OR $vbulletin->userinfo['userid'] == 0))
    {
    print_no_permission();
    }
    exec_header_redirect('member.php?' $vbulletin->session->vars['sessionurl_js'] . "u=$getuserid[userid]");
    }
    else if (
    $vbulletin->GPC['find'] == 'moderator' AND $vbulletin->GPC['moderatorid'])
    {
    $moderatorinfo verify_id('moderator'$vbulletin->GPC['moderatorid'], 11);
    exec_header_redirect('member.php?' $vbulletin->session->vars['sessionurl_js'] . "u=$moderatorinfo[userid]");
    }
    else if (
    $vbulletin->GPC['username'] != '' AND !$vbulletin->GPC['userid'])
    {
    $user $db->query_first_slave("SELECT userid FROM " TABLE_PREFIX "user WHERE username = '" $db->escape_string($vbulletin->GPC['username']) . "'");
    $vbulletin->GPC['userid'] = $user['userid'];
    }
    if (!
    $vbulletin->GPC['userid'])
    {
    eval(
    standard_error(fetch_error('unregistereduser')));
    }
    $fetch_userinfo_options = (
    FETCH_USERINFO_AVATAR FETCH_USERINFO_LOCATION |
    FETCH_USERINFO_PROFILEPIC FETCH_USERINFO_SIGPIC |
    FETCH_USERINFO_USERCSS FETCH_USERINFO_ISFRIEND
    );
    (
    $hook vBulletinHook::fetch_hook('member_start_fetch_user')) ? eval($hook) : false;
    $userinfo verify_id('user'$vbulletin->GPC['userid'], 11$fetch_userinfo_options);
    if (
    $userinfo['usergroupid'] == AND !($permissions['adminpermissions'] & $vbulletin->bf_ugp_adminpermissions['cancontrolpanel']))
    {
    print_no_permission();
    }
    $show['vcard'] = ($vbulletin->userinfo['userid'] AND $userinfo['showvcard']);
    if (
    $_REQUEST['do'] == 'vcard' AND $show['vcard'])
    {
    // source: http://www.ietf.org/rfc/rfc2426.txt
    $text "BEGIN:VCARD\r\n";
    $text .= "VERSION:2.1\r\n";
    $text .= "N:;$userinfo[username]\r\n";
    $text .= "FN:$userinfo[username]\r\n";
    $text .= "EMAIL;PREF;INTERNET:$userinfo[email]\r\n";
    if (!empty(
    $userinfo['birthday'][7]) AND $userinfo['showbirthday'] == 2)
    {
    $birthday explode('-'$userinfo['birthday']);
    $text .= "BDAY:$birthday[2]-$birthday[0]-$birthday[1]\r\n";
    }
    if (!empty(
    $userinfo['homepage']))
    {
    $text .= "URL:$userinfo[homepage]\r\n";
    }
    $text .= 'REV:' date('Y-m-d') . 'T' date('H:i:s') . "Z\r\n";
    $text .= "END:VCARD\r\n";
    $filename $userinfo['userid'] . '.vcf';
    header("Content-Disposition: attachment; filename=$filename");
    header('Content-Length: ' strlen($text));
    header('Connection: close');
    header("Content-Type: text/x-vCard; name=$filename");
    echo 
    $text;
    exit;
    }
    // display user info
    $userperms cache_permissions($userinfofalse);
    (
    $hook vBulletinHook::fetch_hook('member_execute_start')) ? eval($hook) : false;
    require_once(
    DIR '/includes/class_userprofile.php');
    require_once(
    DIR '/includes/class_profileblock.php');
    $vbulletin->input->clean_array_gpc('r', array(
    'pagenumber' => TYPE_UINT,
    'tab' => TYPE_NOHTML,
    'perpage' => TYPE_UINT,
    'vmid' => TYPE_UINT,
    'showignored' => TYPE_BOOL,
    ));
    if (
    $vbulletin->GPC['vmid'] AND !$vbulletin->GPC['tab'])
    {
    $vbulletin->GPC['tab'] = 'visitor_messaging';
    }
    $profileobj =& new vB_UserProfile($vbulletin$userinfo);
    $blockfactory =& new vB_ProfileBlockFactory($vbulletin$profileobj);
    $prepared =& $profileobj->prepared;
    $blocks = array();
    $tabs = array();
    $tablinks = array();
    $blocklist = array(
    'stats_mini' => array(
    'class' => 'MiniStats',
    'title' => $vbphrase['mini_statistics'],
    ),
    'friends_mini' => array(
    'class' => 'Friends',
    'title' => $vbphrase['friends'],
    ),
    'albums' => array(
    'class' => 'Albums',
    'title' => $vbphrase['albums'],
    ),
    'visitors' => array(
    'class' => 'RecentVisitors',
    'title' => $vbphrase['recent_visitors'],
    'options' => array(
    'profilemaxvisitors' => $vbulletin->options['profilemaxvisitors']
    )
    ),
    'groups' => array(
    'class' => 'Groups',
    'title' => $vbphrase['group_memberships'],
    ),
    // PMs must come before Stats to save a query
    'visitor_messaging' => array(
    'class' => 'VisitorMessaging',
    'title' => $vbphrase['visitor_messages'],
    'options' => array(
    'pagenumber' => $vbulletin->GPC['pagenumber'],
    'tab' => $vbulletin->GPC['tab'],
    'vmid' => $vbulletin->GPC['vmid'],
    'showignored' => $vbulletin->GPC['showignored'],
    )
    ),
    'aboutme' => array(
    'class' => 'AboutMe',
    'title' => $vbphrase['about_me'],
    ),
    'stats' => array(
    'class' => 'Statistics',
    'title' => $vbphrase['statistics'],
    ),
    'contactinfo' => array(
    'class' => 'ContactInfo',
    'title' => $vbphrase['contact_info'],
    ),
    'friends' => array(
    'class' => 'Friends',
    'title' => $vbphrase['friends'],
    'type' => 'tab',
    'options' => array(
    'fetchamount' => $vbulletin->options['friends_per_page'],
    'membertemplate' => 'memberinfo_small',
    'template_override' => 'memberinfo_block_friends',
    'pagenumber' => $vbulletin->GPC['pagenumber'],
    'tab' => $vbulletin->GPC['tab'],
    'fetchorder' => 'asc',
    ),
    ),
    'infractions' => array(
    'class' => 'Infractions',
    'title' => $vbphrase['infractions'],
    'options' => array(
    'pagenumber' => $vbulletin->GPC['pagenumber'],
    'tab' => $vbulletin->GPC['tab'],
    ),
    ),
    );
    if (!empty(
    $vbulletin->GPC['tab']) AND !empty($vbulletin->GPC['perpage']) AND isset($blocklist["{$vbulletin->GPC['tab']}"]))
    {
    $blocklist["{$vbulletin->GPC['tab']}"]['options']['perpage'] = $vbulletin->GPC['perpage'];
    }
    $profileblock =& $blockfactory->fetch('ProfileFields');
    $profileblock->build_field_data();
    foreach (
    $profileblock->locations AS $profilecategoryid => $location)
    {
    if (
    $location)
    {
    $blocklist["profile_cat$profilecategoryid"] = array(
    'class' => 'ProfileFields',
    'title' => $vbphrase["category{$profilecategoryid}_title"],
    'options' => array('category' => $profilecategoryid),
    'hook_location' => $location
    );
    }
    }
    if (!empty(
    $vbulletin->GPC['tab']) AND isset($blocklist["{$vbulletin->GPC['tab']}"]))
    {
    $selected_tab $vbulletin->GPC['tab'];
    }
    else
    {
    $selected_tab '';
    }
    (
    $hook vBulletinHook::fetch_hook('member_build_blocks_start')) ? eval($hook) : false;
    foreach (
    $blocklist AS $blockid => $blockinfo)
    {
    $blockobj =& $blockfactory->fetch($blockinfo['class']);
    $block_html $blockobj->fetch($blockinfo['title'], $blockid$blockinfo['options']);
    if (!empty(
    $blockinfo['hook_location']))
    {
    $template_hook["$blockinfo[hook_location]"] .= $block_html;
    }
    else
    {
    $blocks["$blockid"] = $block_html;
    }
    }
    $usercss construct_usercss($userinfo$show['usercss_switch']);
    construct_usercss_switch($show['usercss_switch'], $usercss_switch_phrase);
    eval(
    '$memberinfo_css = "' fetch_template('memberinfo_css') . '";');
    $navbits construct_navbits(array(
    'member.php?' $vbulletin->session->vars['sessionurl'] . "u=$userinfo[userid]=> $vbphrase['view_profile'],
    '' => $userinfo['username']
    ));
    eval(
    '$navbar = "' fetch_template('navbar') . '";');
    $templatename 'memberinfo_friends';
    (
    $hook vBulletinHook::fetch_hook('member_complete')) ? eval($hook) : false;
    eval(
    'print_output("' fetch_template($templatename) . '");');
    /*======================================================================*\
    || ####################################################################
    || # Downloaded: 12:16, Thu Feb 14th 2008
    || # CVS: $RCSfile$ - $Revision: 25721 $
    || ####################################################################
    \*======================================================================*/
    ?>




    And my template called memberinfo_friends




    Code:
    $stylevar[htmldoctype]
    <html xmlns="http://www.w3.org/1999/xhtml" dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
    <head>
    $headinclude
     
    $usercss
    $memberinfo_css
    <style type="text/css" id="vbulletin_tabctrl_css">
    @import url("clientscript/vbulletin_tabctrl.css?v=$vboptions[simpleversion]");
    <if condition="$show['rtl']">@import url("clientscript/vbulletin_tabctrl_rtl.css?v=$vboptions[simpleversion]");</if>
    </style>
     
    <script type="text/javascript" src="clientscript/vbulletin_tabctrl.js?v=$vboptions[simpleversion]"></script>
     
    <title>$vboptions[bbtitle] - $vbphrase[view_profile]: $userinfo[username]</title>
     
    <if condition="$userinfo['userid'] == $bbuserinfo['userid']">
    <script type="text/javascript" src="clientscript/vbulletin_profilefield_edit.js?v=$vboptions[simpleversion]"></script>
    </if>
    <script type="text/javascript">
    <!--
    vbphrase['server_failed_respond_try_again'] = "$vbphrase[server_failed_respond_try_again]";
    vbphrase['edit_value'] = "$vbphrase[edit_value_js]";
     
    <if condition="$show['post_visitor_message']">
    function goto_post_pm()
    {
        vB_TabCtrls['profile_tabs'].switch_tab('visitor_messaging');
        fetch_object('visitor_messaging').scrollIntoView();
     
        var textarea = fetch_object('visitor_message_form_textarea');
        if (textarea)
        {
            textarea.focus();
            textarea.select();
        }
    }
    </if>
    -->
    </script>
     
    </head>
    <body>
     
    $header
    $navbar
     
    $blocks[friends]
     
    $footer
     
    </body>
    </html>
    Everything seems to work fine, except for the page navigation, wich takes me to the member.php, I know is so simple to fix but I dont know anything about this, however I got this to work almost

    HELP!!

  • #2
    Maybe this line?
    exec_header_redirect('member.php?' . $vbulletin->session->vars['sessionurl_js'] . "u=$getuserid[userid]");

    Comment


    • #3
      What do you mean "page navigation"

      Comment


      • #4
        lets say after 10 friends it puts a page navigation on the bottom, well when you click on next page or the number of the page it returns to the member.php

        Comment


        • #5
          Originally posted by SNN View Post
          Maybe this line?
          exec_header_redirect('member.php?' . $vbulletin->session->vars['sessionurl_js'] . "u=$getuserid[userid]");
          Didnt work man, but thanx

          Comment


          • #6
            anybody

            Comment


            • #7
              Replace..

              PHP Code:
              $navbits construct_navbits(array(
              'member.php?' $vbulletin->session->vars['sessionurl'] . "u=$userinfo[userid]=> $vbphrase['view_profile'],
              '' => $userinfo['username']
              )); 
              With...

              PHP Code:
              $navbits = array();
              $navbits['member.php?' $vbulletin->session->vars['sessionurl'] . "u={$userinfo[userid]}"] = $vbphrase['view_profile'];
              $navbits construct_navbits($navbits); 

              Comment


              • #8
                Thanx for the reply man, but didnt work
                I wonder what it is...

                Comment


                • #9
                  I havent figured out that but Ill try more stuff.

                  Exactly what I need is the way to display friends as in social groups they display the list of members

                  Im beggin for this help

                  Comment


                  • #10
                    Since this is a code modification you should be asking over at vbulletin.org. You may have to resort to paying someone to do this for you.
                    Steve Machol, former vBulletin Customer Support Manager (and NOT retired!)
                    Change CKEditor Colors to Match Style (for 4.1.4 and above)

                    Steve Machol Photography


                    Mankind is the only creature smart enough to know its own history, and dumb enough to ignore it.


                    Comment


                    • #11
                      I agree, someone is probably going to have to get into your code to find out.

                      Comment


                      • #12
                        Is ok, I put it on suggestions, hopefully they do it in the future.

                        Is very important so the profile of the person doesnt have to load everytime they change page on the tab system.

                        For now im using the extra page I added called friends.php and no navigation yet but is ok, at least now they display separately

                        Comment

                        widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                        Working...
                        X