Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
general-topic
custom profile fields
Avatar
JINCUI HAO
Member
Free Members
sp_UserOfflineSmall Offline
Jan 2, 2015 - 7:07 am

I'm trying to add custom profile fields, however i'm confused, in the help pop up it says 

"Please note, that on this panel, you are only creating the custom field. After creating the custom field, you will need to decide where you want it to display when a profile is viewed by another user.
You will need to use one of the special template tag functions provided with the plugin in you SP theme where you want it to display. See the Simple:Press Codex for details of the plugin and it's available tags."

when I go to "simple press codex" to find out about how to locate and use the "special template tag functions" the page is empty.

can you walk me through as to where I find this plugin in my SP theme and how to add the custom profile fields so that the info is displayed on the members main profile page ?

Thanks

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Jan 2, 2015 - 8:10 am

This is the page you should be looking at... 

https://simple-press.com/docum.....le-fields/

andy-signature.png
YELLOW
SWORDFISH
Avatar
JINCUI HAO
Member
Free Members
sp_UserOfflineSmall Offline
Jan 2, 2015 - 1:28 pm

Thank that was very useful, I will try and do it.

 

heres my draft, can you check it please

'profileAvatarRank');

                                               sp_SectionStart('tagClass=spPlainSection spCenter', '');

                                                        sp_UserAvatar('context=user&link=', $spProfileUser);

                                                        sp_UserForumRank($args='', $spProfileUser->rank);

                                                        sp_UserSpecialRank($args='', $spProfileUser->special_rank);

                        sp_CustomProfileFieldsDisplay($Country, $spPostUser->ID);

                        sp_CustomProfileFieldsDisplay($Gender, $spPostUser->ID);

                                               sp_SectionEnd();

                                     sp_ColumnEnd('', 'profileAvatarRank');

 

                                     # show profile info

                                     sp_ColumnStart('tagClass=spProfileShowInfoSection spRight&width=65%', 'profileInfo');

                                               sp_ProfileShowDisplayName('', __sp('Username'));

                                               sp_ProfileShowFirstName('', __sp('First Name'));

                                               sp_ProfileShowLastName('', __sp('Last Name'));

                                               sp_ProfileShowLocation('', __sp('Location'));

                                               sp_ProfileShowWebsite('', __sp('Website'));

                    sp_CustomProfileFieldsDisplay($Orientation, $spProfileUser->ID);

                    sp_CustomProfileFieldsDisplay($Looking For, $spProfileUser->ID);

                    sp_CustomProfileFieldsDisplay($Preference, $spProfileUser->ID);

                                               sp_ProfileShowBio('', __sp('Bio'));

                                     sp_ColumnEnd('', 'profileInfo');

                            sp_SectionEnd('tagClass=spClear', 'profileBasic');

 

                            # output section for detailed user info

                            sp_SectionStart('tagClass=spProfileShowDetailsSection', 'profileDetails');

                                     # show user identities

                                     sp_ColumnStart('tagClass=spProfileShowIdentitiesSection spLeft&width=45%',

 

Two other questions, if I wanted to display a icon, for example their gender ,country under their avatar and forum rank on forum posts how do I link that icon to the selection they made from the dropdowns/menus ?

Where do I put these icons, as user groups ?

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Jan 2, 2015 - 5:48 pm

sorry, what are:  $country, $gender, $orientation, $lookingfor and $preference??

are those variables you have defined somewhere?

per the codex Andy linked to, you want the name of the custom profile field... so perhaps you meant:

sp_CustomProfileFieldsDisplay('Country', $spProfileUser->ID);

for example...  assuming the custom profile field you created was named Country...  if you filled $Country somewhere with that string, it would be fine...

currently, the custom profile fields doesn't support images (though we had one other request for such and have a ticket for future consideration)... so you would have to add the coding logic yourself for images...

Avatar
JINCUI HAO
Member
Free Members
sp_UserOfflineSmall Offline
Jan 2, 2015 - 6:00 pm

yes they are variables from the dropdowns in the custom profile fields, all I did was copy what is posted here 

 

Displaying Custom Profiles
You would use the sp_CustomProfileFieldsDisplay($name, $userid=0) template tag in your Simple:Press theme where you want it to display.

Pass the name of the custom field as the first argument and the userid of the user whose profile is being displayed as the second argument.

Using the Video game example above to display the video game owned next to the member’s name/avatar in every one of his forum posts you would use the following in the spTopicView.php file by the Avatar display.

1
sp_CustomProfileFieldsDisplay(

'Game Type'

,

$spPostUser
->ID);

Depending on who and where you are showing the custom field you would get the userid in various ways.

An  example of showing a custom field for a user under his avatar would be

1
sp_CustomProfileFieldsDisplay(

$name

,

$spPostUser
->ID);

If you wanted to show the Custom profile display to the current logged in user then

1
sp_CustomProfileFieldsDisplay(

$name

,

$spTheUser
->ID);

To show the Custom profile display of a user in their profile pages you could use.

1
sp_CustomProfileFieldsDisplay(

$name

,

$spProfileUser
->ID);

but replaced $name with  for $country as your instructs to do.

 

 

 

 

 

 

 

 

 

 

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Jan 2, 2015 - 6:05 pm

No, there are multiple examples there for different situations... you would pick the example most germane to your situation...

the first argument to sp_CustomProfileFieldsDisplay() MUST be the name of the custom profile field...

if you created a variable with that in it (like later examples) in the same area as the use of the template function or used a global variable name, then fine...   but the contents of a dropdown are not a variable and the custom profile field plugin variables are not in scope where you attempting to use the template arguments...

hence why I think you want the first example...  put the name of the custom profile fields (only you know the name as you named it on the admin panel when you created it) as the first argument...

sp_CustomProfileFieldsDisplay(‘Country’, $spProfileUser->ID);

and so forth for your other custom fields you created...

Avatar
JINCUI HAO
Member
Free Members
sp_UserOfflineSmall Offline
Jan 2, 2015 - 6:16 pm

to put on profile page (not under avatar on posts) it says to do it like this 

sp_CustomProfileFieldsDisplay($name, $spProfileUser->ID);

 

so i dont see what i did wrong

sp_CustomProfileFieldsDisplay($Orientation, $spProfileUser->ID);

                    sp_CustomProfileFieldsDisplay($Looking For, $spProfileUser->ID);

                    sp_CustomProfileFieldsDisplay($Preference, $spProfileUser->ID);

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Jan 2, 2015 - 6:21 pm

you are using variables that dont exist, unless you defined them...  you CANNOT use what you think are variables from the pluign - they are not in scope in the profile template file you are trying to use them in...  and by the way '$Looking For' would be an invalid variable name anyways - cannot have spaces in variable names...

you seem to be mixing up php variables and the actual name of the field that you created... look on the forum - profiles - custom profile fields admin panel.. you will see the profile fields you created and the name you gave them (one of the columns)...

sorry, not sure how to be more clear...  assuming you named the profile field 'Country', you want:

sp_CustomProfileFieldsDisplay(‘Country’, $spProfileUser->ID);

for the others, replace Country with the other names of the profile fields you created...  at least for the profile...

Avatar
JINCUI HAO
Member
Free Members
sp_UserOfflineSmall Offline
Jan 2, 2015 - 6:34 pm

Mr Papa said
sorry, what are:  $country, $gender, $orientation, $lookingfor and $preference??

are those variables you have defined somewhere?

per the codex Andy linked to, you want the name of the custom profile field... so perhaps you meant:

sp_CustomProfileFieldsDisplay('Country', $spProfileUser->ID);

for example...  assuming the custom profile field you created was named Country...  if you filled $Country somewhere with that string, it would be fine...

currently, the custom profile fields doesn't support images (though we had one other request for such and have a ticket for future consideration)... so you would have to add the coding logic yourself for images...

sorry i misunderstood you, they are not variables , they are custom profile fields, they have dropdowns (which I assume is what you mean by variables within each, the member selects their gender, country, etc, from the selects, or lists and thats what is displayed to other members..

 

I assumed that as the custom field has variables within it you have to put the $ in otherwise it will not recognize anything but Afghanistan, the first on the list.

 

Are you saying that i have to put a $ before every 248 country in the dropdown value list in any/all custom field select list ?/

no $orietation,$gender,are are not saved anywhere, Gender,Orientation,country,preference are though as custom fields in the custom profile fields., each has "selects or  lists" within them.

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Jan 2, 2015 - 7:21 pm

no... ignore the values in the dropdown - they are unimportant for display which a user has selected..

did you look at the admin page I reference?  do you see a Name column for each custom profile field you specified?  you only need the tag once with that Name as the first argument..

sp_CustomProfileFieldsDisplay(‘Country’, $spProfileUser->ID);

IF you custom profile field name for the country field is 'Country'...

Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 650
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 619
Members: 17361
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10127
Posts: 79625