1
jlm69
adding group perms, need help
  • 2005/8/2 14:39

  • jlm69

  • Module Developer

  • Posts: 719

  • Since: 2002/7/19


I have added group permissions to the jobs module. The code I am using comes from pical .08 and it uses an array to give add, approve etc. I only need add permissions. The code I am using is below:

$item_list = array(
'1' => _AM_GPERM_G_ADD ,
'2' => _AM_GPERM_G_APPROVE ,
) ;

$form = new MyXoopsGroupPermForm( _AM_GROUPPERM , $xoopsModule->mid() , 'jobs_submit' , _AM_GROUPPERMDESC ) ;
foreach( $item_list as $item_id => $item_name) {
$form->addItem( $item_id , $item_name ) ;
}


This code works, but I don't want approve permissions, if I remove '2' => _AM_GPERM_G_APPROVE , I get errors about the foreach. Is there a way to just have add permissions.

Thanks in advance,
John

2
dheltzel
Re: adding group perms, need help
  • 2005/8/2 14:53

  • dheltzel

  • Not too shy to talk

  • Posts: 164

  • Since: 2003/1/8 1


If you only have 1 item, creating the array and then looping through it is kind of silly, so change this:

$item_list = array(
'1' => _AM_GPERM_G_ADD ,
'2' => _AM_GPERM_G_APPROVE ,
) ;

$form = new MyXoopsGroupPermForm( _AM_GROUPPERM , $xoopsModule->mid() , 'jobs_submit' , _AM_GROUPPERMDESC ) ;
foreach( $item_list as $item_id => $item_name) {
$form->addItem( $item_id , $item_name ) ;
}


To this:

$form = new MyXoopsGroupPermForm( _AM_GROUPPERM , $xoopsModule->mid() , 'jobs_submit' , _AM_GROUPPERMDESC ) ;
form->addItem( '1', _AM_GPERM_G_ADD) ;
The software industry is the only industry where selling goods known to be defective is perfectly legal, and then you can charge extra for fixing the defects.

3
jlm69
Re: adding group perms, need help
  • 2005/8/2 15:21

  • jlm69

  • Module Developer

  • Posts: 719

  • Since: 2002/7/19


Thanks for the quick reply, but I get this error with that code.

Parse error: parse error, unexpected T_OBJECT_OPERATOR in /home/jlmzone/public_html/xoops/modules/jobs/admin/groupperm.php on line 34


line 34 is

form->addItem( '1', _AM_GPERM_G_ADD) ;


I have been trying all different things to get out of the array but nothing so far has worked.

Thanks again,
John

4
jlm69
Re: adding group perms, need help
  • 2005/8/2 15:31

  • jlm69

  • Module Developer

  • Posts: 719

  • Since: 2002/7/19


I found it, line 34 needed to start with $. Thanks alot this saved me lots of time.

Login

Who's Online

161 user(s) are online (110 user(s) are browsing Support Forums)


Members: 0


Guests: 161


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits