Go Back   vb.org Archive > vBulletin 5 Connect Discussion > vB5 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 04-26-2014, 03:01 AM
Raakin Raakin is offline
 
Join Date: Jul 2008
Posts: 49
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Fixing Who's Online Location permissions

Hi all,

There's a problem with the "Can View Detailed Location Info for Users" permission in vB 5. It allows the user to see the thread titles from private channels if set to Yes. There's a bug report for it here: http://tracker.vbulletin.com/browse/VBV-12542
But they say it can't be fixed and they are just going to add a warning in the help text for it.

Well, why don't we create a mod to get it fixed? In the onlineuser_details template, there's the following condition:
Code:
<vb:if condition="isset($user['location'])">
<div title="{vb:raw user.location}" class="wol-location h-right vb-icon vb-icon-question-blue"></div>
</vb:if>
If we add another condition along with this to check the channel id of the user's location, then we can easily prevent the thread titles from appearing.

My question is, how can I add this condition to check for the channel id?

Thanks
Reply With Quote
  #2  
Old 04-26-2014, 04:17 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The condition you are listing is only for the little "?" on the page, not for the thread title.

Anyway, if you do a vardump of the $user[wol] array ( {vb:debugvardump $user[wol]} ), you'll see it doesn't have the channelid included (nor does the $user array itself). So, I'm not sure you can do it by channelid.
Reply With Quote
  #3  
Old 04-26-2014, 06:24 PM
Raakin Raakin is offline
 
Join Date: Jul 2008
Posts: 49
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Is there any other way to solve this issue?

Where does the $user[wol] array get the user's location from? I mean, where is the source code for it? Maybe we can update the code there itself and supply this array with the channel name instead of the thread title whenever the user is inside a private channel.
Reply With Quote
  #4  
Old 04-26-2014, 09:10 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The page gets the actual path from the session table. A channelid isn't stored there - only the actual path.

The template is rendered in the /core/vb/api/wol.php file.
Reply With Quote
  #5  
Old 04-26-2014, 09:29 PM
Dead Eddie's Avatar
Dead Eddie Dead Eddie is offline
 
Join Date: Apr 2004
Location: at Home...
Posts: 196
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Just quickly looking at it, the Who's Online API gets a "page key" parameter.

On conversations, it's set with the following parameters:

PHP Code:
$this->setPageKey('pageid''channelid''nodeid'); 
You could probably use that to alter what's saved to the database.
Reply With Quote
  #6  
Old 04-27-2014, 02:47 AM
Raakin Raakin is offline
 
Join Date: Jul 2008
Posts: 49
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you for the replies. Where does the location gets written to the session table? I tried to look for it but couldn't find it.

Dumping user[pagekey] on the /online returns NULL. Will it be safe to modify it in the conversations? I think wol checks the pagekey for differentiating between online users of the same page and the online user on the whole forum.

--------------- Added [DATE]1398571797[/DATE] at [TIME]1398571797[/TIME] ---------------

Added this in conversations but it doesn't seem to work. The nodeid still gets recorded in the session table.
Code:
if ('channelid' != 42) // 42 is channel id for the private forum
			{
			$this->setPageKey('pageid', 'channelid', 'nodeid');
			}			
			else
			{
			$this->setPageKey('pageid', 'channelid', '');
			}
Reply With Quote
  #7  
Old 04-27-2014, 03:31 AM
Dead Eddie's Avatar
Dead Eddie Dead Eddie is offline
 
Join Date: Apr 2004
Location: at Home...
Posts: 196
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Huh. Suppose you could possibly do something there, too. Not sure, and I don't have the code in front of me.

I was in api/wol.php::register(). That's where it's written to the database.

You don't want to change the page key that's generated...but rather change the session information being persisted in the database.
Reply With Quote
  #8  
Old 04-27-2014, 03:55 PM
Raakin Raakin is offline
 
Join Date: Jul 2008
Posts: 49
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

There can be an easier of doing this. How can I search for a substring inside the $user['location'] string?

--------------- Added [DATE]1398625222[/DATE] at [TIME]1398625222[/TIME] ---------------

Finally got it working!

Replaced the following code in onlineuser_details template:
Code:
		{vb:set userAction, {vb:raw user.wol.action}}
		{vb:rawphrase {vb:raw userAction}, {vb:raw user.wol.params}}
		<vb:if condition="isset($user['location'])">
			<div title="{vb:raw user.location}" class="wol-location h-right vb-icon vb-icon-question-blue"></div>
		</vb:if>
with:
Code:
{vb:set test, {vb:php substr, {vb:raw user.location}, 7, 15}}
		{vb:set userAction, {vb:raw user.wol.action}}
		<vb:if condition="$test != 'private-forums/'">
		{vb:rawphrase {vb:raw userAction}, {vb:raw user.wol.params}}
		<vb:if condition="isset($user['location'])">
			<div title="{vb:raw user.location}" class="wol-location h-right vb-icon vb-icon-question-blue"></div>
		</vb:if>
		<vb:else />
			Viewing Private Forum
		</vb:if>
Now it says Viewing Private Forum for anyone who is viewing a thread inside the private forums.
Reply With Quote
Благодарность от:
Lynne
  #9  
Old 05-01-2014, 02:21 AM
Raakin Raakin is offline
 
Join Date: Jul 2008
Posts: 49
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

There's a mistake in the above code. {vb:raw user.location} cannot be accessed by all users, so I had to replace it with {vb:raw user.wol.params.1} and the number 7 will also be replaced based on the length of the string from the beginning until the category name.
Reply With Quote
Благодарность от:
Lynne
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:58 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.04061 seconds
  • Memory Usage 2,253KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (4)bbcode_code
  • (1)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (2)post_thanks_box_bit
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit
  • (9)post_thanks_postbit_info
  • (9)postbit
  • (9)postbit_onlinestatus
  • (9)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete