Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Mason & PHP

by MCS (Monk)
on Feb 13, 2006 at 16:34 UTC ( [id://529861]=perlquestion: print w/replies, xml ) Need Help??

MCS has asked for the wisdom of the Perl Monks concerning the following question:

I have a webpage based on wordpress (which uses php). Using this, I can call a function to check what roles a user has based on their wordpress login. (using a wordpress cookie so I wouldn't have to add my own authentication scheme). I'm trying to add some additional functionality to this website and at first I thought I would just stick with PHP but the more I look at what I want to implement, the more I want to use some CPAN modules. I've also started to play with Mason (& mod_perl), thinking that might be the way to go. My question is, can I integrate Mason with wordpress?

For example, I can do this in PHP:

<?php include '../wp-config.php'; get_currentuserinfo(); if (current_user_can('read')) { ... }?>

Here it just checks to see if the wordpress user has the 'read' role. Is there any way to call a PHP function like this from Perl or should I just figure out how to rewrite all the wordpress user checking in perl? Any help or pointers would be greatly apreciated.

Replies are listed 'Best First'.
Re: Mason & PHP
by stonecolddevin (Parson) on Feb 13, 2006 at 17:16 UTC
    if you're simply reading from a permissions from a cookie or database it doesn't matter what language you code it in.
    meh.
Re: Mason & PHP
by hesco (Deacon) on Feb 13, 2006 at 23:24 UTC
    I put essentially this very question to colleague on an earlier project, he thought about it a couple of days and came back with way of invoking php from perl and perl from php.

    What I remember was (untested):

    <? php include("/path/to/script.cgi"); ?>
    with the script written not to duplicate headers, but to inject html, ready for inclusion, into the including page. You could even let the wordpress application handle the authentication and only include the limited access cgi script on the protected page.

    If I come across my notes on going the other way, I'll update this thread.

    -- Hugh

      Thanks all, after considering all possible options I think this is the way I will go. I was hoping to do more of it in Perl but I think PHP may be better suited here. Thanks for all your suggestions.

Re: Mason & PHP
by dorward (Curate) on Feb 13, 2006 at 17:48 UTC
Re: Mason & PHP
by Arunbear (Prior) on Feb 13, 2006 at 19:56 UTC
    I think it would be great if you could re-write wp-config.php in Perl and release it on CPAN.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://529861]
Approved by randyk
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (6)
As of 2024-04-24 10:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found