vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   conditional for "who is online" (https://vborg.vbsupport.ru/showthread.php?t=118811)

moonclamp 06-16-2006 08:00 PM

conditional for "who is online"
 
I've created a usergroup for people who's contact info I want hidden (email form, messenger details etc) regardless of what they have entered before.

I've got <if condition="$bbuserinfo[usergroupid] == 15"><else /> for the templates that they might see

I've got <if condition="$userinfo[usergroupid] == 15"><else /> for the memberinfo template

I've got <if condition="$post[usergroupid] == 15"><else /> for the postbit template

However I can't find anything that works for the who's online page

<if condition="$vboptions[usergroupid] == 15"></else> doesn't seem to do anything, neither do any of the above.

Any suggestions?

Freesteyelz 06-16-2006 10:23 PM

Try:
Code:

<if condition="is_member_of($post,15)">
<else />
Who's online codes here...
</if>

The $post is the display conditional. Meaning Usergroup 15 will not have their info (e.g., e-mail, IM's) displayed in Who's Online.

*Note:
$post = Content that's displayed on page.
$bbuserinfo = Restriction or allowance to the end user (the one who's viewing the page).

moonclamp 06-16-2006 10:58 PM

Cheers, I've tried that like this and it doesn't do a thing, this is in the whosonlinebit template

<if condition="is_member_of($post,15)"><else />
$userinfo[aimicon]
$userinfo[icqicon]
$userinfo[msnicon]
$userinfo[yahooicon]
</if>

Freesteyelz 06-16-2006 11:12 PM

You have it in reversed that's why. :) It should be:

Code:

<if condition="is_member_of($post,15)">
<else />
$userinfo[aimicon]
$userinfo[icqicon]
$userinfo[msnicon]
$userinfo[yahooicon]
</if>

In between the <if> and <else /> is what you do not want to display for Usergroup 15. :)

moonclamp 06-16-2006 11:13 PM

doh ... I need to sleep more

Edit: No I don't, that hides everything for everyone

Freesteyelz 06-17-2006 12:21 AM

That code will work on most vB pages. I'm wondering, then, if the conditional can't detect the Usergroups that show up on Who's Online. If that's the case then a template conditional may not help; you'll may need to look at a PHP edit.

moonclamp 06-17-2006 02:55 AM

Quote:

Originally Posted by Freesteyelz
That code will work on most vB pages. I'm wondering, then, if the conditional can't detect the Usergroups that show up on Who's Online. If that's the case then a template conditional may not help; you'll may need to look at a PHP edit.

Yeah that's what i'm wondering too. Thanks for helping though.

Freesteyelz 06-17-2006 05:02 AM

I'm sorry I couldn't be of much help. If you do find a solution please post back so others can benefit from it. :)

Paul M 06-17-2006 05:47 AM

AFAIK, the WOL uses $userinfo, not $post, changing that should work.

moonclamp 06-17-2006 09:22 AM

That's what I tried in the firstplace.

if condition="$userinfo[usergroupid] == 15">

doesn't work so I tried this

<if condition="is_member_of($userinfo,15)">

and still nothing, I'm thinking that online.php needs something adding to it.

Marco van Herwaarden 06-17-2006 09:54 AM

In online.php templates, you can use:
- $bbuserinfo (vB3.0 style, depreciated but still supported in 3.5 and up)
- or $vbulletin->userinfo (vB3.5 & up style)

To use a field from the userinfo use either:
- $bbuserinfo[field]
- $vbulletin->userinfo[field] (PS If you get "Array"-errors, then surround with curly-brackets, ie: {$vbulletin->userinfo[field]} )

To test for usergroup you can use:
HTML Code:

<if condition="is_member_of($bbuserinfo, 15)">
or
HTML Code:

<if condition="is_member_of({$vbulletin->userinfo}, 15)">

moonclamp 06-17-2006 10:28 AM

Doing this hides all the information for everyone else too.

I have a usergroup where, no matter what they enter into their profile, nobody else on the forum can see their contact/messenger details. This is because of an abuse issue.

I don't care what this group can see, I want to stop everyone else from being able to contact them. So far I've sorted everything except for WOL.

Theoretically all the above suggestions should work, they do everywhere else. However something seems to be missing in WOL to prevent it.

Marco van Herwaarden 06-17-2006 11:01 AM

Ok i now see what you are trying. You want this based on the usergroup if the row of the user being displayed on that line, and not based on the usergroup of the user logged in.

All user information about the current row is stored in $userinfo, so that is what you will need to use.

There is however a problem, not all information about a user is pulled from the database for each row that is displayed on the WOL. Only information that is needed for vBulletin to display that row is retrieved. The usergroupid or the membergroupids are not loaded.

Unfortunatly there is no option to retrieve this information when the table of online users is populated, with a plugin. You could use a plugin, but that would probably mean 1 extra query for each online user, so from performance POV that is not a good option.

The best option would be to us a code edit in online.php.

For vB3.5.4, edit online.php and find the following (line 184)
PHP Code:

$allusers $db->query_read("
    SELECT user.username, session.useragent, session.location, session.lastactivity, user.userid, user.options, session.host, session.badlocation, session.incalendar, user.aim, user.icq, user.msn, user.yahoo, user.skype, 

And add the following line under the above lines:
PHP Code:

    user.usergroupiduser.membergroupids

For vB 3.6, edit online.php and find the following (line 236)
PHP Code:

$allusers $db->query_read_slave("
    SELECT user.username, session.useragent, session.location, session.lastactivity, user.userid, user.options, session.host, session.badlocation, session.incalendar, user.aim, user.icq, user.msn, user.yahoo, user.skype, 

And add the following line under the above lines:
PHP Code:

    user.usergroupiduser.membergroupids

Now you can use the is_member_of($userinfo, 15).

moonclamp 06-17-2006 01:06 PM

Fantastic, that worked thank you very much :)

All except the syntax of the if condition

<if condition="$userinfo[usergroupid] == 15"> worked but <if condition="is_member_of($userinfo,15)"> ) didn't for some reason.

feldon23 02-27-2007 03:42 PM

Yeah, the $userinfo is really crippled in Who's Online. We really need $userinfo[usergroup].


All times are GMT. The time now is 02:04 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.01118 seconds
  • Memory Usage 1,760KB
  • 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
  • (2)bbcode_html_printable
  • (4)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (15)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