StatusMessageLimiter

 

 Let's start by creating two new language keys (i will not show you how to do that)

string: _StatusLimit
Text:    (Maximum characters allowed: 60)

string: _StatusLimitLeft
Text:    <span style="color: #ff0000;">Characters left:</span>

Now its time to edit files (two files only)

/templates/base member_menu_status_text_field.html

on the first line find

<div class="form_advanced_table">

and change it so it looks like this

<div class="form_advanced_table"><bx_text:_StatusLimit /> / <bx_text:_StatusLimitLeft /> <span id="charLeft"> </span><br/>

at the bottom right after <div class="clear_both"></div>
add this

<script type='text/javascript'>
        $(document).ready(function() {
            $('#UserStatusMessBut_mm').keyup(function() {
                var len = this.value.length;
                if (len >= 60) {
                    this.value = this.value.substring(0, 60);
                }
                $('#charLeft').text(60 - len);
            });
        });
    </script>


SECOND FILE

/templates/base user_status_light.html

again first line

<div class="statusTab" style="margin-left:10px;">

change to

<div class="statusTab" style="margin-left:10px;"><bx_text:_StatusLimit /> / <bx_text:_StatusLimitLeft /> <span id="charLeft"> </span><br/>

THIS ONE IS IMPORTANT!!!!!!!!!

at the end after

</table>
</div>

add

<script type='text/javascript'>
        $(document).ready(function() {
            $('#UserStatusMessBut_nm').keyup(function() {
                var len = this.value.length;
                if (len >= 60) {
                    this.value = this.value.substring(0, 60);
                }
                $('#charLeft').text(60 - len);
            });
        });
    </script>

And that's it, in your admin language section you can change the wording if you like.

Quote · 16 Mar 2012

Very cool! Works perfectly. Thank you for this mod prolaznik!

I'm curious though.. any particular reason why you chose 60 chars?

Quote · 16 Mar 2012

no reason, you can change the limit just make sure you change all the 60's and the wording Text:    (Maximum characters allowed: xx)

Quote · 16 Mar 2012

Awesome post prolaznik.

It's been up voted.

Updating my BoonexNerd.net site.
Quote · 16 Mar 2012

 

Awesome post prolaznik.

It's been up voted.

 Thank you.

Quote · 19 Mar 2012

I like it. Smile

Quote · 3 Oct 2012

has anyone validated this on 7.1 yet?

Quote · 25 Feb 2013

I did...... works fine :)

Quote · 25 Feb 2013

Great, I had someone to put this long status message in and then he could not edit it or remove it, I had to do it.  This will be a solution for that.

Geeks, making the world a better place
Quote · 25 Feb 2013

Copy & paste can get around this, I don't know why. Manual edit has 60 characters limit but copy & paste no.

Quote · 28 Apr 2013

Works like a charm! Thanks so much for posting this!

7.3.5 with responsive UNI
Quote · 20 Jul 2013

Is there a way to actually restrict the number of characters entered?

Currently the member only gets a warning that they have exceeded the limit, which is usually ignored.

Using version 7.1.0

Thanks in advance

This is my signature, there are many like it but this one is mine...
Quote · 19 Aug 2013

I used the code above and I can not enter more characters than what I set as the limit... not sure but perhaps you missed something or it  needs to be changed in your custom templates files as well?

Quote · 20 Aug 2013
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.