Announcement

Collapse
No announcement yet.

Administrator Notes in AdminCP tweak request

Collapse
X
Collapse
First Prev Next Last
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Administrator Notes in AdminCP tweak request

    I utilize this area in AdminCP a lot. Keeping notes on changes made to our Forum is extremely useful, and over the years I've made lots of changes and tweaks, and the entries, as you can imagine, are many.

    The problem I have with this area is that it's linear, with all new entries being added to the bottom of the list. While using the slider to get to the bottom is okay, it's well, tedious. Is there any way at all to code a 'Go to Bottom' function/feature for this area of AdminCP?
    The Linux Community has given me much. I do what I can to return the favor!

    #2
    This is an AdminCP hack which means you'd have to re-apply these changes every time you upgrade.
    1. Logon to your server via FTP, cPanel or similar tools.
    2. Open the file <vB5 installation directory>/core/admincp/index.php.
    3. Backup the file.
    4. Edit the file using a text editor (Visual Studio Code, Sublime Text, NotePad++ or your favorite code editing tool)
    5. Search for administrator_notes using CTRL+F or Command+F keys.
    6. Replace this line that is located 2 lines below that administrator_notes line:
      PHP Code:
      print_submit_row($vbphrase['save'], 01); 
      with:
      PHP Code:
      print_submit_row($vbphrase['save'], 01'''<input type="button" value="Go to Bottom" tabindex="1" class="button" accesskey="b" onclick="document.getElementsByName(\'notes\')[0].scrollTop = document.getElementsByName(\'notes\')[0].scrollHeight" />'); 
    7. Save the file and make sure it is updated on the server.
    8. Logon to AdminCP and then scroll down to Administrator Notes section and check the changes.
    With this change, a "Go to Bottom" button will appear next to the Save button. The accesskey for it is "b" which means you can also do Alt + B (Windows) or Control + Option (Alt) + B (Mac) to scroll to bottom.
    Helpful? Donate. Thanks!
    Buy me a coffeePayPal QR Code
    Fast VPS Host for vBulletin:
    A2 Hosting & IONOS

    Comment


      #3
      Logged in via Secure FTP, became root and edited the file.
      PHP Code:

      //next line commented out 2022-02-02 by Snowhog

      //print_submit_row($vbphrase['save'], 0, 1);

      //Start of MOD. Next line added 2022-02-02 by Snowhog but written by Glennrocksvb per my request. It provides a Go to Bottom button to Administrator Notes.

      print_submit_row($vbphrase['save'], 01'''<input type="button" value="Go to Bottom" tabindex="1" class="button" accesskey="b" onclick="document.getElementsByName(\'notes\')[0].scrollTop = document.getElementsByName(\'notes\')[0].scrollHeight" />');

      //End of MOD. 
      Saved the file. Stayed in my Secure FTP session -- just in case.

      Clicked on the AdminCP login link and this is what I got:
      That action could not be completed. Please try again, and if this occurs again please contact the system administrator and tell them how you got this message.
      For the moment, I've commented the change and uncommented the original line.
      The Linux Community has given me much. I do what I can to return the favor!

      Comment


        #4
        Can you check the error logs on your server to get the detailed error?
        Helpful? Donate. Thanks!
        Buy me a coffeePayPal QR Code
        Fast VPS Host for vBulletin:
        A2 Hosting & IONOS

        Comment


          #5
          Which log file would I look at?
          The Linux Community has given me much. I do what I can to return the favor!

          Comment


            #6
            I think the Copy Code is causing the issue. Using it replaces the space characters in the code with some weird invisible character. If you are using a code editor (I'm using Visual Studio Code), you will immediately see the weird "spaces" highlighted and the entire line of code has squiggly line indicating a syntax error. If you hover it, you will see the syntax error. Please see screenshot below.

            Click image for larger version

Name:	weird-spaces.png
Views:	101
Size:	36.0 KB
ID:	23529

            So the solution for now is to highlight and copy the PHP code manually instead of using Copy Code.
            Helpful? Donate. Thanks!
            Buy me a coffeePayPal QR Code
            Fast VPS Host for vBulletin:
            A2 Hosting & IONOS

            Comment


            • glennrocksvb
              glennrocksvb commented
              Editing a comment
              It's recommended to use a real code editor instead of just a plain text editor so that syntax issues like this are quickly detected.

            • glennrocksvb
              glennrocksvb commented
              Editing a comment
              Meanwhile, I'll take a look at that Copy Code issue and fix it.

            #7
            That was it. Deleted the new line and did a straight copy and paste. Saved and entered the AdminCP. No issue.

            The code provides both a Save and Go to Bottom button positioned to the lower left and below the 'line' that the original Save button is located on:

            Click image for larger version

Name:	Screen Shot 2022-02-02 at 12.26.02 PM.png
Views:	91
Size:	64.5 KB
ID:	23533

            Purely for esthetics, can the second Save button be omitted, and the Go to Bottom button be positioned on the same 'line' as the original Save Button and in the same relative position as what your code does; to the right of the Save button?
            The Linux Community has given me much. I do what I can to return the favor!

            Comment


              #8
              It should do what you suggested. But I think you didn't replace or comment out the original code that's why there are 2 Save buttons.

              This is what I have on mine.

              Click image for larger version

Name:	buttons.png
Views:	96
Size:	13.1 KB
ID:	23535
              Helpful? Donate. Thanks!
              Buy me a coffeePayPal QR Code
              Fast VPS Host for vBulletin:
              A2 Hosting & IONOS

              Comment


                #9
                Doh!!

                Yeah, that was it. :feeling_like_a_doofus:

                Thanks!
                The Linux Community has given me much. I do what I can to return the favor!

                Comment


                  #10
                  Originally posted by glennrocksvb View Post
                  Meanwhile, I'll take a look at that Copy Code issue and fix it.
                  Fixed!
                  Helpful? Donate. Thanks!
                  Buy me a coffeePayPal QR Code
                  Fast VPS Host for vBulletin:
                  A2 Hosting & IONOS

                  Comment


                    #11
                    Just noticed this. I used the Go to Bottom button and added content to the last entry and clicked Save. It saved and returned me to the top of the list (normal). However, clicking again on the Go to Bottom button doesn't do anything. I have to actually navigate to some other area of the AdminCP (click on any other link button and then return to Control Panel Home before it will work again.
                    The Linux Community has given me much. I do what I can to return the favor!

                    Comment


                    • glennrocksvb
                      glennrocksvb commented
                      Editing a comment
                      I will take a look.

                    • glennrocksvb
                      glennrocksvb commented
                      Editing a comment
                      I wasn't able to reproduce using the exact same steps you mentioned. Clicking the Save button reloads the page which shouldn't have any difference than navigating to other links on AdminCP and then going back. Both scenarios load the page normally.

                    • glennrocksvb
                      glennrocksvb commented
                      Editing a comment
                      Can you check the JavaScript console (F12 > Console) and see if there is any JavaScript error when you click the Go to Bottom button?

                    #12
                    Originally posted by glennrocksvb View Post
                    Can you check the JavaScript console (F12 > Console)
                    Confused on that. I'm on an iMac. I'm accessing our Forum via Safari web browser. As a note, if I reload the page, then the button works again. And as another note, this anomalous behavior does not happen if I'm using Firefox (v97.0 (64-bit)) on my Linux (Kubuntu 22.04) HP laptop, so it would seem it's something about Safari.
                    The Linux Community has given me much. I do what I can to return the favor!

                    Comment


                      #13
                      Sussed it out. Here is the output when clicking on the Save button.

                      Click image for larger version

Name:	Screen Shot 2022-02-02 at 3.31.40 PM.png
Views:	126
Size:	278.3 KB
ID:	23546
                      The Linux Community has given me much. I do what I can to return the favor!

                      Comment


                        #14
                        And what the console shows when the AdminCP is first loaded, with the error expanded.

                        Click image for larger version

Name:	Screen Shot 2022-02-02 at 3.35.15 PM.png
Views:	86
Size:	58.4 KB
ID:	23548
                        The Linux Community has given me much. I do what I can to return the favor!

                        Comment


                        • glennrocksvb
                          glennrocksvb commented
                          Editing a comment
                          So on page first load, clicking the Go to Bottom button still works even with that error on page load?

                        • Snowhog
                          Snowhog commented
                          Editing a comment
                          If I don't click the Save button, then the Go to Bottom button works. Click Go to Bottom, I end up at the bottom of the listing. Scroll upwards any distance and click on Go to Bottom and it works. It's only when I click the Save button, which does save the changes and returns me to the top of the list, that the Go to Bottom button stops working until I either reload the page or click on any other active link.

                        #15
                        Thanks for providing more details. Do any new JS errors occur right after clicking "Go to Bottom" button? I want to distinguish which errors occur on page load vs on click of the Go to Bottom button.

                        Helpful? Donate. Thanks!
                        Buy me a coffeePayPal QR Code
                        Fast VPS Host for vBulletin:
                        A2 Hosting & IONOS

                        Comment

                        Users Viewing This Page

                        Collapse

                        There is 1 user viewing this forum topic.

                        • Guest Guest

                        Latest Posts

                        Collapse

                        Working...
                        X
                        Searching...Please wait.
                        An unexpected error was returned: 'Your submission could not be processed because you have logged in since the previous page was loaded.

                        Please push the back button and reload the previous window.'
                        An unexpected error was returned: 'Your submission could not be processed because the token has expired.

                        Please push the back button and reload the previous window.'
                        An internal error has occurred and the module cannot be displayed.
                        There are no results that meet this criteria.
                        Search Result for "|||"