Custom Profile Field Mod

Started by winrules, March 30, 2006, 02:21:25 PM

Previous topic - Next topic

winrules

Quote from: john109 on April 29, 2006, 12:26:35 AM
Hi winrules!

I noticed I've been getting these errors whenever I add someone to a membergroup.  Do you know if it could be because of this mod?

2: Missing argument 2 for db_query()
File: /home/....../public_html/smf/Sources/Subs.php
Line: 237

2: Missing argument 3 for db_query()
File: /home/....../public_html/smf/Sources/Subs.php
Line: 237


Also when I click on Re-create field on any of the custom fields I have these errors come up in the error log.  I get this pair of errors 4 times each time I click on Re-create field.  I have 6 custom fields (4 text, 2 check boxes).

8: Undefined index: cp
File: /home/...../public_html/smf/Sources/ModSettings.php
Line: 317

8: Undefined index: CP_type
File: /home/...../public_html/smf/Sources/ModSettings.php
Line: 317



I really don't see how that could be caused by this mod, because this mod doesn't modify subs.php at all, but could you post the query on line 237 anyway?

database404, also make sure you've put some data in the field in your profile, if there's no data it won't show.


winrules
SMF Developer
               
My Mods
Please do not PM me for support.


winrules

Version 2.14 has been released! This version fixes some issues with selection fields.


winrules
SMF Developer
               
My Mods
Please do not PM me for support.



winrules



winrules
SMF Developer
               
My Mods
Please do not PM me for support.


perplexed

everything is working so well, can I upgrade with no problems or do I have to do the recreate field thing again?

winrules

Quote from: perplexed on April 29, 2006, 03:07:08 PM
everything is working so well, can I upgrade with no problems or do I have to do the recreate field thing again?
you don't have to do the recreate field thing, you should be able to upgrade with no problems. It should fix the problems reported here:

Quote from: perplexed on April 24, 2006, 05:47:28 PM
Quote from: perplexed on April 23, 2006, 10:36:52 AM
I tried using the CPF registration fields both as 'optional' and as 'forced' and everything works :)
I am only getting one error in the forum log:

http://www.mysite.com/forum/index.php?option=com_smf&Itemid=83&action=register
8: Undefined index: member
File: /home/mysite/public_html/forum/Themes/default/Register.template.php (before sub template - eval?)
Line: 127

This error?  I got it in the log after someone registered

Also since I had to look in the log again... it is full of

8: Undefined index: CP9
File: /home/mysite/public_html/forum/Themes/default/Profile.template.php (forumProfile sub template - eval?)
Line: 1699

for CP9 and CP10 - these are both fields for registration that also show in your profile, and they are selection boxes for selecting browser type, and OS.

CP9 shows in profile as firefox and CP10 as PC unless people change it. I have 4 fields in registration, but only these two are selection boxes and seen by the user. The other two are text fields and only seen by admin.  I wonder if it has something to do with that?






winrules
SMF Developer
               
My Mods
Please do not PM me for support.


eckostylez

I get this error when trying to install:

Installations actions for "Custom Profile Mod":
Installing this package will perform the following actions:
   Type    Action    Description
1.    Execute Modification    -    Modification parse error

eckostylez

Waha!, I got it to work. Thanks for the mod :)

winrules

Quote from: eckostylez on April 29, 2006, 04:41:26 PM
Waha!, I got it to work. Thanks for the mod :)
glad you got it working :)


winrules
SMF Developer
               
My Mods
Please do not PM me for support.


john109

Hi winrules thx.  I already tried getting this checked out in the General Support section and JayBachatero couldn't figure it out.  He didn't think any of my other mods could have caused it.

Does Orstio's bridge modify subs.php?

