vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.6 Template Modifications (https://vborg.vbsupport.ru/forumdisplay.php?f=192)
-   -   Users Can Hide Posts From Unregistered Browsers (https://vborg.vbsupport.ru/showthread.php?t=121075)

TygerTyger 07-12-2006 10:00 PM

Users Can Hide Posts From Unregistered Browsers
 
Requested by a forum member because of someone who had been banned continuing to nose around the forum as a Guest and I thought it was a sufficiently neat idea to be worth making known to the masses. All users have to do is choose to hide their posts to unregistered browsers (and search engines) in their UserCP. Sort of like a custom Tachy for privacy. :) Screenshot at the bottom!



INSTRUCTIONS

OPEN:
AdminCP > User Profile Fields > Add New User Profile Field

Add a new Single-Selection Menu then fill in the following settings:

Title: Hide my posts from Unregistered Browsers and Search Engines
Options: (Make sure they are in this order!)
No
Yes
Set Default: Yes, but no First Blank option
Field Required: No but display at registration
Field Editable by User: Yes
Private Field, Field Searchable on Members List, Show on Members List: All No. (Unfortunately you must make this a non-private field or the change won't register with Guests)

Display Page: Options: Log In/Privacy

Save the page and make a note of the field number assigned to your Custom Field, which is shown on the User Field Manager page next to the display number. If this is your first Custom Field then your field number will be 6. In the following template edit, change the X in fieldX to the number of your Custom Field.



OPEN:
UserCP > Styles & Templates > Edit Templates > Postbit(_legacy)

FIND: (shouldn't be tricky, it's the first lines ;))
Code:

<table class="tborder" id="post$post[postid]" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
        <td class="thead" $post[scrolltothis]>

REPLACE WITH:
Code:

<table class="tborder" id="post$post[postid]" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<if condition="$post['fieldX'] == Yes AND is_member_of($bbuserinfo, 1)">
<tr>
<td>
This user has chosen to hide their posts from Guest browsers.
</td>
</tr>
</table>
<else />

<tr>
        <td class="thead" $post[scrolltothis]>

FIND: (Should be equally difficult, it's the last lines)
Code:

<tr><td class="vbmenu_option"><a href="profile.php?$session[sessionurl]do=addlist&amp;userlist=buddy&amp;u=$post[userid]"><phrase 1="$post[username]">$vbphrase[add_x_to_buddy_list]</phrase></a></td></tr>
        </if>
        </table>
</div>
<!-- / post $post[postid] popup menu -->

REPLACE WITH:
Code:

<tr><td class="vbmenu_option"><a href="profile.php?$session[sessionurl]do=addlist&amp;userlist=buddy&amp;u=$post[userid]"><phrase 1="$post[username]">$vbphrase[add_x_to_buddy_list]</phrase></a></td></tr>
        </if></if>
        </table>
</div>
<!-- / post $post[postid] popup menu -->



And you're done! You can of course change the post-subtitute message to anything you like but you can't hide a post entirely because it breaks the formatting of the page so the table row must remain.


Demo:
http://img.photobucket.com/albums/v3...edbrowsers.png


Feedback, bugs, complaints to the usual address on the back of a postcard. You're going to hell if you use this hack and don't click install.

TygerTyger 07-13-2006 10:10 AM

Oh, nuts to this. Why did the similar thread not appear when I searched for it? Freaking vBulletin search engine...

Oh well, I guess now you have choice of doing it with a plugin using the other guy's method or a purely a template edit using mine.

His deals with the threadbit, mine does not. Mine doesn't trouble the database either, of course.

rob30UK 07-14-2006 03:23 PM

TygerTyger...

You have made here a fairly reasonable attempt at a mod, but I feel maybe you could make it far better. With a little thought behind why this would be used, it could have been made slightly differently. Think about it this way instead - I think this should be a native feature:-

Ability for users to hide their 'THREADS' from non members (not posts, as it would make convos non-sensical)....

This would however happen on a PER THREAD basis, not a global switch in usercp (bad idea)

The ability to hide threads or not should be controlled by the permissions system and an admin should be able to specify which groups can and cant do this.

The above, in my opinion would be the best implementation of any mod along these lines and would result in a very very popular and usable (even practical) mod.

I'm sure someone will do this very soon.... wonder who'll be first? :)

TygerTyger 07-14-2006 04:46 PM

Well if you check the other guy's method I linked to in the post above yours, his isn't too far off doing that.

The reason I left this one here (aside from the fact the search didn't pick it up until after I'd posted it :rolleyes) is because it's a quick-n-easy template-only edit and would still be useful for someone who wants to keep their posts out of the search engines which apparently some do.

I'm inclined to think that a global thread-switch would be what most people are after though, I think that a per-thread mod would have a more limited use. If not because what I personally would do is a make a forum section for "Secrets" or whyever people would want to hide their thread and just hide the section from Guests.

utw-Mephisto 07-15-2006 02:57 AM

I would rather see something like used here on vb.org were code is only visible for licensed user ..

TygerTyger 07-15-2006 07:06 AM

To be honest I'm astonished they don't already do that, I assumed they did.

Edit: They do.

Snake 08-30-2006 04:59 PM

Thanks for the hack! I'll install it right away...

txsbmw 09-17-2006 05:50 PM

I just tried this on 3.6.1 and cannot get it to work. Is there any way to make this work with 3.6.1?

jilly 11-27-2006 12:46 AM

so how exactly would I modify this so that a user hides their posts from all usergroups, not just guests?

jilly 11-27-2006 01:47 AM

someone told me to remove the bbuser condition at the end, and just use

<if condition="$post['fieldxx'] == Yes">

instead, and it works fine!!! Thank you so much Tyger, this is a great option for my users when they need to hide their posts from general view for whatever reason, and what the freedom to hide or unhide their posts whenever they need to.


All times are GMT. The time now is 10:28 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.01310 seconds
  • Memory Usage 1,749KB
  • 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
  • (4)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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