Community Forums
Connect with us on LinkedIn
Community Notice
+ Reply to Thread
Results 1 to 7 of 7
  1. #1
    Member
    Join Date
    Sep 2008
    Posts
    98

    Default Setting "authuser" as php variable

    Hello,

    I am trying to use the currently logged in user as a constant in my php script.

    Using the API <cpanel print="$authuser"> accomplishes the result I am looking for but does not work within PHP.

    What 'voodoo' do I need to use the cPanel API properly in this case?

    PHP Code:
    <?php

    define
    ("loggeduser","AUTHUSER NEEDS TO BE HERE");

    ?>
    I have checked out the XMPAPI but it seems like more than I need at the moment, and also doesnt seem to be able to fetch the currently logged in user (perhaps I am wrong).

    Thank you!

  2. #2
    Member bvierra's Avatar
    Join Date
    Jul 2006
    Location
    Southern California
    Posts
    55

    Default

    name the page cpphp instead of php. This runs the php file through the cPanel wrapper which replaces the code with the variable you want

  3. #3
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    10,718
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    If you desire to call cPanel functions from your PHP script, you may want to consider LivePHP.

    It was discussed at the 2008 cPanel Conference's API presentation available at:

    http://docs.cpanel.net/twiki/pub/All...des08/APIs.pdf

    Formal documentation for LivePHP is still a work in progress, so let me know if you need any help with that.

  4. #4
    Member
    Join Date
    Sep 2008
    Posts
    98

    Default

    Hi David,

    Thank you for your response.
    I read that API presentation a few days ago, and am very excited that it will finally allow me the kind of flexibility and functionality that I have been wanting and expecting when writing cPanel content with PHP.

    However, I am experiencing a few hurdles with livephp - I actually posted about one of them yesterday in this forum:

    http://forums.cpanel.net/f42/using-c...hp-127713.html

    Any feedback would be appreciated.

  5. #5
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    10,718
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Quote Originally Posted by sirbrent View Post
    Hi David,

    Thank you for your response.
    I read that API presentation a few days ago, and am very excited that it will finally allow me the kind of flexibility and functionality that I have been wanting and expecting when writing cPanel content with PHP.

    However, I am experiencing a few hurdles with livephp - I actually posted about one of them yesterday in this forum:

    http://forums.cpanel.net/f42/using-c...hp-127713.html

    Any feedback would be appreciated.
    I've discussed that post at length with a member of our Quality Assurance team. We are working on attempting to find a solution to these issues.

  6. #6
    Member
    Join Date
    Sep 2008
    Posts
    98

    Default

    David,

    Thank you. I eagerly await information concerning the solutions to these issues.

    Many Thanks.

  7. #7
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    10,718
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    For others following this thread, here's the Bugzilla entry that was filed for this issue: Bug 9565 - Improved PHP capable API needed

Similar Threads & Tags
Similar threads

  1. Auto-responder ignores "interval" setting if people CC'd into email
    By mynamesnotdave in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 08-17-2011, 09:50 AM
  2. Filed with Developers Autoresponder "interval" setting needs note for explanation [Case 50080]
    By jpratt in forum Feature Requests for cPanel/WHM
    Replies: 7
    Last Post: 06-03-2011, 08:04 AM
  3. feature request: have the Mailing Lists default "archive" setting be "private"
    By jpratt in forum Feature Requests for cPanel/WHM
    Replies: 0
    Last Post: 01-17-2011, 05:45 PM
  4. Redirecting with cpanel "failurl" variable
    By scoob19 in forum E-mail Discussions
    Replies: 0
    Last Post: 10-01-2010, 06:02 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube