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

Reply
 
Thread Tools Display Modes
  #1  
Old 11-25-2005, 03:00 AM
ncg ncg is offline
 
Join Date: Sep 2004
Posts: 2
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Controlling access to attachments

We have a paid website and a free forum. Currently forum members and forum guests have permission to see and download all attachments. We encourage members to post some of our website content in the forums but do not want to be giving away paid content for free so we want only website members to be able to access the attachments themselves.

So we'd like that forum members and forum guests are allowed to see the thumbnails but only Website members have access to the actual attachments. I know that we could do this with IMG & URL links rather than the attachment function but it presents a problem.

1. Posters will have to source or create their own thumbnails. They could source thumbnails from the members area of the site but they are currently stored in a DB and are referred to in the following format, which doesn't display as a thumbnail in the forums - http://domain.com/media.php?id=134519

Short of integrating the seperate website and forum accounts into single accounts is it possible?

I thought that putting membership restrictions on the attachment directory would be the easiest way to go but this will also restrict access to the thumbs wont it? We would like the thumbnails to be visible to all.

Is there any quick and easy way to do this? Can we put the membership restriction on that directory but exclude any of the .thumb files? Will that work?
Reply With Quote
  #2  
Old 11-25-2005, 04:12 AM
calorie calorie is offline
 
Join Date: May 2003
Posts: 2,804
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try the following...
Code:
Product: vBulletin
Hook Location: attachment_start
Title: Closed Attachments
Plugin PHP Code: code is below
Plugin is Active: Yes

// start Closed Attachments code

/*************************************************************
                       SET THESE VALUES
*************************************************************/
$forums_closed_to_guest_attach_views = array(1,2,3,4,5);
$user_ids_whose_attaches_are_closed = array(1);
$user_groups_allowed_to_see_attaches = array(5,6,7);
/************************************************************/

