Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-1899

Some thoughts about the SITEID constant

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 1.5
    • Fix Version/s: 1.8
    • Component/s: General
    • Labels:
      None
    • Environment:
      All
    • Affected Branches:
      MOODLE_15_STABLE
    • Fixed Branches:
      MOODLE_18_STABLE

      Description

      I was looking for some problems when adding blocks to site page in 1.4. It was using:

      if($course->id == 1)

      and I changed it to:

      if(!$course->category)

      Because some users reported me that their 'site course' wasn't the id=1).

      With the addition in Moodle 1.5 of the new constant SITEID=1, we are assuming that the the course 1 is ALWAYS the site course, and it seems to be FALSE.

      To be more chaotic, the get_site() function (often used) selects the first course whose category = 0, what is completely in collision with the new SITEID constant.

      I think that we should define this to be consistent across all the code.

      We could execute the SITEID = get_site()->id only once and then maintain the SITEID (or the whole SITE) variable in the session...only one idea.

      Your turn...

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              skodak Petr Skoda
              Reporter:
              stronk7 Eloy Lafuente (stronk7)
              Tester:
              Nobody
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                31/Mar/07