Line 237 is this one: function db_query($db_string, $file, $line)
// Do a query.  Takes care of errors too.
function db_query($db_string, $file, $line)
{
global $db_cache, $db_count, $db_connection, $modSettings;

// One more query....
$db_count = !isset($db_count) ? 1 : $db_count + 1;

// Debugging.
if (isset($GLOBALS['db_show_debug']) && $GLOBALS['db_show_debug'] === true)
{
if (!empty($_SESSION['debug_redirect']))
{
$db_cache = array_merge($_SESSION['debug_redirect'], $db_cache);
$db_count = count($db_cache) + 1;
$_SESSION['debug_redirect'] = array();
}

$db_cache[$db_count]['q'] = $db_string;
$db_cache[$db_count]['f'] = $file;
$db_cache[$db_count]['l'] = $line;
$st = microtime();
}

// First, we clean strings out of the query, reduce whitespace, lowercase, and trim - so we can check it over.
if (empty($modSettings['disableQueryCheck']))
{
$clean = '';
$old_pos = 0;
$pos = -1;
while (true)
{
$pos = strpos($db_string, '\'', $pos + 1);
if ($pos === false)
break;
$clean .= substr($db_string, $old_pos, $pos - $old_pos);

while (true)
{
$pos1 = strpos($db_string, '\'', $pos + 1);
$pos2 = strpos($db_string, '\\', $pos + 1);
if ($pos1 === false)
break;
elseif ($pos2 == false || $pos2 > $pos1)
{
$pos = $pos1;
break;
}

$pos = $pos2 + 1;
}
$clean .= '%s';

$old_pos = $pos + 1;
}
$clean .= substr($db_string, $old_pos);
$clean = trim(strtolower(preg_replace(array('~\s+~s', '~/\*!40001 SQL_NO_CACHE \*/~', '~/\*!40000 USE INDEX \([A-Za-z\_]+?\) \*/~'), array(' ', '', ''), $clean)));

// We don't use UNION in SMF, at least so far.  But it's useful for injections.
if (strpos($clean, 'union') !== false && preg_match('~(^|[^a-z])union($|[^[a-z])~s', $clean) != 0)
$fail = true;
// Comments?  We don't use comments in our queries, we leave 'em outside!
elseif (strpos($clean, '/*') > 2 || strpos($clean, '--') !== false || strpos($clean, ';') !== false)
$fail = true;
// Trying to change passwords, slow us down, or something?
elseif (strpos($clean, 'set password') !== false && preg_match('~(^|[^a-z])set password($|[^[a-z])~s', $clean) != 0)
$fail = true;
elseif (strpos($clean, 'benchmark') !== false && preg_match('~(^|[^a-z])benchmark($|[^[a-z])~s', $clean) != 0)
$fail = true;
// Sub selects?  We don't use those either.
elseif (preg_match('~\([^)]*?select~s', $clean) != 0)
$fail = true;

if (!empty($fail))
{
log_error('Hacking attempt...' . "\n" . $db_string, $file, $line);
fatal_error('Hacking attempt...', false);
}
}

$ret = mysql_query($db_string, $db_connection);
if ($ret === false && $file !== false)
$ret = db_error($db_string, $file, $line);

// Debugging.
if (isset($GLOBALS['db_show_debug']) && $GLOBALS['db_show_debug'] === true)
$db_cache[$db_count]['t'] = array_sum(explode(' ', microtime())) - array_sum(explode(' ', $st));

return $ret;
}

function db_affected_rows()
{
global $db_connection;

return mysql_affected_rows($db_connection);
}

function db_insert_id()
{
global $db_connection;

return mysql_insert_id($db_connection);
}

winrules

Quote from: john109 on April 29, 2006, 07:30:03 PM
Hi winrules thx.  I already tried getting this checked out in the General Support section and JayBachatero couldn't figure it out.  He didn't think any of my other mods could have caused it.

Does Orstio's bridge modify subs.php?

