Recent Topics

1 Jan 13, 2009 10:56    

My b2evolution Version: 2.x

Hello.

I'd like to add a new comment status. It appears that adding it just to T_comments is insufficient.

Where else must it be added so that it is recognized whenever used?

Thanks in advance.

2 Jan 13, 2009 15:35

I'm guessing that the path you took to add a new post status would probably be a good one to replicate ;)

¥

3 Jan 14, 2009 01:07

Thanks for your reply, ¥åßßå.

I was hoping there was some type of schematic available somewhere because as I was getting into adding the status pertaining to T_comments, I see they have the same starting status values of T_item_items. That means, I may have to go back through all of the changes I made during that for post_status and be sure that none actually pertained to comments. That would be somewhat time-consuming and I hope to avoid it.

I've seen over the years that some software provides that info and am hoping b2evo has that, too.

Thanks again.

EDIT: One item that is a bit confusing is in trackback.php which uses the var 'comment_status' for 'open' versus say, 'published' or 'draft' as that in T_comments as used in '_comments.ctrl.php'.

4 Jan 14, 2009 09:21

Comment statuses and item statuses are different beasts, so your previous hacks shouldn't affect them, but it should give you an idea of which comment files to look in as it'll be a very similar process.

What's the new status you're trying to add ( and why ) ?

¥

5 Jan 14, 2009 09:39

Thanks ¥åßßå.

What I did was edit 'T_comments' and '_comment.funcs.php.' I believe that would be enough besides the file I'm using to house the new routine.

One item that was a bit confusing was in trackback.php which uses the var 'comment_status' for 'open' status versus say, 'published' or 'draft' as that defined in 'T_comments' and as used in '_comments.ctrl.php'. At first glance, it would appear that statement in trackback.php is a bug, otherwise the 'comment_status' param is being defined for two difference situations.

With that said, the feature I'm adding is to document (record) all trackbacks that are sent to external servers for all blogs on my server. In order to to maintain the right 'bookkeeping', I decided to use a status that distinguishes those records from all others.

Thanks again.

6 Jan 14, 2009 10:01

comment_status in trackbacks references whether comments are open / closed / disabled ;)

you do realise that trackbacks aren't sent by comments ?

¥

7 Jan 14, 2009 10:14

Hi. Yes, I realize that trackbacks aren't sent by comments - I'm just recording them in T_comments as though the trackback was sent to an internal server blog. It's only for recordkeeping purposes.

I'll have to go back an look but the confusing issue is that trackback.php uses 'comment_status' as e.g. 'open' but in '_comment.funcs.php' it has trackback statuses as 'published', etc. and in normal b2evo operation, trackback is recorded in the database as 'published', 'draft', etc.

Do you know why the difference - why both are using the same nomenclature?

As soon as I complete the edits, I'll test it more completely.

Thanks.

8 Jan 14, 2009 11:16

They're checking to completely different things.

One is checking if the post has a comments status of "open / closed / disabled"
The other is checking the status of a comment that has been made ( draft / published / deprecated )

You really don't need to hack the core to add a new status, just create a plugin that hooks into AfterItemInsert/Create and then record the details in its own table .... it's less pain in the long run.

As an aside, 2.4.6 has been released ;)

¥

9 Jan 14, 2009 11:35

¥åßßå wrote:

They're checking to completely different things.

One is checking if the post has a comments status of "open / closed / disabled"
The other is checking the status of a comment that has been made ( draft / published / deprecated )

Thanks for the clarity, ¥åßßå.

¥åßßå wrote:

You really don't need to hack the core to add a new status, just create a plugin that hooks into AfterItemInsert/Create and then record the details in its own table .... it's less pain in the long run.

I saw your reply to the post regarding hooks for hacks. I haven't gotten to it yet so what you've suggested here is very much over my head. Once I have the logic doing it the 'old-fashioned way,' I plan to go back and undo the core hacks and utilize the hooks. Once I'm comfortable this v.2.4.5 is working correctly, I'll adapt them to v.2.4.6 as needed. For this particular hack, I'm adding it in '_trackback.funcs.php' in case '0'. What I just ran into is the new T_comments status is causing an error in Posts/Comments=>Post List tab and Full Posts tab. I'm looking to find where/how it is getting its info from T_comments.

¥åßßå wrote:

As an aside, 2.4.6 has been released ;)

¥

That's great! As soon as I get past this, I am anxious to see what this version has to offer. I bet it's nice as I'm enjoying what v.2.4.5 has to offer.

Thanks again.

10 Jan 14, 2009 16:36

It'd take a shedload less code/time to make it a plugin ;)

¥

11 Jan 14, 2009 21:05

Thanks ¥åßßå.

This particular hack is 98+% complete. I'll try to look at the plugins route if I have another routine to add after this.

Thanks again.


Form is loading...