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-27-2010, 02:05 AM
yotsume's Avatar
yotsume yotsume is offline
 
Join Date: Dec 2006
Posts: 844
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Prevent Censored Words From Being Striped From Custom Fields?

Prevent Censored Words From Being Striped From Custom Not Visible Fields?

Is it possible to remove some code that strips the censored words we enter in the "Censored Words" field in the vbAdminCP. I need the censored words to NOT be stripped from our not visible custom fields.

Example:
I do not want my members to be able to post their last names. So I enter their last names in the Censored Words list and that works great. However... their last names are now lost in their custom fields in their profile that only admins were set to see.

How can I stop the censored words from striping none visible custom fields?

The site is running vb3.7x
Reply With Quote
  #2  
Old 11-29-2010, 08:57 PM
yotsume's Avatar
yotsume yotsume is offline
 
Join Date: Dec 2006
Posts: 844
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

BUMP! Lynn anyone please help.
Reply With Quote
  #3  
Old 11-29-2010, 09:13 PM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I know there's a 3.8 mod to disable the word censor per user... I know this isn't what you need but you could probably look at the code and get a good idea of where to start.

There's also this old one to disable per forum: https://vborg.vbsupport.ru/showthread.php?t=98269
Reply With Quote
  #4  
Old 11-29-2010, 09:23 PM
yotsume's Avatar
yotsume yotsume is offline
 
Join Date: Dec 2006
Posts: 844
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

No sure that code helps at all. I have looked already. I need the censored words to not strip private fields. Nothing to do with forums or usergroups.
Reply With Quote
  #5  
Old 11-29-2010, 10:11 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I think you can edit includes/class_dm_user.pm. Around line 1208 or so, add the 'hidden' column to the query (scroll right to see what I changed):

Code:
// check extra profile fields
$profilefields = $this->dbobject->query_read_slave("
	SELECT profilefieldid, required, size, maxlength, type, data, optional, regex, def, editable, hidden	
	FROM " . TABLE_PREFIX . "profilefield
	$all_fields_sql
	ORDER BY displayorder
");

Then just below that around line 1235, I added the first two red lines and made a change in the line below that:
Code:
if (in_array($profilefield['profilefieldid'], $field_ids) AND ($all_fields != 'register' OR $profilefield['editable']))
{
	if (!$profilefield['hidden'])
		$value = fetch_censored_text($value);
	$value = trim(substr($value, 0, $profilefield['maxlength']));
	$value = (empty($value) AND $value != '0') ? false : $value;
}

Of course this doesn't bring back any data that's already been censored.
Reply With Quote
  #6  
Old 11-29-2010, 10:28 PM
yotsume's Avatar
yotsume yotsume is offline
 
Join Date: Dec 2006
Posts: 844
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok I am trying this right now... I will report back.... THANKS!

I am sure you meant to edit the file: class_dm_user.php
--------------- Added 29 Nov 2010 at 17:45 ---------------

My code is a little different on vb3.7x
Code:
                if (in_array($profilefield['profilefieldid'], $field_ids) AND ($all_fields != 'register' OR $profilefield['editable']))
                {
                    if (!$profilefield['hidden'])
                    $value = fetch_censored_text($value);
                    $value = trim($value, substr(fetch_censored_text($value), 0, $profilefield['maxlength']));
                    $value = (empty($value) AND $value != '0') ? false : $value;
Above is how I made your second edit. Testing now...

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

BINGO it looks like it worked perfectly!

Added new censored word, rebuilt post cache, typed the word and its blocked but the private field still has the data!

I run a very large international classroom website. The kids are not allowed to post their last names anywhere on the site. We collect the last names at registration time and then add their last names to the censored words.

MUCH THANKS!
Reply With Quote
  #7  
Old 11-29-2010, 10:53 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It could be different because mine came from v3.8.3, but it could also be that I made it confusing by not including before/after code, just the "after". Here's before/after:

Code:
if (in_array($profilefield['profilefieldid'], $field_ids) AND ($all_fields != 'register' OR $profilefield['editable']))
{
	$value = trim(substr(fetch_censored_text($value), 0, $profilefield['maxlength']));
	$value = (empty($value) AND $value != '0') ? false : $value;
}
Code:
if (in_array($profilefield['profilefieldid'], $field_ids) AND ($all_fields != 'register' OR $profilefield['editable']))
{
	if (!$profilefield['hidden'])
		$value = fetch_censored_text($value);	
	$value = trim(substr($value, 0, $profilefield['maxlength']));
	$value = (empty($value) AND $value != '0') ? false : $value;
}

ETA: Posted that before you repsonded. Kind of surprised that works - you may want to make sure it matches what I posted, I think your "trim" has too many params to it and might work by accident.
Reply With Quote
  #8  
Old 11-29-2010, 11:03 PM
yotsume's Avatar
yotsume yotsume is offline
 
Join Date: Dec 2006
Posts: 844
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

A larger chunk of my code around these lines is:
Code:
                if (in_array($profilefield['profilefieldid'], $field_ids) AND ($all_fields != 'register' OR $profilefield['editable']))
                {
                    if (!$profilefield['hidden'])
                    $value = fetch_censored_text($value);
                    $value = trim($value, substr(fetch_censored_text($value), 0, $profilefield['maxlength']));
                    $value = (empty($value) AND $value != '0') ? false : $value;
                }
                else if ($all_fields == 'register' AND $profilefield['data'] !== '')
                {
                    $value = unhtmlspecialchars($profilefield['data']);
                }
                else
                {
                    continue;
                }
                $customfields .= "$profilefield[title] : $value\n";
                $regex_check = true;
I think were looking at altered files already due to version differences. But... its works... so no sure what might go wrong or now here.

You said:
Quote:
I think your "trim" has too many params to it and might work by accident.
What do you see wrong in my code and where?
Reply With Quote
  #9  
Old 11-29-2010, 11:09 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I think this line:

Code:
            $value = trim($value, substr(fetch_censored_text($value), 0, $profilefield['maxlength']));

Should be:

Code:
            $value = trim(substr($value, 0, $profilefield['maxlength']));
I think what you have works because trim() only looks at the first argument, but the value doesn't go through substr() to make sure it's no longer than the max length.

ETA: ...but it's not a big deal, I'm pretty sure it will be OK the way it is.
Reply With Quote
  #10  
Old 11-29-2010, 11:42 PM
yotsume's Avatar
yotsume yotsume is offline
 
Join Date: Dec 2006
Posts: 844
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by kh99 View Post
I think this line:

Code:
            $value = trim($value, substr(fetch_censored_text($value), 0, $profilefield['maxlength']));
Should be:

Code:
            $value = trim(substr($value, 0, $profilefield['maxlength']));
I think what you have works because trim() only looks at the first argument, but the value doesn't go through substr() to make sure it's no longer then the max length.

ETA: ...but it's not a big deal, I'm pretty sure it will be OK the way it is.
Well I am using your edit here and still seems to work fine with no noticeable errors.

The Next Step:


My next step that I have to get solved is how to code a php file so I can pull from my database that one private field which would generate a list of my members last names... any takers on this one???
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:02 PM.


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.04794 seconds
  • Memory Usage 2,288KB
  • Queries Executed 14 (?)
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
  • (10)bbcode_code
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete