News:

SMF 2.1.2 has been released! Take it for a spin! Read more.

Main Menu

Add text beside standard profile field

Started by Tonyvic, January 02, 2014, 06:17:57 AM

Previous topic - Next topic

Tonyvic

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.

kat

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',

Tonyvic

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.

kat

So, where did you want this, profile-wise?

Tonyvic

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.

kat

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. :)

Tonyvic

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

kat

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! :)

Advertisement: