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

Modify user_access function in the user.module

In the user.module, there is the user_access function to retrieve permissions for a user:

    $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)));

I am trying to replace it with this:

    $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(user_all_roles($account))));

user_all_roles($account) is supposed to return an array of roles which contains the values in $account->roles plus additional values if the context determines a group. I can't figure out a way to debug other than trial and error, and it appears that the roles from $account->roles aren't being returned.

I can't figure out why. I'm basically merging two arrays. Below is the code for user_all_roles(). Can anybody help? Thanks.

//
// This function takes the global $account value from user_access function and returns a list
// of group and non-group roles for this user
//
function user_all_roles($user) {

// This will be the process to get BOTH the group and non-group roles for a user

$uid = $user->uid;

$ogroles = array();
$x1 = 0;
//
// This will by default add the anonymous user. That way we know there is at least

drupal_set_message after form submit = crashed ?

I am upgrading a personal module to 4.7 and then i have a big problem to put a drupal_set_message in a *_submit function. I simplified my module to this grr.module.

And even with this simple module, all i get when i submit is a apache crash.

My configuration :
Drupal 4.7.3
WinXP SP1
EasyPhp 1.8.0.1 : Mysql 4.1.9, PHP 4.3.10, Apache 1.3.33

It drive me crazy tonight ... Can someone test this if he got the same probleme ?

Thanks for your help.

<?php

function grr_perm(){
return array('grr');
}

function grr_menu(){
$item = array();

$item[] = array('path' => 'grr',
'title' => 'Grr',
'callback' => '_grr_mail_new',
'access' => user_access('grr'),
);
$item[] = array('path' => 'grr/hello',
'title' => 'Hello',
'callback' => '_grr_hello',
'access' => user_access('grr'),
);

return $item;
}

function _grr_hello()
{
return 'Hello';
}

function _grr_mail_new($data=NULL)
{
$critere = array('1' => 'CP seulement','2' => 'Expert seulement','3' => 'CP et Expert');
$content ='';
$form['name'] = array(
'#type' => 'textfield',
'#title' => 'Nom de la nouvelle list',
'#default_value' => $data['name'],
'#size' => 60,
'#maxlength' => 255,
'#description' => NULL,
'#attributes' => NULL,
'#required' => TRUE,

Thumbnails IMCE

Hey there, hope this is in the right Forum. Anyhow, i would like all images put into TinyMCE by IMCE, to appear in the top left corner as a thumbnail, that when clicked would link to a full res picture. Any suggestions? Cheers Y'all.

Do we have anything like front_block (just like front_page)?

Do we have anything like front_block (just like front_page)? I just want one "extra" block for example "announcement" to be seen the first time a visitor comes in. Thereafter I don't want that block to be seen again. What's the best way to do it.

I know I could have two different page templates, one with that "extra" block and the other without that block. First could be the front_page and the second could be the main page. BUT I don't think that's an optimal way. Any suggestions.

thnx

ACH Payment Gateway

Just wanted to drop a post in to say I've developed an ecommerce payment gateway for the USA based ACH service.

It's not available publically yet, but if you would like to help test it on your site drop me an email via my contact form.

how do I debug: "mysql_real_escape_string() expects parameter 1 to be string" for views module?

I'm using the latest copies of views and cck.

I got this error
warning: mysql_real_escape_string() expects parameter 1 to be string, array given in /var/www/includes/database.mysql.inc on line 349.
warning: mysql_real_escape_string() expects parameter 1 to be string, array given in /var/www/includes/database.mysql.inc on line 349.

I had this problem before intermittently.

I did a little reading. It may have to do with multiple select check boxes.

Pages

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