Login  Register

Re: Edit a members signature

Posted by Pedro on Dec 08, 2014; 5:49pm
URL: https://support.nabble.com/Edit-a-members-signature-tp7592677p7593081.html

It is not possible to set a limit for full lines. I can limit how many time one can press the enter key.
Please, look and override your edit_signature macro:
Use lines 42 and 56 to control the length of your signature.
<override_macro name="edit_signature" requires="servlet">
    <n.visitor.as_user_page.>
        <n.if.not.page_user.is_registered>
            <then>
                <n.login.><t>You must login to view this page.</t></n.login.>
            </then>
        </n.if.not.page_user.is_registered>
        <n.if.is_submitted_form>
            <then>
                <n.catch_exception. id="save-signature">
                    <n.edit_page_user.>
                        <n.set_signature signature="[n.signature_field.value/]" is_html="[n.html_format_field.value/]"/>
                        <n.save_user/>
                    </n.edit_page_user.>
                    <n.redirect_to.page_user.user_profile_path/>
                </n.catch_exception.>
            </then>
            <else.if.page_user.has_signature>
                <then>
                    <n.html_format_field.set_value value="[n.page_user.signature.is_html_format/]" />
                    <n.signature_field.set_value value="[n.page_user.signature.as_editable/]" />
                </then>
            </else.if.page_user.has_signature>
        </n.if.is_submitted_form>
        <n.html>
            <head>
                <META NAME="robots" CONTENT="noindex,nofollow"/>
                <n.title.><t>Edit Signature</t></n.title.>
            </head>
            <body>
                <h1><t>Edit Signature</t></h1>

                <n.show_edit_signature_error/>

                <n.if.page_user.has_signature>
                    <then.show_current_signature/>
                </n.if.page_user.has_signature>

                <n.form.>
                    <n.html_format_field.checkbox />
                    <label for="[n.html_format_field.name/]"><t>Signature is in HTML format</t></label><br/>
                    <n.signature_field.textarea  maxlength="20" wrap="SOFT" tabindex="2" style="width:35em;height:7em;" />
                   
                    <div style="margin-top:1.4em">
                        <input type="submit" value="[t]Save Signature[/t]" />
                        <t>or</t> <a href="[n.page_user.user_profile_path/]"><t>Cancel</t></a>
                    </div>
                </n.form.>
                <script type="text/javascript">
                    var keynum, lines = 1;
                    $("#signature").keypress(function(event){                   

                    keynum =event.which;                   
                    
                    if(keynum == 13) {
                    if(lines == 2) {
                    return false;
                    }else{
                    lines++;
                    }
                    }                   
                    
                    });                
                 
                </script>
            </body>
        </n.html>
    </n.visitor.as_user_page.>
</override_macro>
My test forum.