Jump to content


- - - - -

RESOLVED: How to add a custom field in ...


  • Please log in to reply
14 replies to this topic

#1 Tom

Tom

    Posting God

  • IM Supporters
  • PipPipPipPipPipPipPipPipPip
  • 1,541 posts
  • IPB Version:v2.3.x

Posted 07 October 2008 - 08:06 AM

HI all,

is there a chance to add one or more custom fields to the ACP > Member [Tab] General Settings?

Currently we have the opportunity to store the following basic details.

  • Registration IP Address
  • Email Address
  • Post Count
  • Remove Member's Photo
  • Remove Member's Avatar
  • Warn Level
  • Member Title


My question is, how could  i a field for additional notes (or just a simple textfield) to store individual information about a certain user?

Thanks in advance
Tom

#2 Michael

Michael

    See code 431.322.12 of the Internet Privacy Act

  • Modders
  • PipPipPipPipPipPipPipPipPipPip
  • 22,042 posts
  • Location:Columbus, OH
  • Real Name:Michael McCune
  • IPB Version:v3.1.x
Contributor

Posted 07 October 2008 - 10:44 AM

Will a custom profile field not work for you?  It would certainly be the easiest option.
Michael McCune - IPS Marketplace Moderator

My Stuff: My Forum · My Resources · My Tutorials
Contact Me: Email · Facebook · Twitter

#3 RichardC

RichardC

    ^^ They think you are odd

  • IM Supporters
  • PipPipPipPipPipPipPipPip
  • 1,028 posts
  • Location:United Kingdom
  • Real Name:Richard
  • IPB Version:v2.3.x
Contributor

Posted 07 October 2008 - 10:54 AM

as Michael says, try using custom fields.

create a custom field, make it only viewable by admin, admin + member, or all, depending on what information you are recording, then go to
ACP > manage members > *select by member name, etc*
then from the drop down box, select 'edit members profile'
and all the info you set up in the custom fields section is displayed and editable under the 'custom fields' tab

it is also editable from the forum side, view the members list, select a member, click on view members profile and from the options list, select edit member ;)

#4 AmgedOsman

AmgedOsman

    aka Sacred

  • IM Supporters
  • PipPipPipPipPipPipPipPipPip
  • 2,027 posts
  • Location:Egypt - Cairo
  • Real Name:amGed
  • IPB Version:v3.3.x
Contributor

Posted 07 October 2008 - 11:21 AM

yes u can

1st you will need to create a  field in data base tables
For example here ill use ibf_members as the table

I'll Call the data base field "tom_x"

Then u need to edit 2 files

Open skin_acp/IPB2_Standard/acp_skin_html/cp_skin_member.php

Find :

<tr>
							<td width='40%' class='tablerow1'><strong>Post Count</strong></td>
							<td width='60%' class='tablerow2'>{$form['posts']}</td>
						  </tr>

Add after:

<tr>
														<td width='40%' class='tablerow1'><strong>BLAHHHHHHHHHHHHHHHH</strong></td>
							<td width='60%' class='tablerow2'>{$form['tom_x']}</td>
						  </tr>


Open sources\action_admin\member.php

Find:
$form['member_title']   = $this->ipsclass->adskin->form_input( "title"	 , $mem['title']);

add after:
#-SRD23- Example
		$form['tom_x']   = $this->ipsclass->adskin->form_input( "tom_x"	 , $mem['tom_x']);

note form_input = text input, u can change it to form_yes_no if u need a yes or no buttons

then find:
'mgroup_others'	  => $_POST['mgroup_others'] ? ','.implode( ",", $_POST['mgroup_others'] ).',' : '',


Add after:
#SRD Example
'tom_x'		 => $this->ipsclass->input['tom_x'],

Edited by sacRED, 07 October 2008 - 11:23 AM.

Facebook Senior Account Manager (MENA Region)
MSN Senior Account Manager (MENA Region)

Posted Image
@amgedosman | AmgedOsman.com

#5 Michael

Michael

    See code 431.322.12 of the Internet Privacy Act

  • Modders
  • PipPipPipPipPipPipPipPipPipPip
  • 22,042 posts
  • Location:Columbus, OH
  • Real Name:Michael McCune
  • IPB Version:v3.1.x
Contributor

Posted 07 October 2008 - 12:24 PM

^ That's why a custom profile field would be the easiest solution. ;)
Michael McCune - IPS Marketplace Moderator

My Stuff: My Forum · My Resources · My Tutorials
Contact Me: Email · Facebook · Twitter

#6 Tom

Tom

    Posting God

  • IM Supporters
  • PipPipPipPipPipPipPipPipPip
  • 1,541 posts
  • IPB Version:v2.3.x

Posted 07 October 2008 - 01:10 PM

Hello Michael, Hi RichardC, hi sacRED

thank you all for your feedback.

I know about the easy solution, using the custom profile field and make it only visible for admins and SuperMods.
The only thing which I dont like is that it is listed on the profile page. Maybe it is stupid but I'd prefer to use sacRED's proposal.

#7 Michael

Michael

    See code 431.322.12 of the Internet Privacy Act

  • Modders
  • PipPipPipPipPipPipPipPipPipPip
  • 22,042 posts
  • Location:Columbus, OH
  • Real Name:Michael McCune
  • IPB Version:v3.1.x
Contributor

Posted 07 October 2008 - 01:25 PM

No worries, if you don't mind doing the edits, then by all means use that solution. ;)
Michael McCune - IPS Marketplace Moderator

