This forum is for module development and code related questions, not general module support. For general support, use the Post installation forum.

Rendering a menu from an administrator-defined block ?

Hello everyone,

I want to display a different menu, depending on the user-chosen language.

Using conf_url_rewrite I've managed to set a global variable with the selected language,
based on the URL requested by the client. The language gets prepended to outgoing URLs.
Now I want to create an administrator-defined block that uses
this global variable to determine which menu must be shown.

Does anyone know the optimal way to render a disabled menu
( created with Drupal's menu system ) from within an administrator-defined block ?

I can't import linuxsir.org RSS to Drupal 4.6x

I can't import linuxsir.org RSS to Drupal 4.6

I want to import http://www.linuxsir.org RSS to my site .I test it ,it can't be import to drupal .

can anyone help me ?
thanks

bnnb from china.

warning: strtr(): The second argument is not an array. in /opt/apache/htdocs/main/includes/common.inc on line 547.

warning: strtr(): The second argument is not an array. in /opt/apache/htdocs/main/includes/common.inc on line 547.

warning: xml_set_element_handler(): supplied argument is not a valid XML Parser resource in /opt/apache/htdocs/main/modules/aggregator.module on line 460.

warning: xml_set_character_data_handler(): supplied argument is not a valid XML Parser resource in /opt/apache/htdocs/main/modules/aggregator.module on line 461.

warning: xml_parse(): supplied argument is not a valid XML Parser resource in /opt/apache/htdocs/main/modules/aggregator.module on line 463.

warning: xml_get_error_code(): supplied argument is not a valid XML Parser resource in /opt/apache/htdocs/main/modules/aggregator.module on line 464.

warning: xml_get_current_line_number(): supplied argument is not a valid XML Parser resource in /opt/apache/htdocs/main/modules/aggregator.module on line 464.

warning: Cannot modify header information - headers already sent by (output started at /opt/apache/htdocs/main/includes/common.inc:385) in /opt/apache/htdocs/main/includes/common.inc on line 193.

Top answered/viewed nodes with hight position in front page

It is possible to make nodes (blog postings, articles and etc.) to be sorted in front page (site.com/node) sortet by their rating? If I have a blog posting, that is higly interested and with lot of comments, then this posting to be in hight position on front page. I don't want to make it sticky, I want this posting, based on its popularity to go to sticky position.

Dates and timezones in Event module - where is this issue?

I've been mulling over a problem with dates and timezones using the Event module, and would like to put across some thoughts and ask where current thinking is on this issue.

It seems to me that, when a user creates an Event in Drupal, there are potentially a number of different times (and timezones) involved:
1) UTC time (this is the kind of zero baseline, and really the only thing that can be relied on)
2) Local timezone on the server.
3) The user's local timezone (as specified in Drupal user profile).
4) The timezone where the event is to take place.
5) The timezone of the anonymous user looking at the event.

Here is a scenario - somebody tell me if I have got my sums or assumptions wrong!

Suppose that I have enabled "Configurable time zones" in "Settings", and set the default time zone to +0200 (because most of my users are in Continental Europe - and we are on summer time)

Suppose now that my web site is hosted in the USA (New York: -0500).
A user in the UK (+0100 on British Summer Yime) now creates an event which is to take place at midday the next day, in Calcutta (India: +0530)

Let us suppose that the user has set his (UK) timezone profile, then the event will be timed at BST 1200 (ie UTC 1100)

Now a user from India logs in, and notices that there is an event in Calcutta. Since his profile has his timezone set to local time (UTC +0530), he sees the event advertised at UTC 1100 +0530, ie at 16:30, and turns up only to find that it has already finished.

Dynamically assign non-persistent roles?

Hello,

I am currently working on a module for Drupal 4.5.x in which I would like to dynamically assign non-persistent roles to externally authenticated users. The way that I set out to do this was by catching the load operation in my module's hook_load function and then set or unset elements of $user->roles as required.

Unfortunately, this does not seem to work the way that I had expected it. I am able to manipulate the user object the way I want, and by tracing my way through the user.module code, I found that at the end of user_login() the user object still has the correct roles. This is on line 795 of user.module of version 4.5.2.

Note that to prevent the roles that I set from being overwritten, I moved user_module_invoke('load', $array, $user) in user_load. The last part of that function now looks like:

  if (db_num_rows($result)) {
    $user = db_fetch_object($result);
    $user = drupal_unpack($user);

    $user->roles = array();
    $result = db_query('SELECT r.rid, r.name FROM {role} r INNER JOIN {users_roles} ur ON ur.rid = r.rid WHERE ur.uid = %d', $user->uid);
    while ($role = db_fetch_object($result)) {
      $user->roles[$role->rid] = $role->name;
    }
  }
  else {
    $user = new StdClass();
  }
  user_module_invoke('load', $array, $user);

  return $user;

I also need to point out that my users are authenticated against an external source, which makes things a little more complicated.

My feeling is that the user object gets reset/reloaded somewhere between completing the login sequence and presenting the first page.

For reference, the code that adjusts the user's roles (which I think is correct) is now

    if ($op == 'load') {
        // only address hyperborea users
        if (!ereg('^(.*)@hyperborea.net$', $user->name, $match)) return;

        $hyperuser = _get_hyper_user($match[1]);
        if (sizeof($hyperuser) == 0) return;

        if ($hyperuser['wizlevel'] > 0) {
            $user->roles[WIZARD_ROLEID] = WIZARD_ROLELABEL;
        } else {
            if (array_key_exists(WIZARD_ROLEID, $user->roles)) {
                unset($user->roles[WIZARD_ROLEID]);
            }
        }

        if ($hyperuser['level'] > 0) {
            $user->roles[PLAYER_ROLEID] = PLAYER_ROLELABEL;
        } else {
            if (array_key_exists(PLAYER_ROLEID, $user->roles)) {
                unset($user->roles[PLAYER_ROLEID]);
            }
        }

    }

If anyone could point me into the right direction; either by referring me to docs, code examples, or by helping me debug, I would greatly appreciate any help. I have a tendency of hanging out on #drupal (irc.freenode.net) as pa5kl.

pathauto, adding new placeholders for pattern?

I love the pathauto module but for my purposes I would like to implement two more placeholders:

[node]
The [node] placeholder should write out the current node type, hence "blog" or "book".
[user]
the [user] placeholder should write out the current user name.

This would allow me to create automated path aliasing where users blog submissions receive the following syntax:

[blog]/[user]/[title]

Is there a simple way of implenting this?

Thanx a million.

Pages

Subscribe with RSS Subscribe to RSS - Module development and code questions