Forum

Thread tagged as: Problem, Blog

Blog posts to categories, ticks gone?

We just updated from CMS 2.7.10 to 2.8.3 and updated the Blog as well. Under Blog, we see the list of Categories, but previous Blog posts now no longer have ANY categories ticked? However, in the DB "perch2_blog_posts_to_categories" shows various Blog posts to different categories.

Aside from the new Category template change we made, is there something else to change to get old posts and category selections matching up again?

Thanks.

Running:

Perch: 2.8.3 PHP: 5.4.38 MySQL: mysqlnd 5.0.10 - 20111026 - $Id: c85105d7c6f7d70d609bb4c000257868a40840ab $, with PDO Server OS: Linux, cgi-fcgi Installed apps: content (2.8.3), assets (2.8.3), categories (2.8.3), perch_blog (4.6), perch_gallery (2.8.5)

Stuart Farrell

Stuart Farrell 0 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Which version of Blog did you upgrade from?

Upgraded Blog from version 4.0.3

Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok, quite a jump. Did you follow the upgrade notes for Blog?

I added the category code into post, and copied over the category templates, I saw the other notes on change any category display, but this issue is in the CMS itself... The categories display as per Category section and the DB has the old info still.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Do you have the Blog set listed in the Categories app?

Yes. I can see the categories listed out under the set "Blog" under Categories App - as per before.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok, and you're using that set in your template?

Yep.

<perch:categories id="categories" set="blog" label="Categories" display-as="checkboxes">
    <a href="archive.php?cat=<perch:category id="catSlug" type="slug" />">
        <perch:category id="catTitle" type="text" />
    </a>
</perch:categories>

Is this set template correct?

<perch:categories id="setTitle" type="smarttext" label="Title" required="true" />
<perch:categories id="setSlug" type="slug" for="setTitle" label="Slug" />
Drew McLellan

Drew McLellan 2638 points
Perch Support

That looks correct. Was it in place when you ran the update?

Category code was added to post as per instruction AFTER install.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok. That all sounds like it's fine.

Can you try running the blog update?

/perch/addons/apps/perch_blog/update

Ran the Blog update... no change. Logged out and in again, still no change.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Do the categories display on your site?

No, this shows nothing:

<?php perch_blog_categories(); ?>

This is the category template:

<perch:before><ul></perch:before>
    <li>
        <a href="archive.php?cat=<perch:category id="catSlug" type="slug" for="catTitle" order="2" />">
            <perch:category id="catTitle" type="smarttext" label="Title" required="true" order="1" />
        </a>
    </li>
<perch:after></ul></perch:after>
Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok. I don't know what the state of your install is. Probably the best thing to do is revert your database to your pre-update backup and then let the update run again. This time note any errors or messages you get.

For the core or just the Blog app? I think it's going to be easier to just re-tick all the blog entries for the categories associated... I will try that on one and see if it shows up.

OK, so ticking a category for a post and it now shows.

So the past post entries listed in "perch2_blog_posts_to_categories" by ID and Cat ID are no longer being matched/read/used... The NEW post we ticked to a category is NOT saved in this table. This would explain why these old ones are no longer showing up...

Posts ticked to a category seem to be appended to postDynamicFields in Post itself - I can't find it recorded anywhere else.

"categories":["6"]

Perhaps a patch is needed for Blog to convert this?

Drew McLellan

Drew McLellan 2638 points
Perch Support

No, that is correct. I don't have an explanation for why yours didn't work when everyone else's has.

It's correct that it is no longer saving into or reading from blog_posts_to_categories?

Is it possible to run an SQL query to run to copy all the old category entries and append to postDynamicFields?