We have set up scholar at our school, and have made some minor changes. I have created a site, and everything seems to work fine except when I'm logged out and go to look at the different content types for my page I get a bunch of errors.

# warning: array_keys() expects parameter 1 to be array, null given in /usr/local/PostgreSQL/EnterpriseDB-ApachePhp/apache/www/trunk/sites/all/modules/contrib/og/og.module on line 363.
# warning: array_fill(): Number of elements must be positive in /usr/local/PostgreSQL/EnterpriseDB-ApachePhp/apache/www/trunk/includes/database.inc on line 253.
# warning: implode(): Invalid arguments passed in /usr/local/PostgreSQL/EnterpriseDB-ApachePhp/apache/www/trunk/includes/database.inc on line 253.
# warning: array_keys() expects parameter 1 to be array, null given in /usr/local/PostgreSQL/EnterpriseDB-ApachePhp/apache/www/trunk/modules/user/user.module on line 513.
# user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1 query: SELECT p.perm FROM role r INNER JOIN permission p ON p.rid = r.rid WHERE r.rid IN () in /usr/local/PostgreSQL/EnterpriseDB-ApachePhp/apache/www/trunk/modules/user/user.module on line 513.
# warning: in_array() expects parameter 2 to be array, null given in /usr/local/PostgreSQL/EnterpriseDB-ApachePhp/apache/www/trunk/sites/all/modules/contrib/og/og.module on line 365.
# warning: array_keys() expects parameter 1 to be array, null given in /usr/local/PostgreSQL/EnterpriseDB-ApachePhp/apache/www/trunk/sites/all/modules/contrib/views/views.module on line 480.
# warning: array_keys() expects parameter 1 to be array, null given in /usr/local/PostgreSQL/EnterpriseDB-ApachePhp/apache/www/trunk/sites/all/modules/contrib/views/views.module on line 480.
# warning: array_keys() expects parameter 1 to be array, null given in /usr/local/PostgreSQL/EnterpriseDB-ApachePhp/apache/www/trunk/sites/all/modules/contrib/context/context.core.inc on line 471.
# warning: array_fill(): Number of elements must be positive in /usr/local/PostgreSQL/EnterpriseDB-ApachePhp/apache/www/trunk/includes/database.inc on line 253.
# warning: implode(): Invalid arguments passed in /usr/local/PostgreSQL/EnterpriseDB-ApachePhp/apache/www/trunk/includes/database.inc on line 253.
# warning: array_merge(): Argument #2 is not an array in /usr/local/PostgreSQL/EnterpriseDB-ApachePhp/apache/www/trunk/sites/all/modules/contrib/context/context.core.inc on line 475.
# user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') OR r.rid IS NULL) ORDER BY b.region, b.weight, b.module' at line 1 query: SELECT DISTINCT b.* FROM blocks b LEFT JOIN blocks_roles r ON b.module = r.module AND b.delta = r.delta WHERE b.theme = '' AND (r.rid IN () OR r.rid IS NULL) ORDER BY b.region, b.weight, b.module in /usr/local/PostgreSQL/EnterpriseDB-ApachePhp/apache/www/trunk/sites/all/modules/contrib/context/context.core.inc on line 475

I was wondering if anyone might know what the issue is, or could point me in the direction of resolving this. Thanks.

Comments

redndahead’s picture

Are you using postgres?

blackhole82’s picture

We were using it but it didn't work right. We are using mySQL now.

redndahead’s picture

What version are you using? What php version is it? When you say minor changes what are those?

blackhole82’s picture

mySQL version 14.12, PHP version 5.3.2. The changes I made were to openscholar_front.module openscholar_front_getyoursitebutton() so that the scholar register button only shows up if you are logged in. We installed LDAP and only want those who are authenticated to be able to create a site. I also changed user.pages.inc user_page( ) function to direct the user to site/register if they are new and don't have a site yet, otherwise to their site. Then for the user_logout() function I redirect back to the welcome page once the user is logged out.

Here's the code:

function openscholar_front_getyoursitebutton() {

  global $user;

    //Show button to go to site if user has one
    if ($vsites = vsite_get_vsite_by_owner($user->uid)){

        $site_link = (count($vsites) > 1) ? 'user' : $vsites[0] -> purl;
        return  l('Go to your site', $site_link);

   }

    //Show create site button if user is logged in but doesn't have a site yet
    if (!in_array('anonymous user', $user -> roles) && !vsite_get_vsite_by_owner($user->uid)) {


        return l('Get your web site!', 'site/register');

    }

}
function user_page() {
  global $user;
  if ($user->uid && !vsite_get_vsite_by_owner($user->uid)) {
     drupal_goto('site/register');

  }
  else if ($vsites = vsite_get_vsite_by_owner($user->uid)) {
  $site_link = (count($vsites) > 1) ? 'user' : $vsites[0] -> purl;
  drupal_goto ($site_link);

  }
  else {
    return drupal_get_form('user_login');
  }
}
function user_logout() {
  global $user;

  watchdog('user', 'Session closed for %name.', array('%name' => $user->name));

  // Destroy the current session:
  session_destroy();
  // Only variables can be passed by reference workaround.
  $null = NULL;
  user_module_invoke('logout', $null, $user);

  // Load the anonymous user
  $user = drupal_anonymous_user();

  drupal_goto('../../index.php');
}
ferdi’s picture

@blackhole82 Here are two extra modules that we use to customize our own installation (iqss_openscholar_front ) and allow only Harvard affiliates to be able to create a site (iqss_pinserver_register):

http://scholar.svn.sourceforge.net/viewvc/scholar/trunk/sites/all/module...

Also, if you want to do anything when user logs in (i.e. redirect to site/register) or out (i.e. redirect to a some url), have a look at hook_user: http://api.drupal.org/api/function/hook_user/6

mysql5 + php 5.2 is a good combination do run Drupal / OpenScholar.

thanks!

redndahead’s picture

As @ferdi said you can run into any number of errors using Drupal 6 and PHP 5.3. Not all modules support 5.3 yet and there are plenty of 3rd party modules in openscholar. I would suggest using 5.2 also.

blackhole82’s picture

I will try installing php 5.2 and see if that fixes some of our problems. Thanks.