Quote:
Today at 11:54 AM Falkware said this in Post #112
I've got this working fine on v2.3.0 using the files attached here and the recent fixes. Thanks all!
However, I have the same problem as danglick. When an Admin goes to edit a user's profile within Admin CP the custom fields are pre-filled with the values of the administrator's custom profile fields, rather than the user's values (or blank in the case of a new record).
Is there any way to stop it from doing this, and show the user's value instead?
|
If you're using my hack for admin/user.php ... there is an error as described above.
In admin/user.php
Find This (The Code from my txt file):
PHP Code:
// new options
maketableheader("Custom Profile Fields");
$profilefields=$DB_site->query("SELECT *
FROM profilefield
WHERE editable = 1
ORDER BY displayorder");
while ($profilefield=$DB_site->fetch_array($profilefields)) {
$profilefieldname="field$profilefield[profilefieldid]";
if ($bgcolor=="{firstaltcolor}") {
$bgcolor="{secondaltcolor}";
} else {
$bgcolor="{firstaltcolor}";
}
// new options
$TheField="";
$optionlines = explode(',', $profilefield[options]);
$option_bit=$optionlines[0];
if ($profilefield[type]==1) {
// radio
while ($option_bit) {
$option_bit=trim($option_bit);
if ($option_bit == $bbuserinfo[$profilefieldname]) { $LocOn = "checked"; } else { $LocOn = ""; }
$TheField .= "<input type=\"radio\" name=\"$profilefieldname\" value=\"$option_bit\" $LocOn> $option_bit ";
$option_bit=next($optionlines);
}
} elseif ($profilefield[type]==2) {
// select
$TheField = "<select size=\"$profilefield[size]\" name=\"$profilefieldname\">";
while ($option_bit) {
$option_bit=trim($option_bit);
if ($option_bit == $bbuserinfo[$profilefieldname]) { $LocOn = "selected"; } else { $LocOn = ""; }
$TheField .= "<option value=\"$option_bit\" $LocOn>$option_bit</option>";
$option_bit=next($optionlines);
}
$TheField .= "</select>";
} elseif ($profilefield[type]==3) {
// textarea
$bbuserinfo[$profilefieldname]=htmlspecialchars($bbuserinfo[$profilefieldname] );
$TheField = "<textarea name=\"$profilefieldname\" rows=\"6\" cols=\"40\" wrap=\"physical\">$bbuserinfo[$profilefieldname]</textarea>";
} else {
$TheField="<input type=\"text\" class=\"bginput\" name=\"$profilefieldname\" value=\"$bbuserinfo[$profilefieldname]\" size=\"$profilefield[size]\" maxlength=\"$profilefield[maxlength]\">";
}
makelabelcode($profilefield[title],$TheField);
}
// new options
Replace it with this:
PHP Code:
// new options
maketableheader("Custom Profile Fields");
$profilefields=$DB_site->query("SELECT *
FROM profilefield
WHERE editable = 1
ORDER BY displayorder");
while ($profilefield=$DB_site->fetch_array($profilefields)) {
$profilefieldname="field$profilefield[profilefieldid]";
if ($bgcolor=="{firstaltcolor}") {
$bgcolor="{secondaltcolor}";
} else {
$bgcolor="{firstaltcolor}";
}
// new options
$TheField="";
$optionlines = explode(',', $profilefield[options]);
$option_bit=$optionlines[0];
if ($profilefield[type]==1) {
// radio
while ($option_bit) {
$option_bit=trim($option_bit);
if ($option_bit == $userfield[$profilefieldname]) { $LocOn = "checked"; } else { $LocOn = ""; }
$TheField .= "<input type=\"radio\" name=\"$profilefieldname\" value=\"$option_bit\" $LocOn> $option_bit ";
$option_bit=next($optionlines);
}
} elseif ($profilefield[type]==2) {
// select
$TheField = "<select size=\"$profilefield[size]\" name=\"$profilefieldname\">";
while ($option_bit) {
$option_bit=trim($option_bit);
if ($option_bit == $userfield[$profilefieldname]) { $LocOn = "selected"; } else { $LocOn = ""; }
$TheField .= "<option value=\"$option_bit\" $LocOn>$option_bit</option>";
$option_bit=next($optionlines);
}
$TheField .= "</select>";
} elseif ($profilefield[type]==3) {
// textarea
$userfield[$profilefieldname]=htmlspecialchars($userfield[$profilefieldname] );
$TheField = "<textarea name=\"$profilefieldname\" rows=\"6\" cols=\"40\" wrap=\"physical\">$userfield[$profilefieldname]</textarea>";
} else {
$TheField="<input type=\"text\" class=\"bginput\" name=\"$profilefieldname\" value=\"$userfield[$profilefieldname]\" size=\"$profilefield[size]\" maxlength=\"$profilefield[maxlength]\">";
}
makelabelcode($profilefield[title],$TheField);
}
// new options
Basically, all the instances of $bbuserinfo have been changed to $userfield which is from the query above this block of code in user.php.
Remember to replace this twice.