Forums | Mahara Community

Mahara/Moodle integration /
Don't allow users to create Groups


anonymous profile picture
Account deleted
Posts: 8

21 May 2009, 13:49

Hi all,

is there a way for preventing users of create Groups? For our institution, would be interesting that this privilege is allowed just for admin.

 

Thanks.

Cassia.

Heinz Krettek's profile picture
Posts: 480

21 May 2009, 14:27

Hi Cassia,

greetings from The Black Forest ;-)

I think your question has been posted here in the forums a while ago. http://mahara.org/node/450

You need a modification of code and use a check like "if user=admin allow to create groups"

HTH Heinz

anonymous profile picture
Account deleted
Posts: 8

22 May 2009, 13:19

Hi Heinz,

thanks the answer! I think my post is not in the right place, maybe it should be in Support forum, but as I started here, I'll continue.

I'm not familiar with PHP programming and Mahara development, so please, could anyone provide me specifically the source code and place where I have to change the code?

Best regards, Cassia. 
anonymous profile picture
Account deleted
Posts: 338

25 May 2009, 4:01

Hello Cassia,

Try this:

 In the create.php file that Heinz has mentioned, after the line    global $SESSION; add the followin:

if (!$USER->get('admin') || !$USER->get('staff')) {

    echo 'You are not allow to create groups';

break;

 

}

 

 Regards

anonymous profile picture
Account deleted
Posts: 1643

25 May 2009, 19:01

Hi - try using die_info('You are not allowed to create groups'); as it will produce a nicer error page. And that 'break' will cause a syntax error, if you switch to die_info() you won't need it Smile
anonymous profile picture
Account deleted
Posts: 8

26 May 2009, 12:59

Thanks a lot. It worked. Regards.
anonymous profile picture
Account deleted
Posts: 90

27 May 2009, 7:07

I think that the correct sintaxis is:
if (!$USER->get('admin') && !$USER->get('staff')) {
that means if you aren't admin or aren't staff, you can't create groups

with
if (!$USER->get('admin') || !$USER->get('staff')) {
sintaxis, you must be admin and be staff, both roles, to create groups.
Is this that what we want?

Bye
anonymous profile picture
Account deleted
Posts: 338

27 May 2009, 8:36

Hello Antonio,

Yes,  your expression will work definitively, while, in my mine, if the user is just staff and not administrator, 

!$USER->get('admin') will return true, and therefore, the condition will be fulfilled and the  code would break there.

Thanks for spotting it!

8 results