Deleting a post in Drupal forum messes up the numbering - drupal

I am subscribed to a Drupal 5 site with the Advanced Forum module. When a user decides to delete her post, the post dissappears and the following posts are moved up.
So if #2 is deleted the existing #3 will become #2 and so forth. The problem with this is if people reference previous posts which are now incorrectly numbered. Consequently it can lead to much confusion or even make people angry because they feel a comment is not appropriate - which it isn't after all!
What we would like is that the deleted post is simply removed without renumbering the rest. There is no option for this in the settings, so I will most likely have to mod the files.
Do you know if there already exists a patch to accomplish this, or can you alternatively point to where I need to modify the code?
I am a experienced PHP developer, but Drupal is new to me.

Possible workaround would be to set status field in comment table to 0, instead of deleting the comment. THat way it would not appear in comment list and other cid's would not be changed. You could do this in a custom module with a hook but I am not sure what hook calls comment_delete, normally you would override hook_nodeapi
but comments if I remember correctly may be handled differently than nodes.
Look in the comment module under /modules and check out from what hook comment_delete is called and override that in a custom module, that way you would not have to hack any core code.
Good-luck

Related

How to replace plugins in wordpress?

I am working on a website built on wordpress in which I want to replace some plugins. The reason behind the replacement of those plugins as it is no longer developed. The most important plugin which I want to replace is Accordion Shortcodes.
From the tutorial mentioned here,
Accordion Shortcodes is a simple plugin that adds a few shortcodes for adding accordion drop-downs to your pages.
The accordions should blend seamlessly with your theme. However, you may want to edit your theme’s main stylesheet in order to add some custom styling (see below for sample CSS).
Problem Statement:
I am wondering what best practice I need to follow in order to replace a plugin in wordpress. Also, what would be the best replacement for Accordion Shortcodes, Modify Attachments Meta ?
John, Your title says "How' and the above two answers describe "how". However reading the text implies you want people to tell what plugins are best to replace your existing plugins with. As the comment says, plugins do not always 'replace' each other exactly and may have many more features. Judging by the names of the plugins, I think you need to understand why and how those plugins are being used. An approach:
Discuss with the site owner what features they care about and what are 'nice to have'. They may not know which plugins are delivering which aspects of the website, so very important to know what are the absolutely important aspects. They may no longer need some of those plugins (eg: Modify Attachments Meta? might be a tool used to do something and no longer needed?)
Assess what features are being delivered by each of the outdated plugins, and which are important or non essential.
Research for alternate plugins that provide the features that are important
Review the best candidates and test them on test copy of main site.
Work out what if any conversion may be required. EG: if's access control, how is it doing the access control? how would you convert that?
Test the conversion, test the new plugins on converted data.
You can simple deactivate plugin and then remove the plugin.
Here is a plugin suggestion
https://wordpress.org/plugins/accordions/
You can use this plugin instead of that outdated version of the Accordion Shortocdes plugin.
Please let me know it helps to you.
Here's how I like to go about replacing plugins:
Identify any shortcodes it provides, and search your database (via either PhpMyAdmin, or a database search plugin like Better Search Replace) for that shortcode. This will identify all the posts & pages you'll probably need to update.
Save any custom CSS or other configuration data that might be relevant to the replacement.
Assuming there's no conflict between the old plugin and new one, install & activate the new plugin. Then you can begin replacing the usages of the old plugin one by one (and modifying the configuration of the new plugin to get it "just right").
After you've done all the replacements (which you might want to verify by another database search), deactivate and remove the old plugin.
This is how I do plugin migrations. In your case, in step 3, you could probably install each of the plugins you're considering, try them out, and only do the full migration for the one you like best.

Drupal know from where things are showed

I have a strange question but I don't find any hint about that (if it's possible), for a drupal 7 website I have to modify some content of a page in the backoffice, but I really don't know from where some content of this page is created (a table, similar to a view table but not a view table).
I just want to know if there is any way to show which php function the page use to finally be showed. I know there is something like that for the theme (drupal theme debug) but I don't find something for my case.
Any idea ?
You need PHP profiler to check all functions called on page, there's a module for Drupal7 for XHProf integration. But I would suggest you to use your browsers inspector as mentioned by 2pha before. For example if there's a form on the page just use the form ID to find it. Custom classes are very useful in these cases, parts of the html codes etc. In your case search for table headers...
The code you are looking for is most probably in custom modules and the
general suggestion is to keep you custom modules in separated folder from contributed ones.

Cannot edit first post in a Drupal forum thread

In a Drupal 6 (core) forum, when I post something, I can afterwards edit it, unless someone replies on my post creating a thread. In that case the option to edit my original post does not appear at all.
Can I override this behavior? I'd like to be able to edit my posts/comments where ever they appear, even inside a thread.
This is checked in http://api.drupal.org/api/drupal/modules--comment--comment.module/function/comment_access/6, it looks like that check has been removed in D7 (the documentation hasn't been updated to reflect that, though).
I guess you could implement hook_links on your own and then add the link yourself. See http://api.drupal.org/api/drupal/modules--comment--comment.module/function/comment_links/6.
The more complicated one to override will probably be http://api.drupal.org/api/drupal/modules--comment--comment.pages.inc/function/comment_edit/6, you could use hook_menu_alter probably.

Commenting systems: loading different comment threads through callbacks

I'm looking for a commenting system with a specific feature, and I wondered if anyone could advise.
I want to be able to load different comment threads without reloading the entire page, via JavaScript callbacks. That means I need a commenting system that allows multiple comment threads to be associated with the same URL, with threads defined by custom IDs.
I've just found out this isn't possible with Disqus. Although Disqus does allow you to associate a unique ID of your choice with a thread, it also requires a unique URL for each comment thread.
Does anyone know a system that does offer the ability to associate multiple comment threads with the same URL, via unique IDs?
Not sure if it's possible with either IntenseDebate or Wordpress - or maybe I need to write a custom Wordpress plugin (the page itself will actually be within a Wordpress install).
You should have no problems creating you own custom comment page by 'hacking' comments.php.
By using jQuery and jQuery.load you can call a php page where you have code to retrieve custom comments.
But messing about comments.php is not that easy. Therefore this page might help you get an insight in comments.php
This answer doesn't solve you problem, but hopefully it'll give you some ideas.

How can other users be updated when a comment is posted, other than the author in wordpress?

We have a wordpress setup, with a closed user group (ie one cannot create a login for himself). Whenever I write a blog & comments are posted to it, I get updated over mail. But, how to make sure to update other users also.
I would try a Wordpress subscription plugin. The most well known plugin for this is called Subscribe2. I think it works for registered users. If not, browse Wordpress's Extend page for a similar one. I suppose solving your problem like this doesn't make it much of a programming problem, but why re-write code?
Subscribe2
The one I have used is Subscribe to Comments and it has worked great. Others include Subscribe to Comments Now! and the one Chet mentioned, Subscribe2. Subscribe2 seems to have the best admin interface out of the three, I think I might try that one.

Resources