Details
- 
    Type:Bug 
- 
    Status: Done/Fixed
- 
    Priority:Minor 
- 
    Resolution: Fixed/Completed
- 
    Affects Version/s: 4.4.6
- 
    Fix Version/s: Unscheduled
- 
    Component/s: Core CiviCRM, WordPress Integration
- 
    Labels:
- 
        Versioning Impact:Patch (backwards-compatible bug fixes)
- 
        Documentation Required?:None
- 
        Funding Source:Needs Funding
Description
Since the function cmsRootPath() starts at the bottom of the path when CIVICRM_CMSDIR is not defined (which in 4.4.6 is not even mentioned in civicrm.settings.php ), the function can inadvertendly turn up an unrelated WordPress.
On my hosting environment, I have a main domain and any additional domains that I add are in a subdirectories under that domain's public_html, like this:
/home/user/public_html/ <<-- maindomain.com
/home/user/public_html/subdomain1.com/   <<-- subdomain1.com
/home/user/public_html/subdomain2.com/   <<-- subdomain2.com
When this script is used from a script like Cron.php, the bootstrap is called and looks for the WordPress install. In my situation, this function found the first WordPress in its search path (/home/user/public_html/) and called it good. However, CiviCRM is really installed in one of the subdomains, so user authentication failed.
I would suggest that the function start at its own location and work down looking for a WordPress install instead of starting at the root and working up.
Forum discussion here: http://forum.civicrm.org/index.php/topic,33500.0.html
cmsRootPath in github: https://github.com/civicrm/civicrm-core/blob/master/CRM/Utils/System/WordPress.php#L521
This is my first bug report with CiviCRM. Hope that all the necessary info is provided.
