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.
Options

How increase characters for admin only ?

Hello everyone I have a problem with the character limit for admin, I have to publish a post with rules and manuals but exceeds the character limit, at first it was a good idea increase the limit, but this rule affects everyone and I do not think anyone need to write so much, then my question is :

How increase characters for admin only ?

Thank you very much.

Comments

  • Options
    hgtonighthgtonight ∞ · New Moderator

    You can store configuration changes without saving to disk. This is how perks work in Yaga. The basic gist is:

    public function userModel_afterGetSession_handler($sender) {
        $user = &$sender->EventArguments['User'];
        if(!$user->Admin) {
            return;
        }
    
        SaveToConfig('Vanilla.Comment.MaxLength', '20000', array('Save' => FALSE));
    }
    

    The key take away is that you are modifying the configuration in memory after a user session is loaded that is an admin.

    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.

  • Options
    rbrahmsonrbrahmson "You may say I'm a dreamer / But I'm not the only one" NY ✭✭✭

    Very interesting! And when are these changes in memory automatically wiped out? After the user logs off, after a specific editing is complete?

    And while this change is done only when the admin calls it, does it affect other users who are running at the same time?

  • Options
    hgtonighthgtonight ∞ · New Moderator

    @rbrahmson said:
    Very interesting! And when are these changes in memory automatically wiped out? After the user logs off, after a specific editing is complete?

    And while this change is done only when the admin calls it, does it affect other users who are running at the same time?

    It exists only for sessions that are started with a User whose admin field is non-zero. This will generally only be for 2 accounts (the original super-user and the system account).

    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.

  • Options
    rbrahmsonrbrahmson "You may say I'm a dreamer / But I'm not the only one" NY ✭✭✭

    Just to ensue I understand this correctly:
    1. The code (which tests that the user is defined as admin) changes the settings only for the user that executes the code.
    2. Once executed it exists just for the user that satisfies the test in #1 above.
    3. #2 implies that other users running at the same time are not affected (and in essence it tells me that each user has its own memory image of the configuration)
    4. Other configuration changes can also be changed in memory only (I can pick anything on the config file).
    5. For #4 above, I could make the changes based on other tests (not necessarily the one in #1 above). For example, I could test if the user is in a mobile device, has a specific role (not admin), etc.
    6. The code (test + statement) need to be embedded in a plugin (any suggestion which to pick? Is there an "empty" plugin template)

    You have become my mentor;-)

  • Options
    hgtonighthgtonight ∞ · New Moderator

    1-5: Yes
    6: Check out my Testing Ground plugin or the Example 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.

  • Options
    rbrahmsonrbrahmson "You may say I'm a dreamer / But I'm not the only one" NY ✭✭✭

    Thanks @hgtonight ! I'm learning to appreciate Vanilla more and more! And I'm encouraged that I was right on all of my five "speculations". I think I'm going to buy a lottery ticket this week;-)

Sign In or Register to comment.