Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 01-15-2012, 07:49 PM
squishi squishi is offline
 
Join Date: May 2006
Location: Frankfurt
Posts: 282
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Decoding the privacy options

I have create a page that lists all users albums. I have filtered out private albums.
Now it has come to my attention that public albums of members who have chosen to make all their albums private in the settings are listed on as well.

I can get the options of the vb_user table without problems.
But the privacy settings are encoded in some way.

Examples:
60295255
45096150

The albums have four privacy settings:
- Everyone
- Registered Members
- Your Contacts
- Your Friends

I will have to check the last three settings individually.
How can I check these settings, given the above privacy codes?
Maybe there's a vb function that could do this for me?
Reply With Quote
  #2  
Old 01-15-2012, 08:35 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm not sure if it's what you need, but in includes/functions_album.php there are functions can_view_private_albums($userid) and can_view_profile_albums($userid). They tell whether the current viewing user is allowed to view private or profile albums of the given $userid. You could then read the state column of the albums table and if it's 'private' or 'profile', call the corresponding function to determine whether or not to display it. BTW, I got this from looking at album.php around line 1872, the section that starts with this code:

Code:
if ($_REQUEST['do'] == 'user')
{

so I haven't actually tried it out at all.
Reply With Quote
  #3  
Old 01-16-2012, 06:15 AM
squishi squishi is offline
 
Join Date: May 2006
Location: Frankfurt
Posts: 282
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yes. I've added the two can_view functions to the output while loop of my script.
But now the output stays empty. I also have doubts that the speed could be affected if I call these functions in a loop.
It would also be better for the database if I only queried the right albums, and not all of them. Let's say I query 20 albums, because they will fill up the page nicely. If 19 people have set their albums to private, the script would only output 1 album. The page would be almost empty.

So I need to already tackle this problem in the SQL query.
Reply With Quote
  #4  
Old 01-17-2012, 05:54 PM
squishi squishi is offline
 
Join Date: May 2006
Location: Frankfurt
Posts: 282
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The can_view_private_albums() function will slow the page down, if the album permissions are not cached. I have no reason to believe that they are cached.
So showing 20 albums on the page will could add up to 20 additional queries.

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

Am I blind? Or is the can_view_private_albums() function missing a check to see if the user has set all albums to private (on the page "profile.php?do=privacy")?
Because that exactly is the issue on my forum: a member had a public album but had set all albums to be visible by friends only. Yet the album thumbnail was visible on the page.
Reply With Quote
  #5  
Old 10-15-2012, 09:53 AM
Kolektor Kolektor is offline
 
Join Date: Jun 2010
Posts: 115
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi, is this successfully done? I wish to see how you've done it...
Reply With Quote
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 08:34 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.03835 seconds
  • Memory Usage 2,197KB
  • Queries Executed 11 (?)
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
  • (1)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (5)postbit
  • (5)postbit_onlinestatus
  • (5)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_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
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete