Total Users Online: 0 üye, 356 guest | Tarih/Saat: 2026-04-30 20:49
 
Additional user fields
#933
2009-12-28 11:43 GMT  oklu Alnt
Kaan

User is: Online status   Gender_M
Posts: 2772
Ülke: İstanbul - 34
Meslek: Serbest Meslek
Age: 43

Additional user fields
Add up to 9 extra columns in the user profile.

By default Seditio, can handle 9 optional fields of datas for each and every user.

The type of datas are :

Slot #1 : String, maximum 255 chars.
Slot #2 : String, maximum 255 chars.
Slot #3 : String, maximum 255 chars.
Slot #4 : String, maximum 255 chars.
Slot #5 : String, maximum 255 chars.
Slot #6 : Selectbox.
Slot #7 : Selectbox.
Slot #8 : Selectbox.
Slot #9 : Text area, maximum 65535 chars.

Those slots can be left under the control of the users (in their profile), or locked for administrators use only.

Let's go with a sample that should cover most of the possible uses, we'll add 4 different fields :

- A string slot where the user can set his real name.
- A string slot for a sub-title in forums, controled by administrators.
- A selectbox where the user can set a prefered occupation.
- A textarea where the user can store his biography.


1 : Configuration of the slots in the admin panel

Open the administration panel, tab "Configuration", then "Custom fields in user profile", then set the slots as follow :

Field #1 (String), title : Real name
Maximum characters in this field : 64
Editable in user profile ? : Yes

Field #2 (String), title : Sub-title
Maximum characters in this field : 255
Editable in user profile ? : No

Field #6 (Select box), title : Prefered occupation
Values for the select box, comma separated : Sport,TV,Doing nothing,Other
Editable in user profile ? : Yes

Field #9 (Long text), title : Biography
Maximum length for the text : : 32000
Editable in user profile ? : Yes

And save the change ("Update" button).


2 : Then we add the tags in the skin files...

First, we must add the tags in users.profile.tpl, but only for the slots the user is allowed to change. So we'll skip the slot #2.

Add :
Kod:
<tr>
<td>{USERS_PROFILE_EXTRA1_TITLE} :</td>
<td>{USERSPROFILE_EXTRA1}</td>
</tr>

<tr>
<td>{USERS_PROFILE_EXTRA6_TITLE} :</td>
<td>{USERS_PROFILE_EXTRA6}</td>
</tr>

<tr>
<td>{USERS_PROFILE_EXTRA9_TITLE} :</td>
<td>{USERS_PROFILE_EXTRA9}</td>
</tr>


The layout may be a bit different, depending of your skin.
Notice that there's no tags for the EXTRA2 slot, because we don't want the users to be able to change the sub-title field by themselves.


Now in users.details.tpl, we add the tags so the datas are viewable in the user details :

Kod:
<tr>
<td>{USERS_DETAILS_EXTRA1_TITLE} :</td>
<td>{USERS_DETAILS_EXTRA1}</td>
</tr>

<tr>
<td>{USERS_DETAILS_EXTRA2_TITLE} :</td>
<td>{USERS_DETAILS_EXTRA2}</td>
</tr>

<tr>
<td>{USERS_DETAILS_EXTRA6_TITLE} :</td>
<td>{USERS_DETAILS_EXTRA6}</td>
</tr>

<tr>
<td>{USERS_DETAILS_EXTRA9_TITLE} :</td>
<td>{USERS_DETAILS_EXTRA9}</td>
</tr>



And now in users.edit.tpl, so the administrators can edit in case of troubles with the 3 slots controlled by the user, or to set the sub-title :
Kod:
<tr>
<td>{USERS_EDIT_FORM_EXTRA1_TITLE} :</td>
<td>{USERS_EDIT_FORM_EXTRA1}</td>
</tr>

<tr>
<td>{USERS_EDIT_FORM_EXTRA2_TITLE} :</td>
<td>{USERS_EDIT_FORM_EXTRA2}</td>
</tr>

<tr>
<td>{USERS_EDIT_FORM_EXTRA6_TITLE} :</td>
<td>{USERS_EDIT_FORM_EXTRA6}</td>
</tr>

<tr>
<td>{USERS_EDIT_FORM_EXTRA9_TITLE} :</td>
<td>{USERS_EDIT_FORM_EXTRA9}</td>
</tr>



The last step is to add the tag for the sub-title in forums.posts.tpl :
Spot the existing tag {FORUMS_POSTS_ROW_POSTERNAME}, and near, add the tag {FORUMS_POSTS_ROW_USEREXTRA2}.

It's all done !
Konuyla İlgili Diğer Başlıklar
User Auth Güvenlik Kodu Uygulaması
User Shop
user watchdog eklentisi
user acount eklentisi
Twitter Plugin User ve Admin Kontrol
Emlak, Oto Galeri, Rent A Car, ?iir, Edebiyat Script Sipari?lerinizi Verebilirsiniz.
Detaylar ??in: kaan@ntka.org

Seditio 170 ?ndir
Capte M?zik ?ndir
Seditio Toolbar ?ndir

 

Powered by Seditio © 2009-2012 All Rights Reserved