The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
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? |
#2
|
|||
|
|||
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. |
#3
|
|||
|
|||
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. |
#4
|
|||
|
|||
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. |
#5
|
|||
|
|||
Hi, is this successfully done? I wish to see how you've done it...
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|