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

Determine module version programatically?

Is there an official way to determine an installed module's version programatically? I don't see any official API or hook for this purpose. (But I may have missed something)

This would be very handy... if you know of a way, or there is documentation or an example showing how this may be done, I'd love to see it.

-Mike

Display Event until End Time

I'm using the Event Module and would like to have the events displayed on my front page until the end time of the event. Right now the event disappers on the day of the event. That's a bad thing. Is there a setting or do I need to modify the code somewhere to enable the event to display or did I possibly do something wrong when I set up the event?

THANKS.

Search hook... Strange behavior

Hello,

I'm trying to implement the search hook in a very simple block module that only adds a directory of all users with the role "doctor" and a search tab for finding only users with the doctor role. So the weird thing is that it works but only for some users and not others.

"dobson" and "marigold" are both doctors for example. Dobson does not come up, but marigold does get retrieved by the search.

The SQL query works for ALL users when I enter it directly into MySql's command line, so it can be the SQL query in and of itself. The only space for variation is in the $keys parameter which is clearly working for the other users.

Also, I am doing the search as the root drupal administrator so it can't be that I am restricted to not be aware of that one user (dobson).

Below is the search hook implementation I wrote. Any comments or suggestions are greatly appreciated! -Rob

function doctor_update_index() {
// do nothing. We do not want anything indexed
}

function doctors_search($op = 'search', $keys = NULL) {
global $user;

switch($op) {
case 'name': $results = t('doctor');
break;

case 'search':
$results = array();
$q = "select distinct u.uid, u.name from {users} u, {users_roles} ur, {role} r " .
"where u.uid=ur.uid and ur.rid=r.rid and r.name='doctor' and" .
"(u.name LIKE '%" . $keys . "%')";
$r = db_query($q);
while ($usr = db_fetch_object($r)) {
$results[] = array('link' => '?q=user/' . $usr->uid, // link to node for USER
'snippet' => '',
'title' => $usr->name
);
}
break;

case 'reset':
variable_del('node_cron_last');
break;

case 'status':
$results = array('remaining' => 0, 'total' => 0);
break;
}
return $results;
}

function doctors_search_item($item) {
$o.= '

database abstraction question

Hi,

I'm doing some code for a client. It's not drupal specific, it's dedicated code for a client website. However, in the future it may make sense to "wrap" the class in a drupal module if nothing like it comes along (or I don't find anything close to what it does).

However, the code I'm writing uses a database (obviously). What's the best way to make this "drupal compat" for the future?

All I can think of at the moment is something like :-

best way to create custom urls for user profiles (e.g. myspace.com/customname)?

i'm writing an advanced user profile module and i'd like for users to be able to specify in a field on their profile a custom name for the url in the same way that myspace do.

e.g. if my site was called domain.com and a user wanted his profile to be called "lookatme" whats the best way of aliasing his profile e.g. /profile/123 (where uid = 123) to domain.com/lookatme ?

custom editable page layout

I want to create a custom page layout where users will be able to update different sections of the page without changing the layout and design on the page - i've got a basic html page set up on my site that shows the layout i want to use:

www.interragate.info/countries/iran/

(I want the map and picture at the top of the content to only be editable by the administrator but the rest by the users)

Pages

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