Line 237 is this one: function db_query($db_string, $file, $line)
// Do a query.  Takes care of errors too.
function db_query($db_string, $file, $line)
{
global $db_cache, $db_count, $db_connection, $modSettings;

// One more query....
$db_count = !isset($db_count) ? 1 : $db_count + 1;

// Debugging.
if (isset($GLOBALS['db_show_debug']) && $GLOBALS['db_show_debug'] === true)
{
if (!empty($_SESSION['debug_redirect']))
{
$db_cache = array_merge($_SESSION['debug_redirect'], $db_cache);
$db_count = count($db_cache) + 1;
$_SESSION['debug_redirect'] = array();
}

$db_cache[$db_count]['q'] = $db_string;
$db_cache[$db_count]['f'] = $file;
$db_cache[$db_count]['l'] = $line;
$st = microtime();
}

// First, we clean strings out of the query, reduce whitespace, lowercase, and trim - so we can check it over.
if (empty($modSettings['disableQueryCheck']))
{
$clean = '';
$old_pos = 0;
$pos = -1;
while (true)
{
$pos = strpos($db_string, '\'', $pos + 1);
if ($pos === false)
break;
$clean .= substr($db_string, $old_pos, $pos - $old_pos);

while (true)
{
$pos1 = strpos($db_string, '\'', $pos + 1);
$pos2 = strpos($db_string, '\\', $pos + 1);
if ($pos1 === false)
break;
elseif ($pos2 == false || $pos2 > $pos1)
{
$pos = $pos1;
break;
}

$pos = $pos2 + 1;
}
$clean .= '%s';

$old_pos = $pos + 1;
}
$clean .= substr($db_string, $old_pos);
$clean = trim(strtolower(preg_replace(array('~\s+~s', '~/\*!40001 SQL_NO_CACHE \*/~', '~/\*!40000 USE INDEX \([A-Za-z\_]+?\) \*/~'), array(' ', '', ''), $clean)));

// We don't use UNION in SMF, at least so far.  But it's useful for injections.
if (strpos($clean, 'union') !== false && preg_match('~(^|[^a-z])union($|[^[a-z])~s', $clean) != 0)
$fail = true;
// Comments?  We don't use comments in our queries, we leave 'em outside!
elseif (strpos($clean, '/*') > 2 || strpos($clean, '--') !== false || strpos($clean, ';') !== false)
$fail = true;
// Trying to change passwords, slow us down, or something?
elseif (strpos($clean, 'set password') !== false && preg_match('~(^|[^a-z])set password($|[^[a-z])~s', $clean) != 0)
$fail = true;
elseif (strpos($clean, 'benchmark') !== false && preg_match('~(^|[^a-z])benchmark($|[^[a-z])~s', $clean) != 0)
$fail = true;
// Sub selects?  We don't use those either.
elseif (preg_match('~\([^)]*?select~s', $clean) != 0)
$fail = true;

if (!empty($fail))
{
log_error('Hacking attempt...' . "\n" . $db_string, $file, $line);
fatal_error('Hacking attempt...', false);
}
}

$ret = mysql_query($db_string, $db_connection);
if ($ret === false && $file !== false)
$ret = db_error($db_string, $file, $line);

// Debugging.
if (isset($GLOBALS['db_show_debug']) && $GLOBALS['db_show_debug'] === true)
$db_cache[$db_count]['t'] = array_sum(explode(' ', microtime())) - array_sum(explode(' ', $st));

return $ret;
}

function db_affected_rows()
{
global $db_connection;

return mysql_affected_rows($db_connection);
}

function db_insert_id()
{
global $db_connection;

return mysql_insert_id($db_connection);
}

I looked in your thread in general english support and it looks like oristo has posted an answer.


winrules
SMF Developer
               
My Mods
Please do not PM me for support.


el

Hi winrules!

I'm using SMF 1.1 RC2 with these mods installed:

1. TinyPortal 0.86
2. SMF 1.0.7 / 1.1 RC2 Update 1.0
3. Custom Profile Mod
and Helios_Multi theme.