if (!$attachmentinfo_check = $db->query_first("
	SELECT attachment.userid, thread.forumid
	FROM " . TABLE_PREFIX . "attachment AS attachment
	LEFT JOIN " . TABLE_PREFIX . "attachmenttype AS attachmenttype ON (attachmenttype.extension = attachment.extension)
	LEFT JOIN " . TABLE_PREFIX . "post AS post ON (post.postid = attachment.postid)
	LEFT JOIN " . TABLE_PREFIX . "thread AS thread ON (post.threadid = thread.threadid)
	WHERE " . ($vbulletin->GPC['postid'] ? "attachment.postid = " . $vbulletin->GPC['postid'] : "attachmentid = " . $vbulletin->GPC['attachmentid']) . "
"))
{
	eval(standard_error(fetch_error('invalidid', $vbphrase['attachment'], $vbulletin->options['contactuslink'])));
}

$user_groups_allowed_for_attachments = array();
if ($vbulletin->userinfo['userid'] > 0 && $vbulletin->userinfo['membergroupids'])
{
	$user_groups_allowed_for_attachments = explode(",",str_replace(" ","",$vbulletin->userinfo['membergroupids']));
}
$user_groups_allowed_results = array_intersect($user_groups_allowed_to_see_attaches, $user_groups_allowed_for_attachments);

if (
	in_array($attachmentinfo_check['forumid'], $forums_closed_to_guest_attach_views)
		&&
	in_array($attachmentinfo_check['userid'], $user_ids_whose_attaches_are_closed)
		&&
	!in_array($vbulletin->userinfo['usergroupid'], $user_groups_allowed_to_see_attaches)
		&&
	empty($user_groups_allowed_results)
)
{
	print_no_permission();
}

// end Closed Attachments code
Reply With Quote
  #3  
Old 11-25-2005, 08:14 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Or just make your website users member of a secondary usergroup, and only allow that usergroup to download attachemnts.
Reply With Quote
  #4  
Old 11-28-2005, 04:20 AM
ncg ncg is offline
 
Join Date: Sep 2004
Posts: 2
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi Calorie,

Im no php expert. Could you let me know how to apply that (which file etc) and what it does?


Quote:
Originally Posted by calorie
Try the following...
Code:
Product: vBulletin
Hook Location: attachment_start
Title: Closed Attachments
Plugin PHP Code: code is below
Plugin is Active: Yes
Reply With Quote
  #5  
Old 11-28-2005, 11:52 AM
calorie calorie is offline
 
Join Date: May 2003
Posts: 2,804
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ACP -> Plugin System -> Plugin Manager -> Add New Plugin -> fill in fields

It allows you to set who can see what and where according to the following:
Code:
$forums_closed_to_guest_attach_views = array(1,2,3,4,5);
$user_ids_whose_attaches_are_closed = array(1);
$user_groups_allowed_to_see_attaches = array(5,6,7);
Reply With Quote
  #6  
Old 10-11-2006, 09:05 AM
kartik786 kartik786 is offline
 
Join Date: Aug 2005
Location: India
Posts: 175
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Even I have a similar problem.

I m running vb 3.5.3

I wish to have promotions such that registered users cannot download the attachments and the new usergroup can.

I tried it, but it just did not work. Registered users were able to download attachments.

On top, people in the second usergroup were not able to even view the forum and it gave them the " you do not have permission " error message.

Can anyone please explain this in detail ?

I want it such that only members having more than 10 posts can download the attachments.

PS : I already have a promotion running wherein only people with more than 100 posts can view a particular forum.

PPS : Is there a plugin / mod or something which can make it easier ? I downloaded the download attachment restriction plugin but it restricts only for 1 post.
Reply With Quote
  #7  
Old 11-15-2006, 06:21 PM
TCB's Avatar
TCB TCB is offline
 
Join Date: Jun 2004
Location: the Netherlands
Posts: 193
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by calorie View Post
Try the following...
Code:
Product: vBulletin
Hook Location: attachment_start
Title: Closed Attachments
Plugin PHP Code: code is below
Plugin is Active: Yes

// start Closed Attachments code

/*************************************************************
                       SET THESE VALUES
*************************************************************/
$forums_closed_to_guest_attach_views = array(1,2,3,4,5);
$user_ids_whose_attaches_are_closed = array(1);
$user_groups_allowed_to_see_attaches = array(5,6,7);
/************************************************************/

if (!$attachmentinfo_check = $db->query_first("
	SELECT attachment.userid, thread.forumid
	FROM " . TABLE_PREFIX . "attachment AS attachment
	LEFT JOIN " . TABLE_PREFIX . "attachmenttype AS attachmenttype ON (attachmenttype.extension = attachment.extension)
	LEFT JOIN " . TABLE_PREFIX . "post AS post ON (post.postid = attachment.postid)
	LEFT JOIN " . TABLE_PREFIX . "thread AS thread ON (post.threadid = thread.threadid)
	WHERE " . ($vbulletin->GPC['postid'] ? "attachment.postid = " . $vbulletin->GPC['postid'] : "attachmentid = " . $vbulletin->GPC['attachmentid']) . "
"))
{
	eval(standard_error(fetch_error('invalidid', $vbphrase['attachment'], $vbulletin->options['contactuslink'])));
}

$user_groups_allowed_for_attachments = array();
if ($vbulletin->userinfo['userid'] > 0 && $vbulletin->userinfo['membergroupids'])
{
	$user_groups_allowed_for_attachments = explode(",",str_replace(" ","",$vbulletin->userinfo['membergroupids']));
}
$user_groups_allowed_results = array_intersect($user_groups_allowed_to_see_attaches, $user_groups_allowed_for_attachments);

if (
	in_array($attachmentinfo_check['forumid'], $forums_closed_to_guest_attach_views)
		&&
	in_array($attachmentinfo_check['userid'], $user_ids_whose_attaches_are_closed)
		&&
	!in_array($vbulletin->userinfo['usergroupid'], $user_groups_allowed_to_see_attaches)
		&&
	empty($user_groups_allowed_results)
)
{
	print_no_permission();
}

// end Closed Attachments code

Do you have something simular for 3.6? I just want to enable for all guests (and all other groups) to see the thumbnails. So no permissions for the thumbnails.
Reply With Quote
  #8  
Old 12-09-2006, 12:23 PM
TCB's Avatar
TCB TCB is offline
 
Join Date: Jun 2004
Location: the Netherlands
Posts: 193
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

** bump **
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 03:21 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03928 seconds
  • Memory Usage 2,244KB
  • 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
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)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
  • 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