Page 2 of 3

Posted: Mon Jun 19, 2006 2:25 pm
by Lumpy
No problem. ;)

Please find below the link to the information you are looking for

http://bering-web.de/serendipity/upload ... tegory.JPG

Best regards,
Lumpy

Posted: Mon Jun 19, 2006 2:43 pm
by garvinhicking
Hi!

Oh, I'm really sorry. I now looked up the code, and this functionality only exists in Serendipity 1.1 versions. There you have a new dropdown option "Current Author" for the dropdown.

You should be able to just use that categories plugin from the 1.1 base and replace it with the code you have in your 1.0 version. Just replace the whole serendipity_categories_plugin class in your include/plugins_internal.inc.php with this code:

http://phpfi.com/124546

If that's too complicated (which I'm sorry for...), I suggest you to go with the HTML nugget approach. :-/

Best regards,
Garvin

Posted: Mon Jun 19, 2006 3:01 pm
by Lumpy
Implementing the new code snippet was very easy ;)

But unfortunately this does not seem to be the solution for this problem. As you can see in the following link I now have the option »CURRENT_AUTHOR« but the categories are still visible on the frontpage.

http://bering-web.de/serendipity/upload ... ry-new.JPG

Best regards
Lumpy

Posted: Mon Jun 19, 2006 3:21 pm
by garvinhicking
Hi!

Ah, I see. The code would only work if the viewing author was logged in. For non-logged in authors it returns "0" and thus shows all categories.

This patch should do the trick:

Replace

Code: Select all

        if ($which_category === "login") {
            $which_category = (int)$serendipity['authorid'];
        }
with:

Code: Select all

        if ($which_category === "login") {
            $which_category = (int)$serendipity['authorid'];
            if ($which_category === 0) {
                $which_category = -1; // Set to -1 for anonymous authors to get a proper match.
            }
        }
HTH,
Garvin

Posted: Mon Jun 19, 2006 3:34 pm
by Lumpy
Hi Garvin,

that is a step forward. Now I can only see the categories when I'm logged in. If I'm not logged I cannot see any category although I can see the entries from a category which everyone can read. The entries from a category which Administrators can access only are hidden correctly.

Best regards and thanks for your quick replies
Lumpy

Posted: Mon Jun 19, 2006 7:06 pm
by garvinhicking
Hi!

That's great, I'll commit this fix then!

Best regards,
Garvin

Posted: Mon Jun 19, 2006 7:19 pm
by Lumpy
Hi Garvin,

I think there is a misunderstanding. Although it is a step forward I don't think it is the final solution. The problem is that when I'm not logged in I cannot see any category although I should see the category which everyone should see.

Example:
Category
IT permissions: read:everyone write:Administrators
Super permissions: read:Administrators write:Administrators
--Unter1 permissions: read:Administrators write:Administrators

When I'm not logged in I cannot see any category but I can read the entries from »IT«. Logged in I can see all categories and all entries.

Hopefully this explains what I mean.

Best regards
Lumpy

Posted: Mon Jun 19, 2006 7:37 pm
by garvinhicking
Hi!

Oh, okay, then it was indeed a misunderstanding. Do you have phpMYAdmin access? Could you give me the dump of your serendipity_categories table? I'D like to see what the "authorid" is set to in your categories...

regards,
garvin

Posted: Mon Jun 19, 2006 7:43 pm
by Lumpy
Hi,

no problem. Please find below the link to the properties of the different entries in the table »serendipity_category«.

http://bering-web.de/serendipity/uploads/categoryid.jpg

If you need any further information, just let me know.

Best regards,
Lumpy

Posted: Mon Jun 19, 2006 7:46 pm
by garvinhicking
Hi!

Hm, strange. The authorids of the categories that are for "All authors" should be "0" instead of "1".

I'll try to investigate the code why this is so.

Regards,
Garvin

Posted: Mon Jun 19, 2006 8:06 pm
by Lumpy
Your conclusion is absolutely correct. I simply changed the »authorid« for the category which should be visible to »All Authors« from »1« to »0« and then all categories and entries were displayed as expected.

Hope this helps a little bit.

Best regards

Posted: Tue Jun 20, 2006 10:47 am
by garvinhicking
Hi!

I had a look in the code; the "authorid" is set to "0" only if the "Write" permission to a category includes the "All Authors" information. Does your public category have that, or did it only set the read-access to "All Authors"?

Best regards,
Garvin

Posted: Tue Jun 20, 2006 11:16 am
by Lumpy
Hi,

unfortunately the public category is set to

Read permission: All Authors
Write permission: Administrators

So this does not seem to be the reason for this effect.

Best regards
Lumpy

Posted: Tue Jun 20, 2006 11:23 am
by garvinhicking
Hi!

No, that's exactly what I mean! If you set both to "All Authors" it should show up like you wanted in the category section there.

However of course it might not be what you want, that all authors can write into that category, so I consider this not to be a final solution. The problem is that the category fetching code is also used when we fetch the list of categories one can write into - this is why the "authorid" of a category is set of the "owner" of a category. It is only set to "0" if all authors can write into that category.

It seems that the only way to show a read-based category list on the frontend is to make a manual plugin or modify the plugin code some more to make a distinction between the different category fetch happenings.

Will try to do that now.

Regards,
Garvin

Posted: Tue Jun 20, 2006 11:40 am
by garvinhicking
Hi!

I think I've fixed it:

http://svn.berlios.de/viewcvs/serendipi ... 0&view=rev

Regards,
Garvin