The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

add new line to stats menu in Cpanel

Discussion in 'cPanel Developers' started by Movsme Mxsltv, Jul 10, 2012.

  1. Movsme Mxsltv

    Movsme Mxsltv Registered

    Joined:
    Jul 10, 2012
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    hello

    i want to add new line to cpanel stats menu


    the value of this line is from a mysql database


    so i want when the user open the cpanel show him the line with a value accorded with his account


    i mean stats menu is this
    cpanel-stats-expanded.jpg


    thanx
     
  2. cPanelDavidN

    cPanelDavidN Integration Developer
    Staff Member

    Joined:
    Dec 17, 2009
    Messages:
    571
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Hi Movsme Mxsltv,

    You need to create a Standardized Hook which injects your data into the reference that is used when rendering the status bar.

    Standardized Hooks Documentation

    You will want to hook the cPanel API2 call StatsBar::stat.

    Putting the above to things together you'll be creating a Standarized Hook that uses the "post" stage of the "Api2::StatsBar::stat" Hookable Event (reference doc here). Inside your hook's logic you will modify the value of the 'output' element found in the data hash. You will have to code this in Perl so that you can get the input data hash passed by reference.

    OR

    If you don't want to do that (or mess with Perl directly), you can make a custom theme/branding that can fetch the info and place it where you want. There's a number of ways this could be done so, I won't elaborate unless necessary.

    Personally I find the first solution cleaner from an implementation and maintenance perspective, albeit sounds more daunting. I try to only mess with branding when I want to affect the presentation of data, not the presence of it.

    Regards,
    -DavidN
     
  3. Movsme Mxsltv

    Movsme Mxsltv Registered

    Joined:
    Jul 10, 2012
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    you have exemple for the 1 and the 2 solution ?
     
Loading...

Share This Page