Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

getUserPreference bug: "defaultReport" preference is "false" by default #3781

Closed
tsteur opened this Issue · 7 comments

2 participants

@tsteur
Owner

Hi,

I'm using the method "UsersManager.getUserPreference" via API to request a user's "defaultReport" preference. Depending on this I'll either display the "All Websites Dashboard" or the selected Website when a user opens the mobile app. Same behavior as in Piwik.

My problem:
After a fresh Piwik installation the API returns:

{value: false}

but should be:

{value: "1"}

Because Piwik behavior is to open first website after a fresh install and the value "Dashboard for a specific website -> FIRST WEBSITE" is selected by default in "User settings". Once I press "save" in "User settings" the API returns the correct value:

{value: "1"}

Is it possible to return the ID of the first website by default? Otherwise I'd have to implement a lot of stuff to workaround this and I'd have to do a lot of requests to make sure a website will be loaded.

API should always return either 'MultiSites' or an ID of a website.

@diosmosis
Collaborator

In 0e35cd6: Fixes #3781, make sure getUserPreference returns valid default value when option is not set in the DB.

@diosmosis
Collaborator

In 95dc8d9: Refs #3781, fixing build.

@diosmosis
Collaborator

In 5879fbd: Refs #3781, fixing build, revert last change and add getSuperUserLogin to Piwik_Access (so FakeAccess can mock it). Modified PDFReports to use Piwik::getSuperUserLogin instead of accessing config directly.

@diosmosis
Collaborator

In 24c2aa7: Refs #3781, revert change to unrelated integration test.

@tsteur
Owner

Is this really fixed? I just did a fresh install of Piwik and I'm still getting the response:

{value: false}

At least when using the Superuser. We also had such an issue in the current Piwik Mobile 2 beta test.

@tsteur
Owner

In 99a5f06: refs #3781 fix superuser default preference is not returned by default, probably also fixes some login issues in Piwik Mobile as it is requesting the getSitesIdWithAtLeastViewAccess to verify whether someone has access to at least one website

@tsteur
Owner

In 43fd0f0: refs #3781 fix test, defaultReport cannot return the website in case there is no website

@tsteur tsteur added this to the 2.0.3 - Piwik 2.0.3 milestone
@diosmosis diosmosis was assigned by tsteur
@sabl0r sabl0r referenced this issue from a commit in sabl0r/piwik
@tsteur tsteur refs #3781 fix superuser default preference is not returned by defaul…
…t, probably also fixes some login issues in Piwik Mobile as it is requesting the getSitesIdWithAtLeastViewAccess to verify whether someone has access to at least one website
99a5f06
@sabl0r sabl0r referenced this issue from a commit in sabl0r/piwik
@tsteur tsteur refs #3781 fix test, defaultReport cannot return the website in case …
…there is no website
43fd0f0
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.