Drupal and Comment Form - drupal

I need to insert the comment form directly to the node template (I use node-type.tpl.php to theme the node-type).
In related issue, if I go to /comment/reply/NID I get the comment form, but it's got only "preview" button, and no submit button. the Preview button does nothing when pressed on.
Thanks for the help!

Check your node-type comment settings under 'admin/content/node-type/yourNodeType'. Within the (normally collapsed) fieldset for the comment options, you can choose whether to display the comment form on a separate page or on the same page as the node.
As for the missing submit button, you can change the setting for 'comment preview' from mandatory to optional.
As for the preview button doing nothing, this sounds strange and I have no idea what might cause this - pressing it would normally lead to a preview of the entered comment, with the option to finally submit it. If this problem persists, you should open a separate question for that.

Comment form is not in scope in node-type.tpl.php. Technically you could add it there trough variable preprocessing. But that will introduce a whole new set of problems.
So, unfortunately, you will need to do a step back, and theme the comment-form elsewhere.
node
node-content
comment-form
comments
is not possible
node
node-content
comment-wrapper
comment-form
comments
however, is the way to go.
see http://api.drupal.org/api/drupal/modules--comment--comment-wrapper.tpl.php
for a starter

Related

Wordpress ACF fields disappeared

I have been working with wp for a while now but just ran into a bug, that I can not fix with the information found in the internet.
I was editing a acf field. When I was finished writing into one of the fields, I mistakenly pressed enter. The page started reloading and all fields were gone. When going to the frontend, everything is displayed properly.
I tried to reactivate my ACF fields via the screen options what did not work. I inserted some code lines into my functions.php. or into the input.css because I thought maybe the right checkbox for the ACF fields to be displayed was missing. Nothing helped. Is there any other way to fix this issue.
thx in advance
greetings
I just come through this problem : for one of my field group, the fields box just disappeared at some point and I had no way no retrieve it thanks to the Wordpress Admin interface.
I don't know the reason why, but it appears that in my case, ACF registered some "unwanted" user meta in my database. (how is the question)
If you look inside your DB at the usermeta table content you will probably find some ACF entries like : metaboxhidden_acf-field-group or closedpostboxes_acf-field-group and maybe others...
The one causing trouble for me was meta-box-order_acf-field-group : I simply deleted the entry (but you can try editing it to remove the reference of your "lost" box) and the problem was solved.
Maybe too late to help you, but hope it can still help someone !
##EDIT##
Seems I may have a clue about how the box disappeared
Steps to reproduce :
Create a field group and associate it with whatever post type you have
Go create a whatever post (note : the Gutenberg editor is active on this edit page)
You should find your fields group at the bottom of the page
Try to move the group meta box above the Gutenberg editor (without success because it seems not possible)
Save your post
Come back to the edit page of the field group and refresh it
Tadaaa ! the fields group box is not available anymore
Go to your database, the usermeata table, you will find the entry causing the trouble again : meta-box-order_acf-field-group = a:3:{s:4:"side";s:32:"submitdiv,acf-field-group-fields";s:6:"normal";s:57:"acf-field-group-locations,acf-field-group-options,slugdiv";s:8:"advanced";s:0:"";}
I solved the problem by adding a custom script for the ACF with delete class closed on #acf-field-group-fields:
document.addEventListener("DOMContentLoaded", function(event) {
document.querySelector('#acf-field-group-fields').classList.remove('closed');
});

Why would WooCommerce Product Attributes disappear on save

I have a WooCommerce store that has products with attributes that are associated with variations. When I save products, the attributes disappear (and therefore the associated variations do, too). When I re-add the attributes and save the product again, the variations come back as they were. (Note that this means attributes don’t always disappear - only when they’re not manually added before saving. )
No errors are logged.
I'm looking for some insight as to why this would happen.
I had the same issue since I use Ozisti theme for my site, too.
The workaround was to do NOT USE "Save attributes" button on product page. To save attributes changes USE "Update" (product page - on the top/right of the page).
The problem has been solved with Ozisti ThemeREX support team. They sent me new files:
wp-content/plugins/trx_addons/components/api/woocommerce/woocommerce-extended-attributes.php
wp-content/plugins/trx_addons/includes/plugin.wp.php
and now it works fine.
Regards, Jacek
I think I had a similar problem.
WordPress 5.1.1
WooCommerce 3.5.7
Ozitsi 1.0.2 Theme by ThemeRex (here was the problem)
Solution summary: Add attribute, add options, press SAVE ATTRIBUTES (attribute row folds) -> UNFOLD IT immediately - if you don't see options inserted a second ago into the Comboselect field read on.
In my case plugin ThemeREX Add-ons (shipped with Ozisti theme) was the issue. It added extra attribute types, so I could turn variations between dropdown select, image, color and button types.
After few hours of debugging I noticed that when attribute was set to one of the new types, UPDATING PRODUCT did erase all added attributes -> and by extension variations.
After ADDING ATTRIBUTES again (without SAVE ATTRIBUTES button - just adding attributes and UPDATING product) all was back in place.
Notice: when you SAVE ATTRIBUTES the row with options closes, the variations become available. But when I opened the attribute row after all AJAX saving was done it turned out that there were no OPTIONS placed in this Wordpress combo select of attribute I just edited.
So on UPDATING PRODUCT WooCommerce saved empty attribute options into DB.
This might not be perfect solution but I solved this by modifying WooCommerce's meta-boxes-product.js
I commented out line 465 and added another line to close the row:
$( '.product_attributes' ).html( response.data.html );
$( '.product_attributes .woocommerce_attribute.open .handlediv' ).trigger('click');
I didn't trace everything to the roots but makinkg it work for this single project is good enough for me at this point.
You probably use other plugins then me, but maybe they do something similar to my case.
So try to SAVE ATTRIBUTES and then immediately open attribute row again and check if selected options are inserted.. if not.. try my solution.
This Happen to me This Year. I was debugging my store for 3 days.
Solution:
I load a css file on Wordpress back office with these lines:
.save_attributes, .save-variation-changes {
display:none !important;
}
This makes WooCommerce Hide 2 buttons.
Save Attribute and Save Variation. So clients will be forced to use the update button in the product page. I'm still not sure if this is a Woocommerce bug or other plugin but for some reason, if I pressed one of these 2 buttons I would lose all my variations.
I have similiar solution with #Maciej Dejewski using Woocommerce v3.6.5.
On file /plugins/woocommerce/assets/js/admin/meta-boxes-product.js or /plugins/woocommerce/assets/js/admin/meta-boxes-product.min.js (depends on your admin page calling the javascript - you can check it via inspect element)
But instead adding line
$( '.product_attributes .woocommerce_attribute.open .handlediv' ).trigger('click');
Just commented out this
$( '.product_attributes' ).html( response.data.html );
Working fine for me
Here's the screenshot
Hope this would help!
After debugging for a hour, it turns out that my variations only disappear when not each attribute is selected. However, some of my product's attributes have between 10 and 150 entries..so that is the downside when using this method.

Disable Drupal redirecting to page view after edit

How do I disable the edit page redirecting to either the page view or the list of site contents upon saving?
I prefer to keep the edit page open whilst refreshing the page view in another browser window, and it is really annoying having to click back into the edit view every time I click on 'Save'.
I cannot find anything in the documentation or online telling me where I can turn off this behaviour ?
If you want this behaviour both on node creation and update, and for every content-type, you can do something like:
function hook_node_insert($node) { // and for hook_node_update
$_GET['destination'] = 'node/' . $node->nid . '/edit';
}
EDIT : Of course I don't know your Drupal level so I didn't say that you have to put it in a custom module, etc, etc. If you need more information about that, just ask ;-)
Use this module, it adds an extra button to save and stay in edit: https://www.drupal.org/project/save_edit

How to remove default dropdown Select option in Wordpress Contact Form Manager plugin

I'm using the Wordpress Contact Form Manager plugin. If I set a dropdown's element Default drop down value to some value that value does appears selected as I've set it. The problem is when I click on the dropdown to expand it, the additional Select option appears as shown on the image, and I can't seem to find where could I customize this. I went through their FAQ and googled but no help.
As it seems the option to edit this really doesn't exist via the plugin admin panel and in order to remove the additional Select option you have to edit the create-contact-form.php starting on line 1006 and comment the code out:
if($formElementDetail->client_view_multi_select_drop_down != 1){
//$replace = $replace.'<option value="">Select</option>';
}
You can of course comment (or remove) the whole if case. Hope this will help someone.

Issue with "modify taxonomy"

I'm working with Drupal 6 to create a feed collecting site. I import the original feeds via the feeds module and copy their tags. But I also want to assign a category (terms from second taxonomy) according to the author name to be able to divide the content in a unified way.
I want to use the rules module (rules-6.x-1.2) to assign these categories upon import. I use the following steps:
ON event Content is going to be saved
IF textual comparison ([node:author-name], TheAuthorName)
DO Modify node taxonomy terms (saved content, permanently, add the selected terms)
I select the terms to be added as "-none selected-" for tags and "TheCategory" for categories.
Now, when I import the feed, the category "TheCategory" is added to the content, but the tags vanish.
This happens also if I select "Replace existing terms with selected ones" or "Replace terms within same vocabulary" for the action. Upon editing, always the radio button of "add …" is selected, regardless of what I entered previously. And yes, I clicked on "save".
Is this the right way to do what I want? Why isn't it working? Could I do this with another module maybe (I don't need rules for anything else …)?
Thanks for your help!
Ok, so I found out that the right trigger to do this is "new content is created" (which I somehow couldn't get to work beforehand).
So, I ran the rules module in debug mode and found that the rule was triggered, the filter returned TRUE and the modify node taxonomy action was successfully accomplished. But the taxonomy was entirely unchanged.
I played around a little and postponed a "save content" action on the newly created content. Turns out, this fixed the problem and now everything works as I intended.
Still, there are some flaws:
I checked "permanently apply changes", but it did not do anything.
I unchecked "permanently apply changes", but upon editing again, the box was checked again (probably the setting was not saved to begin with)
The same holds true for the radio buttons for the type of "modify node taxonomy" action which was obviously not saved
Maybe this can help someone.

Resources