Changing users_roles (user role) safely

Hi all,

I want to modify a user's role (preferably through the RID) using php-code on a page or as 'additional processing in a webform. I've been burrowing through many posts on the forum that _almost_ supply the answer to my 'challenge' but not quite. Installing Organic Groups, which is suggested to offer this functionality, is a bit of an overkill in my opinion (considering how many queries Drupal does already to load a page).

Trying a few options failed, using the 'official' way like user_save, module_invoke('user', 'save', ...) and a hook_user example. I ended up using the example below, which works. However, I feel that it's wrong to put a db_query into the page just like that!

So basically, my question is whether anyone feels like sharing their knowledge in making the below code 'safer' or at least moet universal. I'd like to use the available Drupal API/hooks/functions, but can't find a clear "this is how it works" description.

<?php
/** This script checks whether user is "group_a" or "group_b", both with specific limitations and if so, upgrades this user to "authenticated user" (RID=2). Includes a check to prevent admin user from accidentally being downgraded. **/

global $user;
$uid = $user->uid;
if (((in_array('group_a',$user->roles)) || (in_array('group_b',$user->roles))) && !($uid == '1')) {

how to stop 'This question has been moved' message appearing

I recently had cause to move some postings from one forum to another, but this leaves a link with the words 'this message has been moved'

normally very useful, but not in this case. how can I remove it.

drupal 4.7
forum module

thanks

James

HACKED !! HELP!!

HEllo guys,,

This is the 2nd time I'm getting hacked. First time the attacker placed an iframe line in my index.php.

I then removed the line, and changed all my passwords. Everything was cool for one week.

Now I'm getting it again. Virus warnings and the iframe is at the end of my HTML. Weird thing is,, I can't find the line in index.php nor my theme file. Where can I find the line in order to remove it ??

Easy way to create Digg Links?

Is there an easy way to post Digg and similar links in articles? I can't seem to get
the Digg and Technocraty modules to work.

png integration in ie

Hello,

I am using a .png-image in my theme, but older IE versions, aren't able to translate this image right. I've tried to integrate a ie-bug-fix, but I have to set the width and height attribute, which isn't possible as I have integrated the picture as background-image ...

do you know how to set this attributes, or how I am able to integrate this picture as "normal" image?

thanks,

Dani

Problem with Image Gallleries under 4.7.

Hi @ All,

I have a problem with my drupal website. It is side that allready exists longer and it is a manual chance in, that update to a newer version is not possible. It is Drupal 4.7, but I do not really know if it is 4.7.0 or 4.7.6. Because I did not put the system on unfortunately. Although there are 4 taxonomy moduls on it. (Taxonomy, Taxonomy_access, Taxonomy_menu and Taxonomy_redirect). It is not possible to put the system new on. I must to work with the exist system!

Now I want to have an Image Gallery at this side. I tried it first with the image gallery 2.2.1. But it do not work. I had the image gallery on it, but I couldn't do something. Then I deinstalled the gallery and tried it with the available image gallery, which comes with the image modul.
I can add an image gallery and when I add a gallery I can upload images in the same mask.
Under create content->image it is not possible to upload a picture in a gallery. So I tried to fix it with a guidance from DrupalCenter.de for this problem.

At first I create manuall vocabulary under categories but it does not fix my problem. So I tried to fix it with the hard version. I deactivate the image modul, delete all image tables in the database and upload the newest image modul, activate it and save the konfiguration form image.

But this although didn't fix my problem

Has anyone an idee ?

Pages

Subscribe with RSS Subscribe to RSS - Drupal 4.7.x