Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Is there a way to add a personal text on the registration form ?

It seems like a simple task but I dont see how to do it.
Is there a way to add a personal text on the registration form without modifying the core.

I need text next to email - to need confirm registration email and some text before form start.

Because some users don't see the vanilla message after registration on the corner (or don't have this message for some reason) and ask me permissions to discussions.

Is there template of this form ?

Thanks in advance.

Comments

  • There are several ways some more simple some not so simple.

    The easiest is to add this jquery to the default.master.php or tpl of your theme.

    <script type="text/javascript">
    jQuery(document).ready(function($) {
    $('#Form_User_Register').prepend('Your extra text you want goes here');
    </script>;
    

    If it is a default.master.tpl then you need to add it like this

    {literal}<script type="text/javascript">
    jQuery(document).ready(function($) {
    $('#Form_User_Register').prepend('Your extra text you want goes here');
    </script>;{/literal}
    
  • I thought about that way, but is a bit dirty because javascript must check every page load looking for id - Form_User_Register ...

    Also I thought to change label but I see it used in more places ...

    I would say it is the fault of vanilla structure having no view as template for the form.

  • @steam said:
    I thought about that way, but is a bit dirty because javascript must check every page load looking for id - Form_User_Register ...

    Also I thought to change label but I see it used in more places ...

    I would say it is the fault of vanilla structure having no view as template for the form.

    You can modify the view quite easily.

    1. Copy the view from /applications/dashboard/views/entry to /themes/yourTheme/views/entry
    2. Edit to your heart's content
    3. No step 3.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • steamsteam
    edited May 2015

    ...

    @hgtonight said:
    3. No step 3.

    Perfect! Fixed as said - "hgtonight"

    I think it is a correct solution. I hope this does not affect performance.

    Thanks =)

  • @steam said:
    I thought about that way, but is a bit dirty because javascript must check every page load looking for id - Form_User_Register ...

    And if there is not one, it does nothing... big deal... you wanted fast and easy without saying wether you understood vanilla or php or not... it is not dirty at all it happens to work well..Or you can also make a theme hook to add the script only to that page...

    Also I thought to change label but I see it used in more places ...

    Labe has no specific class in that form but you can use children and ad the content via css too.

    Since so many people come in hear asking for things and I don't know their capacity, and later turn out to only waste the time of people, I tend to give the simplest easiest answers to test what they want to do. Most people never come back because they claim it is too difficult or they don't know what they are doing. There is a plugin for almost everything..

    I would say it is the fault of vanilla structure having no view as template for the form.

    There is a template but it is not editable or rather should not be. I have ran into people with registration issues because they cloned the registration page view which is why I do not recommend that as a first choice of action..

  • steamsteam
    edited May 2015

    "vrijvlinder" I agree with you about the different people and their level of programming knowledge.

    I'm a Java programmer programming by MVC, OOP and I like code well structured ;)

    The javascript solution is fine for people who do not know anything as you say.
    But now think if you have to do several changes in various locations ... how much the unnecessary javascript you are going to write ?

    I opted for "hgtonight" solution because it seems better but it has its downside - after vanilla version update I have to see if vanilla team have not changed register form and compare with mine...
    And I do not like everything...

    Thanks for your interest and your help. =)

  • @steam depending on where you want the message, you could insert your message via a hook. Where on the registration page do you want your message to appear?

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • steamsteam
    edited May 2015

    @hgtonight said:
    steam depending on where you want the message, you could insert your message via a hook. Where on the registration page do you want your message to appear?

    Text may be at the beginning of the form or next to the email label.
    Where it is easier to put it.

  • You can easily insert markup where the triangles are.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • It sound good but how can I insert text over there ? What do you mean with markup ? Can you explain in more detail ? Thanks.

  • Which triangle do you want your markup inserted by?

    I can give you the hook name.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • steamsteam
    edited May 2015

    @hgtonight said:
    Which triangle do you want your markup inserted by?

    I can give you the hook name.

    These three locations please, it depends on how the text will fit.
    For most of the cases would be worth.
    Thanks.

  • I generated this image with the Eventi plugin.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • I would say this is the most correct way to add extra content to the registration page.

  • Ok, now I have to find how to do the hook and in what class to do.

    Something like this on my class.mythemehooks.php override those functions ?

    public function EntryController_BeforeRenderAsset_Handler($sender) {
    and on $sender find Cdns, array of values ? ...

    Is there some API of vanilla core or some guide how it work ?
    Excuse me, I don't know how vanilla works and where I can do this hook.

    Sorry for so many questions.

  • R_JR_J Admin

    Just to get you started:

    <?php defined('APPLICATION') or die();
    
    $PluginInfo['Example'] = array(
      'Name' => 'Example',
      'Description' => 'Example plugin',
      'Version' => '0.1',
      'Author' => 'Your name'
    );
    
    class ExamplePlugin extends Gdn_Plugin {
        public function EntryController_RegisterFormBeforeTerms_Handler($Sender, $Args) {
            echo '<li>TEST!</li>';
        }
    }
    

    Search the source code for the middle part (here: RegisterFormBeforeTerms) and see what is expected. In this case it is right inside a ul tag, so you need to enclose your text in li tags.

  • steamsteam
    edited May 2015

    Ok,

    I have used EntryController_RegisterFormBeforeTerms_Handler to put extra information on my form.

    Many thanks to all and greetings

Sign In or Register to comment.