vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   Allow Group to Read Titles / Not Content (https://vborg.vbsupport.ru/showthread.php?t=60178)

Princeton 01-12-2004 10:00 PM

Allow Group to Read Titles / Not Content
 
Tested and working in 3.0.3 - 3.0.7

This hack will enable you to DISABLE SHOWTHREAD according to USERGROUP.This will allow all your members to view titles and topic counts found within a section. Think of it as "window shopping". Your members will be able to read all topics from the forumdisplay.php page but, will not be allowed to read it's content unless they have permission

The edits below will prevent anyone from viewing the contents of a post from within showthread, printthread, showpost, and archives.

This feature can be used on a per USERGROUP and /or per FORUM basis. You, as the admin, will have complete control.

You will need to modify:
  • includes/init.php
  • includes/adminfunctions_forums.php
  • admincp/resources.php
  • admincp/usergroup.php
  • showthread.php
  • archive/index.php
  • printthread.php
  • showpost.php
  • archive.css
Add 3 new phrases.
MOD VERSION 1.05
  • Fixed issues concerning the archives - eg. blank page was displayed ... now, thread links are viewable but not active (if not allowed).
MOD VERSION 1.01
  • now with personal NOT ALLOWED message
  • Easier to install
  • now add the ability to allow users to view their own posts/threads (view below code)
  • archive section changed to NOT display links to content that is not READABLE
  • added a message to archive section if user cannot read content
[hr=blue]4[/hr]
Allow User To View And Post Into Their Own Threads:
If you want to allow users to view and post their own threads and have access to them ... use this code in showthread, printhread, and showpost.php:
Code:

// ================================================= \\
// == [ ALLOW GROUP TO READ TITLE / NOT CONTENT - GTP BEGIN ]
                if (!($forumperms & GTPCANREADCONTENT)AND ($thread['postuserid'] != $bbuserinfo['userid']))
                {
                    eval(print_standard_error('gtp_cannot_read'));
                }
// == [ 00-00-2004 - GTP END ]
// ================================================= \\

NOTE: You may have to use "$threadinfo['postuserid]" on some of the pages.

[hr=blue]4[/hr]
Disable Thread Preview
To disable thread previews on forums that user cannot read content do the following edits:
FIND in functions/forumdisplay.php:
Code:

    // format thread preview if there is one
    if ($ignore["$thread[postuserid]"])
    {
        $thread['preview'] = '';
    }
    else if (isset($thread['preview']) AND $vboptions['threadpreview'] > 0)
    {
        $thread['preview'] = strip_quotes($thread['preview']);
        $thread['preview'] = htmlspecialchars_uni(fetch_trimmed_title(strip_bbcode($thread['preview'], false, true), $vboptions['threadpreview']));
    }

REPLACE IT WITH:
Code:

// ================================================= \\
// == [ ALLOW GROUP TO READ TITLE / NOT CONTENT - GTP BEGIN ]
    $forumperms = fetch_permissions($foruminfo['forumid']);
    // format thread preview if there is one
    if ($ignore["$thread[postuserid]"] OR !($forumperms & GTPCANREADCONTENT))
    {
        $thread['preview'] = '';
    }
    else if (isset($thread['preview']) AND $vboptions['threadpreview'] > 0)
    {
        $thread['preview'] = strip_quotes($thread['preview']);
        $thread['preview'] = htmlspecialchars_uni(fetch_trimmed_title(strip_bbcode($thread['preview'], false, true), $vboptions['threadpreview']));
    }
// == [ 00-00-2004 - GTP END ]
// ================================================= \\

[hr=blue]4[/hr]
Example Of How Hack Works:
I have a forum with (sub-forums) ... however, one of the sub-forums is private (for PREMIUM members only). Here's how the settings would look like.

In USERGROUP MANAGER (this is a global setting) set "Group can read content?:
UNREGISTERED - YES
REGISTERED - YES
PREMIUM - YES

The global setting will be transferred to all forums; but, we have a sub-forum that is only for PREMIUM MEMBERS so...

In FORUM PERMISSIONS MANAGER set private forum to:
UNREGISTERED - NO
REGISTERED - NO
PREMIUM - YES

NTLDR 01-13-2004 10:11 PM

Good to see proper use of bit fields :)

I'd just like to point out that quickly looking at this I can see three easy ways of getting around it: 1) Use print thread to view the entire thread without registering 2) use the archive to view the entire thread without registering 3) use threaded/hybrid mode if enabled. My apologies if any of the above 3 arn't true, but they all spring to mind after glancing at the code ;)

Princeton 01-14-2004 01:09 AM

Quote:

Originally Posted by NTLDR
Good to see proper use of bit fields :)

I'd just like to point out that quickly looking at this I can see three easy ways of getting around it: 1) Use print thread to view the entire thread without registering 2) use the archive to view the entire thread without registering 3) use threaded/hybrid mode if enabled. My apologies if any of the above 3 arn't true, but they all spring to mind after glancing at the code ;)

thank you ... I completely forgot about the printthread and archives.
I have updated the file and instructions. The new version is v.1.2.

