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

What purpose does user_access() serve?

I am working on a module to add multiple superusers (as if multiple users had uid 1) to a Drupal site. But before I can start overriding functions, I need to know which ones to override and how to change them. For experimentation purposes, I am modifying core code to see if I can achieve what I'm trying to do.

This is a slightly modified version of user_access() from modules/user/user.module. In theory, it should allow uid 2 to have all the same permissions that uid 1 has, but it does not work.

Is this even the right function to be changing? Are there more than this that I need to change?

function user_access($string, $account = NULL) {
global $user;
static $perm = array();

if (is_null($account)) {
$account = $user;
}

// User #1 has all privileges:
if ($account->uid == 1) {
return TRUE;
}

// User #2 has all privileges: <<<< HERE IS MY CODE
if ($account->uid == 2) {
return TRUE;
}

// To reduce the number of SQL queries, we cache the user's permissions
// in a static variable.
if (!isset($perm[$account->uid])) {
$result = db_query("SELECT DISTINCT(p.perm) FROM {role} r INNER JOIN {permission} p ON p.rid = r.rid WHERE r.rid IN (%s)", implode(',', array_keys($account->roles)));

$perm[$account->uid] = '';
while ($row = db_fetch_object($result)) {

Stock Module

Hello,
I am trying to modify the stock module so that the portfolio is a bit better. Instead of it erasing ALL the saved stock symbols and then replacing them ALL when you try to add new ones, I've modified it so you can add one symbol at a time. Basically, in the database, the uid and symbol are primary keys, with each being one row in the database. I've also modified the module so that it can pull all the elements, and display their values in the portfolio. The next step is to allow the user to selectively remove stock symbols. I have added a remove button. The purpose of the remove button is to allow the user to remove one symbol, or possibly set of symbols, from their portfolio.

However, the remove button doesn't work. I have something of the form:
db_query("DELETE FROM {mystock} WHERE (uid = %d) and CONVERT(symbols USING utf8) = '%s'", $user->uid,"YHOO");

How to restrict access to group (profile field) without OG?

Hi all,
I don't want to use organic groups module just for restricting access rigths.
I need my users, beonging to a group, to have access to nodes created by other member of his group.

thinks for your answers.

Problem with special characters on the user profiles with Drupal 5.1 + c-panel

Hi,

I just had a strange problem with the real name of the user in the user profiles. When looking at the clients, the system stopped outputting the string containing the user real name if the string contained special characters like "ä" and "ö". The string was output correctly until that symbol, the platform in use was Drupal 5.1 with the installation done over c-panel.

In this case the solution was simple, I added the following line to the end of the index.php :

setlocale(LC_ALL, 'en_US.UTF-8');

metatag + cck

hi

we are using druapl4.7, we have installed and configured 'nodewords.module'.
while we have page source it will generate the metatag.
but the problem is that in the

page-content type:
it will have correct
in other created cck:
it will append 'content' word

please provide the information on this,how to resolve this issue.

service_links version 2 suggestions

I've started maintaining service_links module recently.
I'm receiving lot of requests for adding custom bookmark service providers. This make me think of service_links version 2 where we provide option to manage service links instead of hard coding them.
I now request your suggestions for the same.

--
Cheers,
Sivanandhan, P. (a.k.a. apsivam)
www.apsivam.in

Pages

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