News:

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

Main Menu

How to make explanatory text on the registration page?

Started by User2, July 04, 2021, 04:11:30 AM

Previous topic - Next topic

User2

Hello, how do I make an explanatory text on the registration page?
How do I make an explanatory text for the User name item? I want visitors to assign the specified names, not any.

Aleksi "Lex" Kilpinen

I think the best way would be to define your additional help text first, by creating a custom text string in modifications.english.php (and any other languages you use),
then edit /Themes/Default/Register.template.php to echo that text string within the form itself.
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

User2

I'm just a user, I'm not a web programmer. I do not know where and what changes to make.

Aleksi "Lex" Kilpinen

Well, a custom text string is easy, would be something like this and you can just add it to the modifications.*.php files



$txt['register_customhelptext'] = 'This here is the text that will be shown';



Then an echo inside a template would look something like this



echo '<p>', $txt['register_customhelptext'], '</p>';


But these are just an example - currently I don't have 2.0 code at hand, so I can't give you an exact solution. If you wait a bit, I'm sure someone else can. :)
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

Sir Osis of Liver

You can just add text to the username field label.

index.yourlanguage.php



$txt['username'] = 'Username - blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah';



Text will wrap in the available space.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Kindred

No. bad idea. Don't do that

Add a NEW text field, do not modify the existing ones
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Sir Osis of Liver

 :P It's not a bad idea, it's simple and works fine as long as it's not too wordy.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

User2

Kindred, how to add a textbox? Is there a MOD for this task?

Illori

Quote from: Sir Osis of Liver on July 05, 2021, 09:41:33 PM
:P It's not a bad idea, it's simple and works fine as long as it's not too wordy.

if that text string is used anywhere else, then it is a bad idea as that string will now show the edit as well.

Quote from: Participant on July 06, 2021, 12:19:27 AM
Kindred, how to add a textbox? Is there a MOD for this task?

a text box to do what exactly?

User2


Kindred

Lex explained how to add the text as a string.
That is the right way to do it.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

User2

Aleksi "Lex" Kilpinen, which files need to be changed? I didn't get it from your post.

Aleksi "Lex" Kilpinen

To create the custom text:
Quote from: Aleksi "Lex" Kilpinen on July 04, 2021, 04:33:03 AM
a custom text string in modifications.english.php (and any other languages you use),
To place it in the register -page, this you may need to experiment with a bit, so keep backups of what you edit.
Quote from: Aleksi "Lex" Kilpinen on July 04, 2021, 04:33:03 AM
then edit /Themes/Default/Register.template.php to echo that text string within the form itself.
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

Sir Osis of Liver

Quote from: Illori on July 06, 2021, 04:41:51 AM
if that text string is used anywhere else, then it is a bad idea as that string will now show the edit as well.

Yes, you're correct, it is used elsewhere.  Still think it would be easier to create new $txt['username_reg'] and replace original in Register.template.php, then you don't have to format a new field into the page.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

User2

Aleksi "Lex" Kilpinen, which folder is this file in: modifications.english.php?

Steve

DO NOT pm me for support!

User2

Steve, where to write this text:?
echo '<p>', $txt['register_customhelptext'], '</p>';

I understand that this needs to be written to the "Register.template.php" file. Where to insert the text?
There are several functions in this file. Need to insert text inside an existing function or what?

Steve

This isn't my area of expertise so I'm going to have to defer to someone who knows coding.
DO NOT pm me for support!

User2

Aleksi "Lex" Kilpinen, where to write this text:?
echo '<p>', $txt['register_customhelptext'], '</p>';

I understand that this needs to be written to the "Register.template.php" file. Where to insert the text?
There are several functions in this file. Need to insert text inside an existing function or what?

Aleksi "Lex" Kilpinen

You can try this.

First add the new text string:

Code (FIND in /Themes/default/languages/Modifications.english.php) Select

?>


Code (ADD IMMEDIATELY BEFORE, as a new line) Select

$txt['register_customhelptext'] = 'This here is the text that will be shown';


Then add the code to show it right below the Username field:

Code (FIND in /Themes/default/Register.template.php) Select