I do not use nor do I have access to thread/hybrid. (I completely removed the templates from my site.) This will have to be tested by someone who uses these features.

If anyone uses this hack can you confirm that it works?

Boofo 01-14-2004 02:34 AM

What do we do if we have another hack installed already using that bit field? And can this be done on a per forum basis? There are a couple of forums I need left open for unregistered users to view the messages.

Princeton 01-14-2004 02:41 AM

multiply the last bitfield value by 2 ... another way to look at it is add up all the previous numbers.

this is an inclusion to the existing permission system ... yes, you can use on a per forum basis. (that's the whole idea)

follow the direction on the file (last section)

Boofo 01-14-2004 02:58 AM

Quote:

Originally Posted by princeton
multiply the last bitfield value by 2 ... another way to look at it is add up all the previous numbers.

this is an inclusion to the existing permission system ... yes, you can use on a per forum basis. (that's the whole idea)

follow the direction on the file (last section)

How high can the bit fields actually go then? Is there a limit?

NTLDR 01-14-2004 10:32 AM

To prevent thread/hybrid and linear all with one edit just place the showthread.php block of code above:

PHP Code:

      if ($threadedmode == 0

That should work I think :)

@Boofo: I'd assume the limit is restricted by the upper limit that PHP can use on your platform (around 2147483647 for integers, no idea if it will work with floats as I haven't tested).

Princeton 01-14-2004 12:27 PM

Quote:

Originally Posted by NTLDR
To prevent thread/hybrid and linear all with one edit just place the showthread.php block of code above:

PHP Code:

      if ($threadedmode == 0

That should work I think :)

@Boofo: I'd assume the limit is restricted by the upper limit that PHP can use on your platform (around 2147483647 for integers, no idea if it will work with floats as I haven't tested).

duh! thank you. I don't know what I was thinking.

I just added the threaded/hybrid mode back onto my site and everything is working. I like how the hybrid mode looks like ... maybe I'll leave it as an option for my members.

Boofo 01-14-2004 01:09 PM

Quote:

Originally Posted by NTLDR
@Boofo: I'd assume the limit is restricted by the upper limit that PHP can use on your platform (around 2147483647 for integers, no idea if it will work with floats as I haven't tested).

How would you use floats?

NTLDR 01-14-2004 01:13 PM

If a int is to big to be an int then it automatically becomes a float :)

Littlebit 01-14-2004 02:34 PM

Thanks Princeton! I had just inquired about this very thing on vb.com! View Posts Usergroups Option

Installing now :)

gmarik 01-14-2004 07:35 PM

Jesus - it's too much hacking - is there any quicker way?

Princeton 01-15-2004 02:40 PM

Quote:

Originally Posted by gmarik
Jesus - it's too much hacking - is there any quicker way?

Yep, it's mostly one line edits. The archive, printthread, and showthread have to be modified for this to work as intended.

You can always take a short cut - do the first few steps and add a conditional into your postbit to allow GROUP. However, this defeats the purpose as the system will still query the database.

My goal is usability and optimization nothing less.

HiDeo 01-15-2004 04:34 PM

Very good hack, I'll install soon :D

lange 01-16-2004 12:03 AM

The Custom Permissions is not working for registred members.


By example, I can't get:

Can View Forum Yes

Can View Others' Threads Yes

Can See Deletion Notices Yes

Can Search Forum Yes

Can Use Email to Friend Yes

Can Download Attachments Yes

Post Permissions:
Can Post Threads No

Can Reply to Own Threads No

Can Reply to Others' Threads No

Always Moderate This Group's Posts No

Can Upload Attachments No

Can Rate Threads Yes

Group can read content? No (but I want 'Yes'. It is always enable to No)

Princeton 01-16-2004 01:58 AM

can you be more specific?
can you modify the field in admincp/usergroup.php?s=&do=edit&usergroupid=2?
can you modify the field in admincp/forumpermission.php?do=quickforum?

lange 01-16-2004 03:05 AM

Can you modify the field in admincp/usergroup.php?s=&do=edit&usergroupid=2?

Yes


Can you modify the field in admincp/forumpermission.php?do=quickforum?

No I can't modify the Group can read cotnent ? It is enable to 'No'. I can't change it to Yes.

Princeton 01-16-2004 03:37 AM

try this fix ...
Above in includes/adminfunctions_forums.php; (around LINE 185)
I have canreadcontent it should be gtcanreadcontent. Hopefully, that will fix your problem.

PS. I just updated the attachment to v.1.5

lange 01-16-2004 04:27 AM

Checked the permissions and all is OK now (forums & subforums).

This hack should be include in next release. It's a must.

Click install


Thx Princeton

esfron 01-17-2004 12:58 PM

I installed it and it works fine for me! Clicked Install.

Thanks

Megatekno 01-17-2004 03:49 PM

Hello,

This solution adorned me simple assé for check resulted.

In the file includes / functions_forumlist.php has the line 161 to replace

if (!($forumperms & CANVIEW) OR !($forumperms & CANVIEWOTHERS))

By

if (!($forumperms & CANVIEW))

In the file forumdisplay.php has the line 454 to replace

if (!($forumperms & CANVIEWOTHERS))

By

if (!($forumperms))

Can it work on the basis of forum by forum, that is we can activate or deactivate such or such forum by perissions, as it was the case for version vb2.x

Princeton 01-17-2004 03:57 PM

huh?

yes, it works on a per forum basis

rms10 02-12-2004 12:58 AM

Nice hack:) What would we have to change to keep them from reading the titles too?

Princeton 02-12-2004 01:24 AM

you don't need this hack to achieve what you want ... look into vb's default permissions and prevent group from viewing the forum

rms10 02-12-2004 01:12 PM

Actually, I do:)
I have a situtation where hazard report information is placed in a forum. The thread may affect all the groups or a combination of those groups. If a hazard does not affect a group it is important to keep the existence of the title and information from them.

If I prevent groups from just seeing the forum as you stated it would require me to have multiple forums which could get out of hand. ie.. 300 reports would equal 300 forums.

If I was able to hide the thread using your hack then I would only have 1 forum for all groups to go to and the groups would only be able to view titles and threads they are given access too.

BTW thanks for the fast reply :)

Princeton 02-12-2004 10:45 PM

You do not need a hack to accomplish what you want. You can prevent a group from viewing threads created by others using vb's default permissions system.

If this is not what you where asking there is no need to continue reading.:)

For example, if userA, who belongs to groupA, creates a thread it does not mean that userB, who belongs to groupB, will have access to view the thread. (vice-versa)

You control this by setting permissions to specific usergroups for specific forums.

The usergroup section in your vb cpanel will allow you to set DEFAULT settings permissions per group. However, you can change the permissions per group/ per forum by going into the Forums & Moderators / Forum Permissions and modify permissions for each group as you see fit.

rms10 02-13-2004 02:54 AM

Thanks for the response. I can see why we have the confusion. I thought the admin could post a thread and then dictate who could see it. What I am lookin for is something that will alow me to post threads in a forum that 6 different groups have access too. With said threads I need to be able to let from 1 to 6 groups see each one depending on status given to the thread. Group 1 and 2 might be able to see thread 1 for instance while group 1, 3 and 6 might see thread 2 and so forth.

Thanks again for taking the time to respond :)

Princeton 02-13-2004 04:13 PM

If I understand this correctly, you want to determine who gets to view thread upon submitting a new thread (based on the status poster chooses)?

Since you have "200 reports", it is wise to group/organize. One forum will give you a headache in the long run.

What I recommend ....
1. Since you have 6 groups, I suggest creating 6 different forums. Set the proper permissions for each group.
2. Create a new FORM (similar to newthread form) that will use the "status" value as a replacement for forumid.
for example
HTML Code:

<select name="f" tabindex="1">
 <option value="33">status green</option>
<option value="34">status red</option>
 </select>

if the thread poster chooses green the thread will be submitted into forumid 33

rms10 02-14-2004 06:28 PM

Thanks princeton :)

That is really not an option for me because the designated groups must be able to read and respond to the posts made by anyone that has access to the thread

Snappa 03-26-2004 12:37 AM

Quote:

Originally Posted by gmarik
Jesus - it's too much hacking - is there any quicker way?

lmao!!!

sabret00the 04-03-2004 02:15 PM

is this/can this be used to just "override the visiable but must be registered to view threads" option or is it all hardcoded?

the reason i ask is because i don't want unactive usergroups viewing the threads either.

sabret00the 04-03-2004 02:17 PM

also what's the difference between this and this one?

Princeton 04-03-2004 04:58 PM

this hack utilizes vb's forum permissions system
It will allow you to enable view of showthread to specific usergroups and still display threadbit to everyone.

For example, if you have Premium Members (donations) and one benefit of being a Premium Member is that they get access to specific areas. Well, this hack will allow users to "window shop" view what is in these areas before becoming a Premium Member. This hack can be used to convert Registered Members into Premium Members.

esfron 04-28-2004 09:06 PM

Is it working on 3.0.1 ?

Princeton 04-28-2004 09:11 PM

I have yet to update my files to 3.0.1 so I cannot say. :(

sorry

sabret00the 05-08-2004 02:03 PM

Quote:

Originally Posted by sabret00the
is this/can this be used to just "override the visiable but must be registered to view threads" option or is it all hardcoded?

the reason i ask is because i don't want unactive usergroups viewing the threads either.

just to clarify, it will add a new option in the http://site/forums/admincp/resources.php?

Princeton 05-08-2004 02:47 PM

yes, it does

keep in mind that I have not updated this to the latest GOLD release ...

TundraSoul 05-12-2004 04:33 AM

The most useful hack I've installed in a long time. Good job!

Princeton 05-12-2004 12:47 PM

TundraSoul,
thank you ... did you install this hack on vb's latest version?

MaxScript 05-15-2004 08:38 PM

i made the edits, i'll upload them tonight ....


All times are GMT. The time now is 04:50 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.01741 seconds
  • Memory Usage 1,846KB
  • 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
  • (3)bbcode_code_printable
  • (1)bbcode_html_printable
  • (2)bbcode_php_printable
  • (7)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete