drupal-7

How can a custom Drupal date format be added?

断了今生、忘了曾经 提交于 2019-11-30 11:15:20
How do you add a custom Drupal date format. I want to display the date without hours and minutes, but the options don't include it. Vishal Khialani Do the following: Administration » Configuration » Regional and language » Date and Time There you will see a tab for format. Create a new format string "Y-M-d". Make this as your default for all date fields and you won't see the seconds any more. You don't need the date module for basic formatting. Cheers, Vishal Below is the image so that you know where it is. You will see a button Add format in this path admin/config/regional/date-time/formats

Extending Drupal 7 search

六月ゝ 毕业季﹏ 提交于 2019-11-30 07:55:24
I want to extend default Drupal 7 node search with one additional field. I alter search form with the following new field: function mymodule_form_search_form_alter(&$form, &$form_state, $form_id) { $form['basic']['site'] = array( '#type' => 'select', '#options' => array( 'KEY1' => 'TITLE1', 'KEY2' => 'TITLE2', 'KEY3' => 'TITLE3' ) ); } I have a field called field_data_field_site.field_site_value which i need to use as a filter in this search. I've tried to read about hook_search_* functions but didn't get the idea. My question is the following. How can I extend search form? Anyone have live

How to disable a field or make it readonly in Drupal 7

女生的网名这么多〃 提交于 2019-11-30 05:10:11
问题 I am trying to disable couple of fields and make them readonly via hook_page_alter(). I was able to do check if user is viewing the page edit section (the form edit) $page['content']['system_main']['#node_edit_form'] == TRUE) then when I tried to disable couple of fields, I found that select list can be disabled by this code: $page['content']['system_main']['field_my_field_name_a_select_list']['und']['#attributes']['disabled'] = TRUE; but if I use the following code it doesn't work: $page[

Symlink is not working in my local machine

扶醉桌前 提交于 2019-11-29 17:54:17
I'm using Xampp setup in Windows 7 machine. I am trying to configure sub-folder module in Drupal 7. But it says "Cannot create symlink, error code(1314)" error which stops me in configuring the module properly. And subfolder module functionality is not working as expected. Chris Nauroth This is a Windows error message indicating that the current user does not have permission to create symbolic links. By default, this privilege is granted to administrators only. Your options for fixing this are either to run as administrator (which of course is risky for normal day-to-day use) or explicitly

Changing video content type (mime type) in CDN in drupal 7

一曲冷凌霜 提交于 2019-11-29 15:48:05
I am using media module to save media in CDN. To play videos, we are using jwplayer in Drupal 7. Jwplayer throws error in IE, If video is not of content type [mime type] * video/mp4 *. I have changed the existing CDN videos mime type from application/octet-stream to video/mp4 . Now whatever mp4 videos are being uploaded/saved to cdn should only be of video/mp4 mime type but when I upload mp4 videos in media module it is saved in CDN with mime type application/octet-stream, How do I change the uploaded mime type [content type] to video/mp4 . CDN module code function CDNtransfer_content($source,

Extending Drupal 7 search

邮差的信 提交于 2019-11-29 10:19:05
问题 I want to extend default Drupal 7 node search with one additional field. I alter search form with the following new field: function mymodule_form_search_form_alter(&$form, &$form_state, $form_id) { $form['basic']['site'] = array( '#type' => 'select', '#options' => array( 'KEY1' => 'TITLE1', 'KEY2' => 'TITLE2', 'KEY3' => 'TITLE3' ) ); } I have a field called field_data_field_site.field_site_value which i need to use as a filter in this search. I've tried to read about hook_search_* functions

How to implement hook_theme in drupal 7?

一个人想着一个人 提交于 2019-11-29 03:55:30
I created a new drupal 7 theme and trying to implement hook_theme at template.php like this: function mytheme_theme($existing, $type, $theme, $path){ return array( 'mytheme_header'=>array( 'template'=>'header', 'path'=>$path.'/templates', 'type'=>'theme', ), ); } then I placed header.tpl.php into templates directory and cleared all caches, and call theme function: theme('mytheme_header', $vars); and header.tpl.php likes this: <?php fb('calling header template');//the function of FirePHP to output debug info print '<div>Header</div>'; //... I check Firebug and it get the info 'calling header

Drupal 7: how to restrict file access to specific user roles

邮差的信 提交于 2019-11-29 02:25:44
I need to develop a site on Drupal 7. I have some content types with File fields in CCK. And access to nodes of these types should be granted only to specific Drupal user role. And at any moment site administrator should be able to make these Nodes 'public' or 'private'. I can make nodes visible only to specific user roles, but this is not secure enough. If anonymous user knows the path to file ( www.mysite.org/hidden_files/file1 ), he can download it. What is the most elegant way to solve this problem? Thanks in advance. Check out this documentation here: http://drupal.org/documentation

How can I check Drupal log files?

徘徊边缘 提交于 2019-11-28 22:25:29
How can I check Drupal log files? I'm using Ubuntu 10.10 + Apache2 + PHP 5.33 + MySQL and Drupal 7. To view entries in Drupal's own internal log system (the watchdog database table), go to http://example.com/admin/reports/dblog . These can include Drupal-specific errors as well as general PHP or MySQL errors that have been thrown. Use the watchdog() function to add an entry to this log from your own custom module. When Drupal bootstraps it uses the PHP function set_error_handler() to set its own error handler for PHP errors. Therefore, whenever a PHP error occurs within Drupal it will be

Drupal 7 Views 3 user:current filter is missing?

匆匆过客 提交于 2019-11-28 21:11:09
I'm trying to filter a view to display only nodes of the current user. Filter by user:current is missing however, where can it be found/enabled? I must be missing something simple. In Drupal 7, Views 3, you must add the Relationship of Content: Author on the right side under the Advanced settings. Once you've added that relationship, you will be able to see the User: Current filter. You can use another method without require any relationship. in Advanced settings add Contextual filters select Content: Author uid and in settings of it select Provide default value ,in type selectbox choose User