My Stuff: My Forum · My Resources · My Tutorials
Contact Me: Email · Facebook · Twitter

#8 Tom

Tom

    Posting God

  • IM Supporters
  • PipPipPipPipPipPipPipPipPip
  • 1,541 posts
  • IPB Version:v2.3.x

Posted 07 October 2008 - 01:31 PM

Thank you Michael, I will definitly give it a try but I appreciate your recommendation too.


One question concerning adding new fields in the database.
I guess there exist an easy way by using an SQL statement. Would someone of the skilled developer be so kind and share the proper code with me?
That would be great.

Thanks in advance

#9 Michael

Michael

    See code 431.322.12 of the Internet Privacy Act

  • Modders
  • PipPipPipPipPipPipPipPipPipPip
  • 22,042 posts
  • Location:Columbus, OH
  • Real Name:Michael McCune
  • IPB Version:v3.1.x
Contributor

Posted 07 October 2008 - 01:34 PM

What kind of data is going to be stored in this field?  If it's a number, how big of a number?  Positive only, or can it be negative?  Will it have decimal places?  If it's text, how big of a maximum size?  Over 255 characters?
Michael McCune - IPS Marketplace Moderator

My Stuff: My Forum · My Resources · My Tutorials
Contact Me: Email · Facebook · Twitter

#10 Tom

Tom

    Posting God

  • IM Supporters
  • PipPipPipPipPipPipPipPipPip
  • 1,541 posts
  • IPB Version:v2.3.x

Posted 07 October 2008 - 01:44 PM

View PostMichael, on Oct 7 2008, 09:34 AM, said:

What kind of data is going to be stored in this field?  If it's a number, how big of a number?  Positive only, or can it be negative?  Will it have decimal places?  If it's text, how big of a maximum size?  Over 255 characters?

oops, a lot of questions - good that I've ask for assistance  ;)

Michael, it should be a textfield where i could store different notes/ informations.
Nice would be a field like the ACP Notes under <Communication> in  <ACP Home> assigned to a certain user. It should have the same capability/ Specs.

#11 Michael

Michael

    See code 431.322.12 of the Internet Privacy Act

  • Modders
  • PipPipPipPipPipPipPipPipPipPip
  • 22,042 posts
  • Location:Columbus, OH
  • Real Name:Michael McCune
  • IPB Version:v3.1.x
Contributor

Posted 07 October 2008 - 01:56 PM

ALTER TABLE `ibf_members` ADD `field_name` TEXT NULL ;
Just change the field_name part to the name of this field.
Michael McCune - IPS Marketplace Moderator

My Stuff: My Forum · My Resources · My Tutorials
Contact Me: Email · Facebook · Twitter

#12 Tom

Tom

    Posting God

  • IM Supporters
  • PipPipPipPipPipPipPipPipPip
  • 1,541 posts
  • IPB Version:v2.3.x

Posted 07 October 2008 - 02:25 PM

Great! Will give it a try and keep you updated about the progress.

#13 Tom

Tom

    Posting God

  • IM Supporters
  • PipPipPipPipPipPipPipPipPip
  • 1,541 posts
  • IPB Version:v2.3.x

Posted 07 October 2008 - 02:55 PM

Works like a charm. You guys rock!

Thank you all for your help!!!!

#14 riven3d

riven3d

    Needs to get out more

  • Support Staff
  • PipPipPipPipPipPipPipPipPipPip
  • 3,908 posts
  • Location:Florida
  • Real Name:Michael
  • IPB Version:v3.1.x
Contributor

Posted 07 October 2008 - 03:06 PM

The issue this topic was opened for has now been resolved. ;)

Did you find my support helpful? Feel free to donate!
Posted Image


#15 Tom

Tom

    Posting God

  • IM Supporters
  • PipPipPipPipPipPipPipPipPip
  • 1,541 posts
  • IPB Version:v2.3.x

Posted 22 June 2010 - 06:52 PM

View PostsacRED, on Oct 7 2008, 07:21 AM, said:

yes u can

1st you will need to create a  field in data base tables
For example here ill use ibf_members as the table

I'll Call the data base field "tom_x"

Then u need to edit 2 files

Open skin_acp/IPB2_Standard/acp_skin_html/cp_skin_member.php

Find :

<tr>
							<td width='40%' class='tablerow1'><strong>Post Count</strong></td>
							<td width='60%' class='tablerow2'>{$form['posts']}</td>
						  </tr>

Add after:

<tr>
														<td width='40%' class='tablerow1'><strong>BLAHHHHHHHHHHHHHHHH</strong></td>
							<td width='60%' class='tablerow2'>{$form['tom_x']}</td>
						  </tr>


Open sources\action_admin\member.php

Find:
$form['member_title']   = $this->ipsclass->adskin->form_input( "title"	 , $mem['title']);

add after:
#-SRD23- Example
		$form['tom_x']   = $this->ipsclass->adskin->form_input( "tom_x"	 , $mem['tom_x']);

note form_input = text input, u can change it to form_yes_no if u need a yes or no buttons

then find:
'mgroup_others'	  => $_POST['mgroup_others'] ? ','.implode( ",", $_POST['mgroup_others'] ).',' : '',


Add after:
#SRD Example
'tom_x'		 => $this->ipsclass->input['tom_x'],


Hello Guys,

can you give me some advise how i can achieve that my custome fields are appearing in my new 3.1.1 forum under the member profile tab?


Any help would be appreciated.
Thanks in advance




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users