Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SitesManager: getIdFromSiteUrl() #1197

Closed
anonymous-matomo-user opened this issue Mar 9, 2010 · 2 comments
Closed

SitesManager: getIdFromSiteUrl() #1197

anonymous-matomo-user opened this issue Mar 9, 2010 · 2 comments
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical. wontfix If you can reproduce this issue, please reopen the issue or create a new one describing it.
Milestone

Comments

@anonymous-matomo-user
Copy link

Hi there,
i need the id of an website (piwik_idsite = X) - Is its possible to commit the url of an project and get the piwik_idsite back?

Thanks!

@robocoder
Copy link
Contributor

In future, please rephrase your inquiries as a feature request, or post your question on the forum. In the meantime, I have marked this as invalid.

To answer your question, when you add a site via the API, it returns the idsite. There's currently no getIdFromSiteUrl method in the API.

If you submit a patch to implement this method, we'll review it. It's a complex operation though, so here's a tip: (pseudo-coded)

function getIdFromSiteUrl( $url ) {
    remove trailing slash on $url

    select idsite from site where main_url = '$url';
    if no match {
        select idsite from site_url where url = '$url'
    }

    if match {
        check user has view access to idsite
        return idsite
    }

    return ''
}

@robocoder
Copy link
Contributor

see #1261

@anonymous-matomo-user anonymous-matomo-user added this to the Piwik 0.5.5 milestone Jul 8, 2014
@mattab mattab added the wontfix label Aug 3, 2014
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical. wontfix If you can reproduce this issue, please reopen the issue or create a new one describing it.
Projects
None yet
Development

No branches or pull requests

3 participants