Well, the problems are the following:
1) Using the Helios_Multi theme, the custom fields don't show up in regular posts inside the forum but only at pm posts
2) when i uninstall the package, delete it and download and install again, the old custom fields i have created continue to exist. Is this normal? I would really like to delete some of them. As far as i searched, i couldn't find an erase field option.

I would really appreciate it if u could help me overcome the above problems.
Let me know if i you need more info.

Thanks in advance!!!!

elnismo

PS. PLS forgive me if the above problem is solved previously... let me know in that case where to search for the answer, as i wouldn't like to waste your time.

winrules

Quote from: elnismo on April 30, 2006, 09:17:47 AM
Hi winrules!

I'm using SMF 1.1 RC2 with these mods installed:

1. TinyPortal 0.86
2. SMF 1.0.7 / 1.1 RC2 Update 1.0
3. Custom Profile Mod
and Helios_Multi theme.

Well, the problems are the following:
1) Using the Helios_Multi theme, the custom fields don't show up in regular posts inside the forum but only at pm posts
2) when i uninstall the package, delete it and download and install again, the old custom fields i have created continue to exist. Is this normal? I would really like to delete some of them. As far as i searched, i couldn't find an erase field option.

I would really appreciate it if u could help me overcome the above problems.
Let me know if i you need more info.

Thanks in advance!!!!

elnismo

PS. PLS forgive me if the above problem is solved previously... let me know in that case where to search for the answer, as i wouldn't like to waste your time.

Look at the first post of this topic, it shows how to make the show in posts work with different themes.
As far as deleting fields, you currently can't, but you can just disable them. If you really wanted to you can remove the values from phpmyadmin, but you can only do the last ones and it would probly be more trouble than it's worth.


winrules
SMF Developer
               
My Mods
Please do not PM me for support.


el

Thank you for your immediate responce!...

el

Unfortunately the steps you provide doesn't solve the problem...

Helios_multi has it's own display.template.php and it doesn't has the "code to be replaced".

the /themes/default/ directory has the 4 templates you say that the replacing code should be placed but only display.template.php and personalmessage.template.php has the "code to be replaced". I made the changes, but nothing changed actually.
any more ideas?

winrules

Quote from: elnismo on April 30, 2006, 10:38:25 AM
Unfortunately the steps you provide doesn't solve the problem...

Helios_multi has it's own display.template.php and it doesn't has the "code to be replaced".

the /themes/default/ directory has the 4 templates you say that the replacing code should be placed but only display.template.php and personalmessage.template.php has the "code to be replaced". I made the changes, but nothing changed actually.
any more ideas?
look for similar code...
also look here: How to make the mod work with other themes


winrules
SMF Developer
               
My Mods
Please do not PM me for support.


el

#256
well, i searched for similar code and i can't find anything similirar to the profile.template.php and to the register.template.php. i found similar code to helios_multi display.template.php, changed it, but nothing changed in the board. May i post the code of each file here so as to see if there is any problems in them?

winrules

Quote from: elnismo on April 30, 2006, 11:14:58 AM
well, i searched for similar code and i can't find anything similirar to the profile.template.php and to the register.template.php. i found similar code to helios_multi display.template.php, changed it, but nothing changed in the board. May i post the code of each file here so as to see if there is any problems in them?
all you need to find is the code in display.template.php. You need to enable fields from the admin center for it to do anything.


winrules
SMF Developer
               
My Mods
Please do not PM me for support.


el

Quote from: winrules on April 30, 2006, 01:07:27 PM
all you need to find is the code in display.template.php. You need to enable fields from the admin center for it to do anything.

Both already done. Unfortunately no results.

winrules

Quote from: elnismo on April 30, 2006, 01:47:47 PM
Quote from: winrules on April 30, 2006, 01:07:27 PM
all you need to find is the code in display.template.php. You need to enable fields from the admin center for it to do anything.

Both already done. Unfortunately no results.
do they show up in the forum profile information?


winrules
SMF Developer
               
My Mods
Please do not PM me for support.


Advertisement: