Custom webform-mail template in Drupal 7 does not work - drupal-7

I'm trying to customise the webform email template for a specific webform following the steps in THEMING.txt, but those changes aren't being reflected in the form's default email template. I may have made a mistake in multiple places so I'm going to walk through my steps and hopefully someone will be able to spot what I did wrong :)
1) I copied the webform-mail.tpl.php template from /sites/all/modules/webform/templates directory over into the /themes/mytheme/ directory. Is that the correct place to drop it?
2) To test it, I simply changed some of the text. So I just changed 'Submitted on %date' to 'Entered on %date'.
3) I then renamed the page to webform-mail-1226.tpl.php, where 1226 is the number I see in the url when I go to edit the webform.
4) Then I tried to clear the cache, but I think this is the step I did wrong. The THEMING.txt file says to visit admin/settings/performance, but that path doesn't seem to work/exist for me. What I tried instead was admin/config/development/performance/ and then cleared the cache with the options here. Am I supposed to go somewhere else to clear a different cache?
5) I then went to the emails section corresponding to this form, and when I either go to an existing email or create a new one, the default email template does not reflect the changes I tried to implement.
Does anyone have any ideas why this isn't working? Thanks for your time and help :)

Here is checklist you need to verify:
1) Your Step 1 is okay nothing to worry.
2) If it is reflecting the change then it means default webform email template file is working fine.
3)* Here you need to verify node-id you used in filename. www.yoursite.com/node/xxx/webform, xxx = 1226 in the filename.
4) The Drupal 7 - Clear cache correct URL is admin/config/development/performance.
5)* Here you need to check in webform email setting you have to select "Default template".
Try selecting "Default template" the clear Drupal cache and then test.
Helpful link.

Related

I am adding the code in weebly but it dosent show up

Issue with JSON LD CODE
To start with I am trying to use this code in weebly, buy using embed code option and then I click on the edit custom HTML and enter this code. However, after entering this nothing shows up as in the recipe is not shown on the page and a blank page is shown.
this code is picked on schema.org, for recipes.
Could anyone please help me out in what exactly went wrong. I really appreciate your assistance. FYI- I am new to this. I am trying to set up my own food website and and wanted to schema to for SEO improvement. Any other suggestions are welcome. Thanks in advance.
Please refer this link for the JSON-LD CODE. IT WILL BE AT THE END OF THE PAGE. https://schema.org/Recipe
When you add a JSON-LD block in the HTML, it doesn’t change anything visibly on the page. The script element is hidden by default in all browsers, and you typically want to keep it like that (users typically have no interest in your JSON-LD code).
To check if adding the JSON-LD worked correctly, open the page in a browser and check the source code of the page. You should see the script element with your JSON-LD.
You have to add the content (that should be visible to your users) regularly with HTML. The JSON-LD exists next to your content (duplicating the data like name, photo URL etc.), it doesn’t replace your content.

DNN - Custom Registration Form Field Does Not Validate for Required After Upgrade

I am upgrading a DNN site from version 5.06.00 to version 7.03.02. I followed the recommended upgrade path, and worked out all of the kinks with the custom modules. The registration form has a custom boolean field, which is required to be set to TRUE. This used to validate correctly pre-upgrade, but now it is not post-upgrade. The user can submit the form without selecting the "TRUE" radio button.
The custom field is displaying properly. The required asterisk is also displaying. The DOM even has an error message element with the correct custom required message:
<span class='dnnFormMessage dnnFormError'>[required message]</span>
However, this field is set to "display:none" by default and never displays as inline like the other error message elements.
I am not a DNN expert and I did not create this site. I am upgrading it for a client and don't know a ton about how these custom fields all work. I see the custom field enabled in Admin > Site Settings > User Account Settings > Profile Settings. I also see a file called "Profile.ascx.Portal-0.resx" that contains the custom field's main text, help text, and required text. It lives in DesktopModules\Admin\Security\App_LocalResources. I don't know what else I would need to configure or check that would be different from version 5.6 to 7.3.
Thanks for your help!
It seems like you've checked all of the requirements, but you didn't mention wheter or not the checkbox to require a valid profile for registration is checked. Is it?
Can you verify that the custom field is marked as Required?
It may be worth your while to upgrade to the current version of DNN 7, which is 7.04.02.
I'd recommend making a full site backup before doing the upgrade as that is always the right way to proceed.
The .resx file aren't going to affect the functionality, just the texts that are displayed.
I assume that you are doing much of this work on a test copy of the production site. That being the case, you might want to add another custom boolean field, make it required and see if that one works.
This isn't the ideal answer, but since I can't figure out what's wrong DNN-wise, I'm just writing some custom jQuery to find the checked radio button span element, then show/hide that error message based on that. If there is more than one thing wrong with the form, it will only show this message. Then if you corrected that boolean, it would show all other messages. It's not great, but at this point it's better than nothing.
$(".dnnPrimaryAction").click(function (e) {
var $checkedRadioSpan = $(".dnnRadiobutton-checked");
var $checkedRadioInput = $checkedRadioSpan.prev();
var $errorMessage = $checkedRadioInput.siblings(".dnnFormError");
if($checkedRadioInput.val() === "False") {
e.preventDefault();
$errorMessage.show();
}
else {
$errorMessage.hide();
// continue on with other validation
}
});
I had quite the same problem. It seems that the error message is not displayed for the first form item, as there is not enough place for it.
After adding a header (h2) above the form, it worked fine.
See Validator errormessage is not displayed in the DNN Community forums for more information.

