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.

Whm plugin development

Discussion in 'cPanel Developers' started by varunms, Dec 16, 2012.

  1. varunms

    varunms Active Member

    Joined:
    Aug 29, 2010
    Messages:
    33
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    INDIA
    cPanel Access Level:
    Root Administrator
    Hi

    how i can run a php script if a new reseller is created in whm...
    i am developing a whm plugin in php so i need it
     
  2. KostonConsulting

    KostonConsulting Well-Known Member

    Joined:
    Jun 17, 2010
    Messages:
    255
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    San Francisco, CA
    cPanel Access Level:
    Root Administrator
    You should look into the Standardized Hooks system. It does work with account create but may or may not work with adding reseller privileges:

    Getting Started action code as a script


    If it does not, you will need to either monitor the cpanel access log and parse calls to the page that adds reseller privileges or monitor /var/cpanel/resellers for changes.
     
  3. varunms

    varunms Active Member

    Joined:
    Aug 29, 2010
    Messages:
    33
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    INDIA
    cPanel Access Level:
    Root Administrator
    can you provide me a sample code for that in php
     
  4. KostonConsulting

    KostonConsulting Well-Known Member

    Joined:
    Jun 17, 2010
    Messages:
    255
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    San Francisco, CA
    cPanel Access Level:
    Root Administrator
    I looked at there is no hookable event for reseller creation. You'll likely want to monitor changes to '/var/cpanel/resellers' as just looking at account creations would not capture adding reseller privileges after an account is created.

    I'm happy to help point you in the right direction with your logic or if you have some code that you're wondering why it is not working, I can help dissect. Since reseller permission addition/removal is not hookable, I doubt anyone here has sample code for it.
     
  5. varunms

    varunms Active Member

    Joined:
    Aug 29, 2010
    Messages:
    33
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    INDIA
    cPanel Access Level:
    Root Administrator
    if a user is logedin to whm how i can find that he is a reseller or root
     
  6. KostonConsulting

    KostonConsulting Well-Known Member

    Joined:
    Jun 17, 2010
    Messages:
    255
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    San Francisco, CA
    cPanel Access Level:
    Root Administrator
    You could check $_ENV["REMOTE_USER"] to see if their name equals 'root' or not.
     
Loading...

Share This Page