I broke categories

I seem to have broke my category thingy.  I am trying to track down on what I may have changed to cause this behaviour and could use some input on this.

When members upload content and select a category, it adds that category to the list of categories in the sys_categories table and if I go to the backend, I have the same category repeating itself the number of times that content has been uploaded.  For example, if I have a category, "Mountains", I will see,

Mountains

Mountains

Mountains

Mountains

and this goes on for the number of, say photos, that some member set to "Mountains".  It is the same for other modules as well, it is in the category part.

I did add Modzzz category by Admins only mod:

// prevent users from adding categories
                'attrs' => array(
                'add_other' => false
                ),

The drop-down list of categories are not showing the extra categories.  Any idea folks?

Geeks, making the world a better place
Quote · 24 Jul 2013

Yup, and my facebook connect module also does it. It imports all photos from facebook using the category Facebook Member Photos. And there is a separate entry for the category for each and every photo uploaded. I discovered this a couple of years ago and determined it was normal, and could not figure out why it's done that way.

https://www.deanbassett.com
Quote · 24 Jul 2013

I am not seeing this on the first site I built.  I have not updated that site all the way, it is somewhere between 7.1.1 and 7.1.2 I am guessing.

However, I am seeing this for a new site I am helping to set up.  I have made some modifications to the files but probably not nearly as much as I have done to the first site I built.

The first site has the Modzzz modification for categories as well.  It has to be tied to members creating new categories; which should have been able to switch on and off from the backend.  I did not want members creating thousands of categories over the years; what a nightmare that could become.

Geeks, making the world a better place
Quote · 24 Jul 2013

Don't know what to tell you. I have always had this problem. Mostly occurs when members upload photos and entering their own catagory.

https://www.deanbassett.com
Quote · 24 Jul 2013

Sounds like a job for cron and a handy utility nightly.  lol

Have it scan the categories table and delete the duplicates?

http://www.mytikibar.com
Quote · 24 Jul 2013

It is sort of strange that these "added" duplicate categories don't show in the drop-down list.

The table does show the owner as the member that added the photo or video.

Currently we have videos and photos module installed.  It occurs in both of them, it is not related to those modules but when it is passed off to the script that handles the category part.  I have not made many changes with the category.  Mainly to just not allow members to add to categories.  I could try removing Modzzz's changes and see if it stops.  Could be a Boonex change in the scripts is affecting Modzzz's simple block on members adding new categories. 

I would like to know the answer here to what is happening because I have plans to upgrade my site files and I don't want this mess to pop up there.

Geeks, making the world a better place
Quote · 24 Jul 2013

 

Sounds like a job for cron and a handy utility nightly.  lol

Have it scan the categories table and delete the duplicates?

Yes, that is a solution.  However, it is sort of like:

Patient: "Doctor, it hurts when I do this."

Doctor: "Then don't do that."

LOL

Geeks, making the world a better place
Quote · 24 Jul 2013

As I think about this, it is obvious that the category script is seeing this as a member creating a new category.  Modzzz's hack simply removes the display of "add new" from the member.  The script can still create a new category.  Why it is seeing it should create a new category I don't know yet.  This could be happening to others and they have just never seen it or it could be that I broke it.

Evidently it does not check to see that the category exists, the category title is not unique and evidently you could have members creating the same category normally; or so I suspect.  I guess Boonex did not think that someone would try to create a new category that already exists.  What I am thinking is to set the category title field to unique and then see what the bozo checker does.  I have a test site set up where I can do this and not worry about members encountering anything they don't understand.

Geeks, making the world a better place
Quote · 24 Jul 2013

I went into the database and removed the member added categories from sys_categories.  When I logged into the site and went to categories in the backend, I noticed some of the duplicates were not removed; it seems that some of the duplicates are owned by 0.

I selected the duplicates in the backend and got the following error message in my log:

Query:

DELETE FROM `sys_categories` WHERE `Category` = 'Mountains ' AND `ID` =  AND `Type` = ''

Called '*query*' function with erroneous argument #*0*.

Curious.

Geeks, making the world a better place
Quote · 24 Jul 2013

 So how did you resolve your problem? Or your work around?

Don't know what to tell you. I have always had this problem. Mostly occurs when members upload photos and entering their own catagory.

 Alex T, can we get a helping hand with this?

Ultra Newb reporting for duty.
Quote · 24 Jul 2013

Last time i tried that, all of the photos that were placed in that category were no longer in that category.

From what i can figure out, it seems that instead of assigning a category id to the item like a photo, the photos id is listed in the categories table instead.

It actually makes sense to me now because having them all in one table makes searching for what items have been assigned to one category easier.

All my tests so far show this is how it is suppose to work.

https://www.deanbassett.com
Quote · 24 Jul 2013

Yes, Dean, I just figured out how the category table, sys_categories works.  It would be nice to have some documentation on the Dolphin Database Structure to help save someone from wasting time.  If that documentation exists, I would love to see it.

From what I understand, the sys_categories table serves two purposes, one is to hold the site categories and the other is to track which categories have been assigned.  I assumed this was in another table.  The list of categories for the site is held by owner 0, the Dolphin system with ID 0.  Other entries in the table will have as owner, the member that created the content and assigned a category and the ID set to the content ID.

Now that I understand this, it makes sense to me.  Here is a screenshot from sys_categories that shows member added content.

 

However, I still seem to have a problem.  What created the new categories for the system that I can not delete from the backend?

sys_categories.jpg · 445.2K · 276 views
Geeks, making the world a better place
Quote · 24 Jul 2013
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.