Latest News:
Latest Mods: Latest Tutorials:


 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
any way to hide required custom profile fields in Mod Cp
Author Message
b.h.
Proud Paid Member


Posts: 61
Joined: Aug 2009
Reputation: 0
Post: #1
any way to hide required custom profile fields in Mod Cp
I have some custom profile fields I don't wwant my mods to be able to edit and some I do.

The required custom profile fields are the ones I don't want edited.

I know in the modcp_editprofile template

{$requiredfields}

is what I need to remove. But If I remove it completely and my mod edits the profile in the mod cp, it saves all my required custom profile fields as empty.Thus erasing all the data.

Is there any way to hide {$requiredfields} in the template or make them inactive, so the data won't be erased?
03-24-2011, 11:04 AM


Nickman
Manager



Posts: 2,617
Joined: May 2008
Reputation: 61
Post: #2
RE: any way to hide required custom profile fields in Mod Cp
Instead of removing them, you could make them hidden fields. That way their value is still passed on, but they aren't visible to moderators.


DailyMix
03-24-2011, 11:45 AM
b.h.
Proud Paid Member


Posts: 61
Joined: Aug 2009
Reputation: 0
Post: #3
RE: any way to hide required custom profile fields in Mod Cp
(03-24-2011 11:45 AM)Nickman Wrote:  Instead of removing them, you could make them hidden fields. That way their value is still passed on, but they aren't visible to moderators.

Yes, I've been looking for how to do that,

Code to do that?( if I set them to hidden in the ACP) mods can still see them when they goto edit the User in the mod cp
(This post was last modified: 03-24-2011, 12:07 PM by b.h.)
03-24-2011, 12:00 PM
Nickman
Manager



Posts: 2,617
Joined: May 2008
Reputation: 61
Post: #4
RE: any way to hide required custom profile fields in Mod Cp
actually, you'd probably need a plugin since I believe those fields are generated by code.


DailyMix
03-24-2011, 12:21 PM
b.h.
Proud Paid Member


Posts: 61
Joined: Aug 2009
Reputation: 0
Post: #5
RE: any way to hide required custom profile fields in Mod Cp
(03-24-2011 12:21 PM)Nickman Wrote:  actually, you'd probably need a plugin since I believe those fields are generated by code.

You weren't kidding when you said it is generated by code: lol

from modcp.php:

PHP Code:
$code .= "<input type=\"checkbox\" class=\"checkbox\" name=\"profile_fields[$field][]\" value=\"$val\"$checked /> <span class=\"smalltext\">$val</span><br />"
03-25-2011, 02:56 AM
Nickman
Manager



Posts: 2,617
Joined: May 2008
Reputation: 61
Post: #6
RE: any way to hide required custom profile fields in Mod Cp
You could add something like

Code:
if ($field != 'FIELD_YOU_DON'T_WANT_SHOWN')
{
above all that....
and then below it do
Code:
else{
$code.="<input type='hidden' name='profile_fields[$field][]' value='$val'/>";
}


DailyMix
03-25-2011, 08:14 AM
b.h.
Proud Paid Member


Posts: 61
Joined: Aug 2009
Reputation: 0
Post: #7
RE: any way to hide required custom profile fields in Mod Cp
(03-25-2011 08:14 AM)Nickman Wrote:  You could add something like

Code:
if ($field != 'FIELD_YOU_DON'T_WANT_SHOWN')
{
above all that....
and then below it do
Code:
else{
$code.="<input type='hidden' name='profile_fields[$field][]' value='$val'/>";
}

yes, that would work, but I used another solution. Yours is probably a better long term solution, but I only need required fields hidden so I added a new variable called $code1. Then I Added a display none style. ( had to do this for each input type, radios, text, multiselect..etc)

PHP Code:
$code1 .= "<input type=\"checkbox\" class=\"checkbox\" name=\"profile_fields[$field][]\" style=\"display:none;\" value=\"$val\"$checked/> <br/>"

then I had to remove this:(the input field was hidden but the value still showed)

PHP Code:
<span class="smalltext\">$val</span> 


Fortunately for me the required fields $code is called from the
usercp_profile_customfield template.

So I just duplicated that template and renamed it: usercp_profile_customfield1
changed $code to $code1

and it worked

PHP Code:
if($profilefield['required'] == 1)
        {
            eval(
"\$requiredfields .= \"".$templates->get("usercp_profile_customfield1")."\";");
        }
        else
        {
            eval(
"\$customfields .= \"".$templates->get("usercp_profile_customfield")."\";");
        } 


Not exactly the clean programmers guide to doing it right. But when it comes to php, I'm pretty much on a hack level: just trying to get it done.

It should hold me till you get that pluggin made

To be honest, I'm surprised people haven't requested this before. There are some fields that Mods should just not be allowed to edit. I've got addresses and phone numbers on this one board, And a disgruntled mod could cause havoc. (Not that those would ever exist )
(This post was last modified: 03-25-2011, 10:10 PM by b.h.)
03-25-2011, 10:07 PM
 




User(s) browsing this thread: 2 Guest(s)