Author Topic: Additional user field...disable HTML  (Read 2900 times)

0 Members and 1 Guest are viewing this topic.

Offline Lucifix

  • Hero Member
  • *****
  • Posts: 710
    • View Profile
    • http://www.slo-foto.net
Additional user field...disable HTML
« on: November 08, 2007, 02:38:32 PM »
Okey, I've created new field in 4images_users table called user_aboutme.

The problem is that user can enter any kind of html code in his/her profile settings.

Does anyone have idea how can I disable html or enable only allowed html or BBCODE code?

Offline Nicky

  • Administrator
  • 4images Guru
  • *****
  • Posts: 3.195
    • View Profile
Re: Additional user field...disable HTML
« Reply #1 on: November 13, 2007, 01:58:05 PM »
hi Lucifix,

quick response :)

i just tried that in members.php

search for
Code: [Select]
    if (!empty($additional_user_fields)) {
      $additional_field_array = array();
      foreach ($additional_user_fields as $key => $val) {
        $additional_field_array['lang_'.$key] = $val[0];
      }
      if (!empty($additional_field_array)) {
        $site_template->register_vars($additional_field_array);
      }
    }
    $content = $site_template->parse_template("member_profile");

and replace with

Code: [Select]
    if (!empty($additional_user_fields)) {
      $additional_field_array = array();
      foreach ($additional_user_fields as $key => $val) {
        $additional_field_array[$key] = (!empty($user_row[$key])) ? format_text($user_row[$key], $config['html_comments'], $config['wordwrap_comments'], $config['bb_comments'], $config['bb_img_comments'], 1) : REPLACE_EMPTY;
        $additional_field_array['lang_'.$key] = $val[0];
      }
      if (!empty($additional_field_array)) {
        $site_template->register_vars($additional_field_array);
      }
    }
    $content = $site_template->parse_template("member_profile");

1.) with this user can add HTML but will not be showed on his profile. (settings like for Comments in your admin CP)
2.) wordwrap will be used
3.) not allowed words will be displayed with ***
4.) BBCode can be used. (settings like for Comments in your admin CP)
« Last Edit: November 13, 2007, 03:06:57 PM by Nicky »
cheers
Nicky
Your first three "must do" before you ask a question ! (© by V@no)
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

nicky.net 4 4images
Signature stolen from mawenzi

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: Additional user field...disable HTML
« Reply #2 on: November 13, 2007, 02:09:45 PM »
Ok - this is good think.  8)
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?