Mohammad Ali Akbari
  • Member for 10 years, 9 months
  • Last seen more than 2 years ago
What is the best tagging widget?
Accepted answer
12 votes

Finally, I decided to use the Autocomplete Deluxe module as tagging widget. This is an enhanced autocomplete element, that uses the JQuery UI autocomplete. It will also implement a widget for ...

View answer
How to display a flag to anonymous users?
Accepted answer
10 votes

You can do this in your 'node.tpl.php' by something like below, if user is logged in display flag as normal and if is not logged in redirect user to logging page with destination parameter global $...

View answer
Override title with field label instead of key inside a views contextual filter
Accepted answer
9 votes

edit your Contextual Filter check Specify validation criteria in Validator check PHP code and enter following: if ($argument == 'youth_competitive_program') { $handler->options['title'] = 'Youth ...

View answer
How to get All options of a 'select' field?
Accepted answer
7 votes

In Drupal 7 you can use field_info_field(), while in Drupal 6 you can use content_field_instance_read(), which is defined in the CCK module. As @Lauri said: You can also use list_allowed_values(). $...

View answer
Problem with migration from Apache to IIS
6 votes

You need to translate the Apache server's rewrite rules into their IIS equivalents, in the root web.config. For reference, see what is reported in the Windows Download Instructions. IIS7: Create/...

View answer
How to customize the data retrieved by a REST call?
Accepted answer
6 votes

All you need is to define your Resource, take a look at files in site/all/module/services/resources, you can find some examples, but for simplicity I will take you and example: endpoint_user moduel: ...

View answer
php include inside .tpl.php template file
Accepted answer
5 votes

Its better to modify the shared template inside hook_theme and use Drupal theme engine: <?php print theme('your_shared_template_file', $args); ?>

View answer
Redirect to "Access denied" page?
5 votes

You don't need to redirect to any page; you can produce the access denied page by calling drupal_access_denied().

View answer
Blocking access to taxonomy pages
4 votes

while category/year/2525 is an alias for taxonomy/term/xxx you should restrict access to taxonomy/term/* for all anonymous users. if you want do this via simple module: function mymodule_init(){ ...

View answer
page which display only $content (no header,footer,sidebars)
4 votes

Colorbox Node lets you load just content of a menu callback in a colorbox modal via Drupal ajax framework and works well in your case. When you create your links manually, you will need to add the ...

View answer
Print registration and login forms on same page
4 votes

LoginToboggan do this for you: Install it, and go to admin/config/system/logintoboggan; select "Present a unified login/registration page."

View answer
add fields to comments programmatically
Accepted answer
4 votes

I found my answer, see: dsm(entity_get_info()); dsm(field_info_bundles()); so my code should be: $instance = array( 'field_name' => 'field_image', 'entity_type' => 'comment', '...

View answer
Force an empty region to display
Accepted answer
3 votes

Omega does it this way: in omega.info settings[alpha_region_xxx_force] = '' in `omega/alpha/includes/theme-settings-structure.inc $form['alpha_settings']['structure'][$section][$zone]['regions'][$...

View answer
Mark a location on a map (Google Maps/OpenLayers) on a node creation or edit page - but with which module?
3 votes

I had a good experience with Geolocation Field. I used this module on dealing website to show location of store. It lets you mark location via node creation/edition form and have display formatter to ...

View answer
Error while creating a node with file attachment through custom PHP code
Accepted answer
3 votes

replace $node->field_file[$node->language][0]['value'] = (array)$file; with $node->field_file[$node->language][] = (array)$file; Also, add $node->validated = TRUE; before node_save($...

View answer
Create content types containing other content-types
Accepted answer
3 votes

Ok, you should be familiar with entity view mode entityreference after install entityreference create a reference to books in your catelogs content-type, then go to catelogs > manage display and ...

View answer
Views in English and Spanish
Accepted answer
3 votes

I think you should not think about language and let Drupal handle it. If you install locale module and configure it correctly you will gain what you need: Install the Locale, Internationalization ...

View answer
How to get the value of a node field?
3 votes

enable Devel module and in node-{content-type}.tpl.php use <?php print dsm($node); ?> on top of code. you can see all $node fields in readable format

View answer
Custom logo for each organic group
Accepted answer
3 votes

I write this module to render custom logo for each Organic Group: function og_logo_block($op = 'list', $delta = 0, $edit = array()) { if ($op == "list") { $block = array(); $block[...

View answer
Does Drupal modify folder permissions during runtime?
2 votes

Yes drupal modify default folder permission during runtime, and this folder is what exactly you should add it to your .gitignore because it contains user uploaded files which have not value to keeping ...

View answer
Collapsiblock module - can I have horizontal expanding tabs instead of vertical?
Accepted answer
2 votes

Search slideUp and slideDown in collapsiblock.jsand replace with animate, for example: $(this.target).animate({width:'toggle'},slidespeed); Useful post: Slide Elements in Different Directions

View answer
Show file field as thumbnail if file is an image?
Accepted answer
2 votes

All you need is writing your own display formatter for file fields. have a look at field_example module to see where you should start: first define your display formatter using ...

View answer
What's meaning of %contact in this menu path?
2 votes

All requests on admin/structure/contact/edit/[anything] will be handled by a Drupal form callback, contact_category_edit_form() in contact.admin.in` which returns a form array. %contact means this ...

View answer
Rename images while uploading and put in specific folder
Accepted answer
2 votes

File (Field) Paths let you set file name and file path for file field:

View answer
Using "Security Review" gives file permission errors, how to fix them?
2 votes

You should have 755 on directories and 644 on files, try this on your root directory: Directories, find /path/to/base/dir -type d -exec chmod 755 {} \; Files: find /path/to/base/dir -type f -...

View answer
How to make node delete confirmation inline?
2 votes

you can put this in your node--node-type.tpl.php file: $item = menu_get_item("node/$nid/delete"); if ($item['access']) { include_once(drupal_get_path('module', 'node') . '/node.pages.inc'); $...

View answer
How to render youtube field?
Accepted answer
2 votes

$display should be one of view modes (full, teaser, rss or ...) or display setting array: $display = array( 'label' => 'hidden', 'type' => 'file_rendered', 'settings' => array( ...

View answer
displaying fields of selected taxonomy term
Accepted answer
2 votes

you need this functions: taxonomy_term_load taxonomy_term_view drupal_render load term by taxonomy_term_load, pass it to taxonomy_term_view then render it by drupal_render

View answer
Message + add class
Accepted answer
2 votes

as described here you can add your classes to message div: drupal_set_message(t('Something horrible just happened.'),'error simple_suscription');

View answer
Adding classes to menu items
2 votes

have a look at l() function in includes/common.inc: ... if (($path == $_GET['q'] || ($path == '<front>' && drupal_is_front_page())) && (empty($options['language']) || $...

View answer