Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: Tonyvic on January 02, 2014, 06:17:57 AM

Title: Add text beside standard profile field
Post by: Tonyvic on January 02, 2014, 06:17:57 AM
Hi guys,
SMF 2.0.6 and I want to add a line of text beside the standard profile 'Location' on the registration page & members profile.
I realise it can be done with custom profile fields, but the site is 6 years old so don't really want to change the current setup.

Any advice will be much appreciated.
Title: Re: Add text beside standard profile field
Post by: kat on January 02, 2014, 07:50:35 AM
Profile.template.php in the default theme's directory.

if (!isset($context['disabled_fields']['location']) && !empty($context['member']['location']))
echo '
<dt>', $txt['location'], ':</dt>
<dd>', $context['member']['location'], '</dd>';

echo '
</dl>';


Where you see:

<dt>', $txt['location'], ':</dt>

you can add text, such as this:

<dt>', $txt['location'],' a line of text', ':</dt>

When you say that you want to do this on the registration page, one would assume you mean the page where members fill their location in. Is that right?

If so, you can try something similar with register.php, in the Sources directory.

(I haven't checked this one. It could well be VERY wrong. So, keep a copy of the  file, as a backup)

Where you see:

      'location', 'birthdate',

try:

      'location', 'a line of text', 'birthdate',
Title: Re: Add text beside standard profile field
Post by: Tonyvic on January 02, 2014, 10:34:55 AM
Many thanks for the suggestions K@, unfortunately the Profile Template change only appears on a members profile & Register php change doesn't appear to do anything.
QuoteWhen you say that you want to do this on the registration page, one would assume you mean the page where members fill their location in. Is that right?
I should have said 'Registration Form' (See attached) when members join, so yes where they fill in 'Location'. It would be a bonus if the same added text could appear next to 'Location' in 'Modify Profile as well, but not essential.
Title: Re: Add text beside standard profile field
Post by: kat on January 02, 2014, 11:24:21 AM
So, where did you want this, profile-wise?
Title: Re: Add text beside standard profile field
Post by: Tonyvic on January 02, 2014, 01:26:36 PM
As stated, I'm not too bothered if it doesn't show in users profile. I would really like it on the 'Registration Form' which is completed when someone applies for membership. (see attachment in my original post).
It is a 'Standard Profile' field with 'Show on registration selected. See attached to this post.
Title: Re: Add text beside standard profile field
Post by: kat on January 02, 2014, 02:02:13 PM
Right. This is pure, unadulterated guesswork, this.

With that thing that I gave you, for the registration form, try replacing:

'location', 'birthdate',

with   'location', 'mytext', 'birthdate',

Then, open index.english.php, in the default theme's "languages" directory.

Change this:

$txt['location'] = 'Location';

To this:

$txt['location'] = 'Location';
$txt['mytext'] = 'changethis';

Altering "changethis", to contain the text that you want. I doubt you could use too much text, without it looking extremely weird.

As I said, this is pure guesswork. So, keep a copy of both files, before editing them, as backups. :)
Title: Re: Add text beside standard profile field
Post by: Tonyvic on January 03, 2014, 07:51:48 AM
K@
I'm afraid your "pure, unadulterated guesswork" didn't work.
But thanks to you aiming me towards 'index.english.php' I found a solution, although not exactly what I wanted it is fine & solves the problem.

I changed $txt['location'] = 'Location'; to $txt['location'] = 'Your nearest Town or City and Country';

Many thanks,
Tony
Title: Re: Add text beside standard profile field
Post by: kat on January 03, 2014, 08:10:39 AM
Funnily enough, I was gonna suggest that, first thing. But, knowing that that would affect "Location", wherever it occurred, made me think that that was, probably, not the best way to go.

But, if it does what you want, all's good! :)