Drupal 7 Content type restrictions

How to add a restriction or validation for a content type that can be add only one content.
ex - Hotel web site room listing page should have only one content. After added once that only can edit or delete.
(I am a beginner for the Drupal)
Have you checked Node Limit module? I have never used it, but seems suitable for what you want to get.
Hope it helps.

CakePHP 1.3: Issue with saveField

I dont understand why I am not able to update a field on the database based on the following code:
$this->User->id = 1;
$this->User->saveField('image','img/default_pic.png');
Basically, I want to change the current image in the Db with a new one.
The code above just clears the value that is currently in the image field, but does not add anything.
As an example, this is what happens:
id username image
=============================
1 admin mypic.jpg
2 john johnPic.jpg
After the code above is executed I get the following result
id username image
=============================
1 admin
2 john johnPic.jpg
I am confused at what is actually happening
SOLVED!
I decided to go back and check on my user.php model class and realized that I had attempted to use MeioUpload before and gave up, but I never removed the var actsAs entry.
As soon as I commented it out, I am now able to upload pictures.
For anyone else that might come across this issue, beforeSave might also caused these kind of problems, according to the following blog: http://blog.phplabs.net/2011/11/cakephp-savefield-not-working.html
Thanks,
What does the sql log say is happening?
My guess is you are actually doing something like
$this->User->saveField('image', $variable)
and $variable is either misspelled or is empty.

How to add a custom field into template.php using Zen sub theme

First time poster here, I'm a designer not skilled at all with php and I have a small issue I don't seem to be able to solve. I'm making a site in drupal 7 using a sub theme on zen.
Btw this is a great CMS, even though people say it's really more a developers CMS. I have no trouble to do what I need using views, rules, display suite etc. So a big thank you for all the developers out there making this such a good CMS. But for this apparently simple problem... no module will help me (I think) and I'm kinda stuck.
So here it is: I'd like to add a subtitle next to the title in all my pages.
So what I did was to add a custom field into the content type basic page (machine name: field_sub_title) which is a simple text field.
I uncommented the following line in my template.php
function mytheme_preprocess_page(&$variables, $hook) {
$variables['sub_title'] = t('field_sub_title');
}
Now my question is how do I load the content of my custom field into that variable?
I know i need to change the second part, but I don't have a clue as into what I need to change this.
Displaying the variable into the the page.tpl.php is something I know about so I only need help with the first part.
{EDIT}
Ok I found how to do this :)
I was looking for a solution in the wrong place. I don't need to change any thing in the template.php file.
Just needed to add this bit of code into my page.tpl.php:
<?php
print $node->field_sub_title['und'][0]['value'];
?>
So I'm posting this here for other Drupal newbies struggling with this....
Your solution may work for now, but there may be a more Drupal-y way to handle a problem like this. If you haven't noticed any problems yet, you may find one or more of the following issues down the road:
Someone who doesn't know php or Drupal theming may need to change the way this works.
If you're like me, you may forget where exactly in code this was implemented.
You may see superfluous markup and/or errors on nodes (content) that do not have this sub-title field (ie. event content not having a sub-title field while basic pages and news articles do).
When you add a field to a content type, it will automatically appear anytime content in that content type is displayed. You should be able to add the sub-title field for your page, event or whatever else you need and have it automatically appear in the markup.
You can 'manage display' of a content type to drag and drop the order for fields to appear. You could take it a step further by using a module like Display Suite to add formatting or layout per-content type.
If you feel like this isn't good enough and the markup for the subtitle must be at the same level as the page title (which is rare), at least add an if statement to make your code check to see if the variable is present before trying to print it. I'd also add a new variable and comments for code readability.
<?php
$subtitle = $node->field_sub_title['und'][0]['value'];
if($subtitle){
print $subtitle;
}
?>
Consider using field_get_items or field_view_value, or at least use the LANGUAGE_NONE constant instead of 'und'
See https://api.drupal.org/api/drupal/modules%21field%21field.module/function/field_get_items/7 and https://api.drupal.org/api/drupal/modules!field!field.module/function/field_view_value/7
This has the added benefit of reducing the number of potential security holes you create.

Resources