<span id="smf_autov_username_div" style="display: none;">
<a id="smf_autov_username_link" href="#">
<img id="smf_autov_username_img" src="', $settings['images_url'], '/icons/field_check.gif" alt="*" />
</a>


Code (ADD IMMEDIATELY AFTER, as a new line) Select

<p>', $txt['register_customhelptext'], '</p>


Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

Sir Osis of Liver

Quote from: Sir Osis of Liver on July 06, 2021, 04:34:38 PM
Still think it would be easier to create new $txt['username_reg'] and replace original in Register.template.php, then you don't have to format a new field into the page.

   ;)
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Aleksi "Lex" Kilpinen

You are right that it would be slightly easier, and it would probably work just as well, but my example is also a good example of how things work in general, and trying it might even be educational as a byproduct.
Support isn't always about making things easy ;)
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

Sir Osis of Liver

No, but it's sometimes preferable to provide a workable solution that doesn't cause OP to 
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

User2

Sir Osis of Liver, what solution do you suggest? I am not a web programmer, I simply cannot implement your idea. I need detailed instructions: in which file, where in the file, what changes to make.

Aleksi "Lex" Kilpinen

Quote from: Participant on July 09, 2021, 02:52:34 PM
Sir Osis of Liver, what solution do you suggest? I am not a web programmer, I simply cannot implement your idea. I need detailed instructions: in which file, where in the file, what changes to make.

It's not much different than my example really, basically

First add the new text string:

Code (FIND in /Themes/default/languages/Modifications.english.php) Select

?>


Code (ADD IMMEDIATELY BEFORE, as a new line) Select

$txt['register_customhelptext'] = 'This here is the text that will be shown';


Then add the code to show it right instead of "Username":

Code (FIND in /Themes/default/Register.template.php) Select

$txt['username']


Code (REPLACE with) Select

$txt['register_customhelptext']


This will replace the "Username:" part with whatever you want.
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

User2

Aleksi "Lex" Kilpinen, is it difficult to do from above (as in the first post)? To be in front of the user's eyes.

Aleksi "Lex" Kilpinen

Now that I think about it, no. Just as easy as below.


First add the new text string:

Code (FIND in /Themes/default/languages/Modifications.english.php) Select

?>


Code (ADD IMMEDIATELY BEFORE, as a new line) Select

$txt['register_customhelptext'] = 'This here is the text that will be shown';


Then add the code to show it right above the Username field:

Code (FIND in /Themes/default/Register.template.php) Select

<dt><strong><label for="smf_autov_username">', $txt['username'], ':</label></strong></dt>
<dd>


Code (ADD IMMEDIATELY BELOW, as a new line) Select

<p>', $txt['register_customhelptext'], '</p>

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

User2

Aleksi "Lex" Kilpinen, I write Russian text to the file "Modifications.russian-utf8.php" or "Modifications.english.php" and the registration page becomes empty.
That is, the Russian language is not supported.

Aleksi "Lex" Kilpinen

Do the edits work if you don't use cyrillics? Just to rule out some other issues first. What editor are you using to edit the files?
Oh, also you should probably edit Modifications.english-utf8.php if you are using UTF8.
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

User2

#29
Yes, all the solutions you suggested work. I want to use the latter solution when the explanations are above the field.

Aleksi "Lex" Kilpinen

Okay, so the edits work - but changing the text in the language files in to cyrillics breaks something?
What editor are you using the make the changes?
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

User2

Aleksi "Lex" Kilpinen, yes, the problem was created by the program I was using. I used a rare, unknown program "AkelPad", it is very convenient compared to the usual Notepad.
Then I made the changes using regular Notepad and the problem was not with the Cyrillic alphabet.

Aleksi "Lex" Kilpinen

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

User2

I use Notepad++ for some tasks. And for everyday use, I use the program like a regular notepad AkelPad.
There is a lot of excess in Notepad++ and it is a more complex program for normal use.

Aleksi "Lex" Kilpinen

Yes, but for .php files especially it is pretty good - and it allows you to make sure the text is saved in the right encoding and format.
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

User2

Aleksi "Lex" Kilpinen, at first glance, it turned out to do what I wanted. Thank you.

Aleksi "Lex" Kilpinen

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

Advertisement: