vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   IsFriend Conditional (https://vborg.vbsupport.ru/showthread.php?t=174005)

GameWizard 03-24-2008 11:12 AM

IsFriend Conditional
 
With the friends feature now becoming part of 3.7, I have tried to integrate some new features into my board. One of these is showing content in the postbit only to friends.

In my postbit_legacy template, i have the following code:

Code:

<if condition="$prepared['isfriend'] OR $post['userid'] == $bbuserinfo['userid']">
content
</if>

Now mind you, the $prepared['isfriend'] is the only conditional I'm aware of, and it seems to only function on the Memberinfo templates. I have also tried $prepared[isfriend] and $post['isfriend'] and a few other random ones. I am certain that this is either a VB limitation or something that I'm doing wrong.

In case anyone is wondering, i added $post['userid'] == $bbuserinfo['userid'] which shows the content the original user aswell, rather than just to his/her friends.

====

EDIT: After doing some digging, I found this in the includes/class_userprofile.php file. Line 84
Code:

    /**
    * Array of variables to 'automatically' prepare for each profile view
    *
    * @var array
    */
    var $auto_prepare = array(
        'userid',
        'username',
        'musername',
        'myprofile',
        'usertitle',
        'userperms',
        'imicons',
        'profilepic',
        'rank',
        'reputation',
        'onlinestatus',
        'lastactivity',
        'wolocation',
        'usernoteinfo',
        'isfriend',
        'canbefriend',
        'show',
    );

Clearly this is the code in question I need to use, but where would I need to move it? Or how would I need to adapt it? I tried copying it into the includes/class_postbit.php file, but no luck in showing anything.

GameWizard 03-28-2008 05:37 AM

Any help on the matter would be appreciated, as I know a few others have requested a similar feature before.


All times are GMT. The time now is 04:59 PM.

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.00990 seconds
  • Memory Usage 1,709KB
  • 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
  • (2)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (2)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete