1
iliakros
SmartSection category permissions deleted
  • 2009/11/4 8:32

  • iliakros

  • Just popping in

  • Posts: 21

  • Since: 2009/11/3


When adding a new category all the read permissions are deleted.

I found out that the problem only appears in XOOPS 233.
What really goes wrong is that the permissions are deleted by this query, because there is no categoryid. This means all permissions get deleted.

DELETE FROM group_permission WHERE (gperm_modid = '117' AND gperm_name = 'category_read')

However when I look to the code in /xoops/modules/smartsection/admin/category.php line 236, there is a categoryid send.

smartsection_saveCategory_Permissions($categoryObj->getGroups_read(), $categoryObj->categoryid(), 'category_read');

Somehow xoops233 is messing things up.

I am using SmartSection 2.14

Does anyone know how to fix this?

many thanks

2
ghia
Re: SmartSection category permissions deleted
  • 2009/11/4 9:09

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


Quote:
I found out that the problem only appears in XOOPS 233.
Which version of XOOPS did work?

3
iliakros
Re: SmartSection category permissions deleted
  • 2009/11/4 9:16

  • iliakros

  • Just popping in

  • Posts: 21

  • Since: 2009/11/3


With XOOPS version 2.0.16 it is working fine
I didn't test 2.2 versions

4
ghia
Re: SmartSection category permissions deleted
  • 2009/11/4 10:14

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


Could you put an
echo "category id |$categoryObj->categoryid()|"';
before line 236 to see what it says?

5
iliakros
Re: SmartSection category permissions deleted
  • 2009/11/4 10:23

  • iliakros

  • Just popping in

  • Posts: 21

  • Since: 2009/11/3


It says the following

category id |()|

and I have an error

Notice: Undefined property: SmartsectionCategory::$categoryid in file /modules/smartsection/admin/category.php line 236

6
ghia
Re: SmartSection category permissions deleted
  • 2009/11/4 10:32

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


OK, retry with
echo "category id |".$categoryObj->categoryid()."|";

7
iliakros
Re: SmartSection category permissions deleted
  • 2009/11/4 10:40

  • iliakros

  • Just popping in

  • Posts: 21

  • Since: 2009/11/3


Ok, now it says

category id |5|

I retried and now it says

category id ||

8
ghia
Re: SmartSection category permissions deleted
  • 2009/11/4 11:38

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


Humm, weird that it is not consistent.
However I'm puzzled by the end of the insert function in class/category.php
if ($category->isNew()) {
            
$category->assignVar('categoryid'$this->db->getInsertId());
        }
        
$category->assignVar('categoryid'$categoryid);
        return 
true;
When the category object is new then the autoincrement id is asked on MySQL. But then this is overwritten by the $categoryid variable, which is not defined.

Conclusion: it should never work.

How to repair?

You could assume that for an existing object the $categoryObj->categoryid() should be defined and then the last assign could be put in comment.
//        $category->assignVar('categoryid', $categoryid);

If it has some function, then it should be in an else
}
        else
        {
        
$category->assignVar('categoryid'$categoryid);
        }

or the if should set the variable.
$categoryid $this->db->getInsertId();


9
iliakros
Re: SmartSection category permissions deleted
  • 2009/11/4 11:48

  • iliakros

  • Just popping in

  • Posts: 21

  • Since: 2009/11/3


This solved the problem

Thank you very very much

10
ghia
Re: SmartSection category permissions deleted
  • 2009/11/4 11:55

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


Which modification did you implement?

Login

Who's Online

72 user(s) are online (52 user(s) are browsing Support Forums)


Members: 0


Guests: 72


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