Cannot edit first post in a Drupal forum thread - drupal

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.

Related

Customize a file in wp-includes will be lost when Wordpress is updated?

I would like to ask if my modification in wp-includes/widgets/class-wp-widget-rss.php will be lost when Wordpress is updated?
I am trying to remove the RSS icon, it works now but I wonder if it is overrided with Wordpress Update.
Thank you,
J Dang
Never make any modification on core files, they will be erase with any WordPress update.
Filters and actions are here to change behaviour without editing core.
In your case, I think it's better to 'extend' the class wp-widget-rss.
You could find here, the way to extend the widget class, I think the same method can be use for the one you want to modify.
Hope it helps!

Deleting a post in Drupal forum messes up the numbering

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

Drupal Hooks (hook_form_alter)

I’ve a question about Hooks. Being kind of new to Drupal I haven’t had much experience with hooks but a friend of mine suggested to get familiar with it and learn it to solve one of my problems on my site.
The thing is, that I have a module fbconnect which I use for users to connect via Facebook and use their profile picture at Facebook, on my site.
Everything is working, I’ve two checkboxes which and the connection and profile images works quite well but the problem is that above the two checkboxes I want a descriptive text to appear.
The only way I so far have to put in this text is to create a “description” field to the first checkbox. Unfortunately, it chooses to display this text beneath the checkbox so now it look kind of strange with a checkbox, a 3-4 lines descriptive text to the entire Facebook function, and then another checkbox.
If hooks are the right way to go to solve this problem, how do I actually do it and where do I actually insert the hook? I can imagine that it is the hook_form_alter function I need to have and in my fbconnect module the function fbconnect_form_alter exists but where I go from here I really have no idea.
I’ve tried to read up and see some instruction videos about hooks but I’m still puzzled about this apparently very nice feature in Drupal.
I'm using Drupal 6 for this site.
Any help or advice would be very much appreciated.
It sounds like you might also need to look at the Theme system in Drupal. In particular, take a look at theme_checkbox. From glancing at the code, there seems to be a label that is rendered after the actual checkbox. In your custom theme function or theme file you can try changing the order of the two.
In drupal, a "hook" is the way to interact with some piece of code.
In you have a hook_bar() hook, and is your module named 'foo' implements foo_bar(), then this function is executed.
In your case, you'll need to create a module, and impletements hook_form_alter()
You can find a tutorial there that show you how to add a checkbox. If you need to add some text, you can use the same method, except instead of adding a checkbox, of course, you just add a textfield
Here is an awesome beginner's video about adding custom hooks with the example of hook_form_alter from Drupalcon Chicago 2011 which is perfect for this situation and will hopefully help you in this. As a newbie to Drupal it surely helped me and I would highly recommend watching other videos. Thanks to the drupal community for posting these.
http://chicago2011.drupal.org/sessions/introduction-module-development

How to change "site_name" in Drupal 6

This is probably a really obvious question, but it's driving me nuts.
We have a drupal installation and we need to change the site_name and site_slogan variables. It sounds like it should be easy, but I just can't find an option anywhere in the admin panels to do it. The only place I can find is in the initial installation script
I know I can write some code to call variable_set('site_name',...) to do it, but that seems like a last-ditch solution; I'd rather do it the correct way.
Can anyone point me in the right direction?
Thanks.
The form to change it is at site information: admin/settings/site-information.
If you want to do it directly in the Database there is a table called variable. You can change it in there. In Drupal 6 this value is of type longtext, but in Drupal 7 this value is of type blob. It is serialized so you cannot simply write to it with an update query, and expect it to work.
I have some code here that shows how to write to it.
http://www.siteconsortium.com/h/p1.php?id=drpl001
Also, if you are using Drupal 7 it shows how to go to the configuration settings and modify the site_name and site_mail variables.
Don't forget to clear the caches if you have caching setup.
It seems that you have to edit sites/default/settings.php:
http://mblog.lib.umich.edu/DataDiscussions/archives/2009/10/change_the_site.html
It answers the slogan thingy also.
Since I'm not using drupal anymore, you have to verify it by yourself :-)
Greetings

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