miniBB ® 

miniBB

®
Support Forums
  
 | Start | Register | Search | Statistics | File Bank | Manual |
Custom Tutorials and Modifications miniBB Support Forums / Custom Tutorials and Modifications /  
 

How to make a field on the Profile form uneditable?

 
Author cycjtty
Partaker
#1 | Posted: 20 Mar 2016 18:20 
I hope to make occupation area uneditable after registration (like username area),but i cann't find the right way,could you tell me how to do it..

Author Paul
Lead Developer 
#2 | Posted: 21 Mar 2016 12:50 
So, would you like to completely remove this field, or allow it at the registration level, and disallow at the profile editing level?

If you just don't need this field, you could make it a hidden type... If you'd like to make it read-only at the profile editing, modify templates/user_dataform.html and paste the following tag:

{$editable}

in the code which holds the "occupation" value, resp.:

<input type="text" name="occupation" maxlength="100" size="20" value="{$occupation}" {$editable} class="textForm" style="width:200px;" />

Author cycjtty
Partaker
#3 | Posted: 21 Mar 2016 14:21 
Glad to receive your reply.After i addd this tag,i find it cann't be edited in html form,but when i submit form,this content is cleared in database,do i need to change bb_func_editprf.php or other php file..?

Author Paul
Lead Developer 
#4 | Posted: 21 Mar 2016 14:44 
Ok then... In addition to the above code, try to paste the code below into bb_plugins_user.php and let me know the results. Tried it on my end and it all worked.

if($action=='editprefs'){
$moDBValue[$dbUserSheme['user_occ'][1]]=$userData[$dbUserSheme['user_occ'][0]];
${$dbUserSheme['user_occ'][2]}=$userData[$dbUserSheme['user_occ'][0]];
}

Author cycjtty
Partaker
#5 | Posted: 21 Mar 2016 15:50 
It works all right now^^,thanks a lot!!and i have changed occupation field to select type,if i'm going to check data user submit to make sure its value is ok,which code should i modify?

Author Paul
Lead Developer 
#6 | Posted: 21 Mar 2016 16:15 
cycjtty:
if i'm going to check data user submit to make sure its value is ok,which code should i modify?
Not quite sure what do you mean, but it all could be done at the add-on's level. You may verify the posted data in bb_plugins.php on the condition like

if($action=='editprefs'){
....
}
and then you could supply a default value for the $_POST['occupation'] there, if someone is trying to post a fake/wrong value and so on.

I.e. in this bb_plugins.php you could catch the incoming parameters, verify, parse and re-assign them, before the core script executes.

Author cycjtty
Partaker
#7 | Posted: 21 Mar 2016 16:49 
Thanks for your help,i think i understand a little more now,i will pay more time on this module,it's very flexible and useful.

Custom Tutorials and Modifications miniBB Support Forums / Custom Tutorials and Modifications /
 How to make a field on the Profile form uneditable?
 Share Topic's Link

Your Reply Click this icon to move up to the quoted message


  ?
Post as a Guest, leaving the Password field blank. You could also enter a Guest name, if it's not taken by a member yet. Sign-in and post at once, or just sign-in, bypassing the message's text.


Before posting, make sure your message is compliant with forum rules; otherwise it could be locked or removed with no explanation.

 

 
miniBB Support Forums Powered by Forum Software miniBB ® Home  Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contact Us
Get the Captcha add-on: protect your miniBB-forums from the automated spam and flood.


  ⇑