Skip to main content

Home/ Drupal for Developers/ Group items tagged fields

Rss Feed Group items tagged

Scott Blackburn

Views Help: How to get a field to "Link this field to its user" besides username | drup... - 0 views

  • Though one would think the $field object is what we wanted-- the actual object we needed is $row (even though we're only looking at one field in the row). Put the following into the field tpl file to see what the necessary info is: <?phpprint '<pre>';print_r($row);print '</pre>';?> Then, to actually make the link, put the following in your field tpl file: <?php$account = user_load($row->uid);print l($row->profile_values_profile_fullname_value, 'users/' . $account->name);?> Change 'profile_values_profile_fullname_value' to the proper field alias (based on the $row output). Also, be sure to change 'users' to whatever the path is for your user accounts. I also had another thought-- given your use case, you may want to consider the http://drupal.org/project/realname module as well. It will replace usernames with whatever field(s) you designate all over the site. EDIT: I had another thought. I'm not sure of the performance implications of doing a user_load in the template file. Another option is to add the 'User: name' field to the view but exclude it from display. Then you could avoid the user_load and change the code in the tpl file to: <?phpprint l($row->profile_values_profile_fullname_value, 'users/' . $row->users_name);?>
  •  
    theming the field tpl files for Views2
Daniel Gregoire

Programmatically Create, Insert, and Update CCK Nodes | doug | CivicActions - 2 views

  • Always use content_database_info to get the database info. For example:   $field1 = content_database_info(content_fields('yourfield1', 'yourtable'));  $table1 = $field1['table'];  $column1 = $field1['columns']['value']['column'];  $field2 = content_database_info(content_fields('yourfield2', 'yourtable'));  $table2 = $field2['table'];  $column2 = $field2['columns']['value']['column'];  if ($table1 == $table2) {    $sql = "SELECT n.*, t1.$column1, t1.$column2 FROM {node} n ";    $sql .= " INNER JOIN {$table1} t1 ON t1.nid = n.nid AND t1.vid = n.vid";  }  else {    $sql = "SELECT n.*, t1.$column1, t2.$column2 FROM {node} n ";    $sql .= " INNER JOIN {$table1} t1 ON t1.nid = n.nid AND t1.vid = n.vid";    $sql .= " INNER JOIN {$table2} t2 ON t2.nid = n.nid AND t2.vid = n.vid";  }  $sql .= " WHERE n.nid = %d";
  •  
    Important point: Using special functions to let CCK get the proper name of the field (allowing users to make CCK changes in the UI and let your code continue to work).
Daniel Gregoire

Theming the User Registration Form in Drupal 6 | Trellon - 0 views

  • <?phpfunction themename_theme($existing, $type, $theme, $path) {  return array(    ...    // tell Drupal what template to use for the user register form    'user_register' => array(      'arguments' => array('form' => NULL),      'template' => 'user-register', // this is the name of the template    ),    ...  );}?>
  • <div id="registration_form">  <div class="field">    <?php      print drupal_render($form['account']['name']); // prints the username field    ?>  </div>  <div class="field">    <?php      print drupal_render($form['account']['pass']); // print the password field    ?>  </div>  <div class="field">    <?php        print drupal_render($form['submit']); // print the submit button      ?>    </div>  </div></div>
  • <?php  print '<pre>';  print var_export($form);  print '</pre>';?>
  • ...3 more annotations...
  • Don't forget to render hidden fields or it won't work ;) echo drupal_render($form['timezone']); echo drupal_render($form['form_build_id']); echo drupal_render($form['form_id']);
  • you also have to print the "token" in order to make the form work print drupal_render($form['form_token']);
  • From my own experience using a form tpl.php, you need to print the whole $form at the very end of the template to ensure that the form will validate upon submission. <?php print drupal_render($form); ?> Just adding the hidden form_build_id and the form_id fields will not mean the form will work. Printing the entire form at the end, however, will mean that all the stuff you wanted to hide in making the template will show. For those fields, include "unset" statements for each one: <?php unset($form['field_to_hide']); ?> Please correct me if I'm wrong or if there is a better way to do this.
Leandro Ardissone

Creating a Compound Field Module for CCK in Drupal 6.x, from Poplar ProductivityWare Ar... - 8 views

  •  
    Create a new CCK field.
  • ...1 more comment...
  •  
    This is a nice foray into defining your own custom field types in CCK. Thanks for sharing. However, as regards "multi-groups" in CCK, I've used CCK version 6.x-3.x-dev and it's worth a look.
  •  
    Oh, really? I'm just needing to use multi-groups. Well, multiple-fields field group, or whatever. For example a recipe with ingredients where you can enter: amount (textfield), unit (option field), ingredient name (textfield). Thanks.
  •  
    when your ready to go to drupal 7 here is the article for that http://www.phase2technology.com/node/1495
Daniel Gregoire

Programatically creating a CCK field in Drupal 6 | drewish.com - 5 views

  •  
    Quick 'n' easy, create CCK fields programmatically
Scott Blackburn

How to make CCK fields do some of the same tricks as taxonomy terms | !&# - 0 views

  • In Drupal, taxonomy.module implements hook_term to provide links among content which shares a given term. Site builders often use this feature to provide indexes and RSS feeds of their content. Taxonomy.module's purpose is to support the creation of controlled vocabularies which we can use to classify our site's content. If taxonomy.module were a prescription drug, this would be its "on-label" or indicated use. Using taxonomy.module vocabularies and terms to store essential data about our content is what I call an "off-label" use. You're not really creating a controlled vocabulary, and the term-node relationship in these cases isn't always classificatory. However, a clever web developer will use the tools that get the job done, and often taxonomy.module is the perfect tool for making this happen. Because this information is essential to your node's content, CCK fields are indicated for this use. However, CCK fields don't have built-in linking among nodes which share values for the same field. Also absent is any built-in RSS feed for a CCK field's value. This requires some theming and Views.
Scott Blackburn

Problems when Profiles are enabled | drupal.org - 0 views

  •  
    Email Registration: when I enabled Profiles and added fields to the registration form, the username field came back.
anonymous

The Great Pretender: Making your data act like a field | Lullabot - 7 views

  • Now, though, it's possible for any module to tie into CCK's field management page to control the positioning of custom content. The key is hook_content_extra_fields(), and in this article we'll show you how to use it.
  • Now, though, it's possible for any module to tie into CCK's field management page to control the positioning of custom content. The key is hook_content_extra_fields(), and in this article we'll show you how to use it.
  •  
    Dubai Independent Escorts Service Dubai Independent Escorts Agency Independent Escort In Dubai Independent Escort In UAE Independent Escort Service Dubai Independent Escort Agency In Dubai Independent Model Escort In Dubai Independent Indian Escort In Dubai Arab Call Girls In Dubai
Daniel Gregoire

file_save_upload problem saving into destination folder | drupal.org - 0 views

  •  
    Simple, clean example of adding a file field and saving the file permanently.
Scott Blackburn

Litenode | Development Seed - 0 views

  •  
    Litenode is a new module that uses Views to replace multiple node_loads() on a page. The concept is simple: Views already knows how to grab any of the fields in a single go that many modules load independently in their hook_nodeapi('load'). Why not have Views grab them all at once (as you would do in a table view, for example) and then have a style plugin map the Views fields to all the places where modules expect them to be on a loaded node?
Scott Blackburn

Feed API + Emfield Recipe | drupaltherapy.com - 0 views

  •  
    Here is a quick recipe that uses Drupal's Feed API, Feed Element Mapper, CCK and the Embedded Media Field to create independent embedded video nodes on your Drupal site by RSS. This is our first screencast and first contribution to the Drupal Dojo, hopefully you will find this interesting and try it out yourself.
Daniel Gregoire

Advanced theme settings | drupal.org - 4 views

  • here. dman - April 6, 2009 - 22:10 This worked fo me. An additional logo (Appeared in the footer everywhere) Not sure why I had to put the submit handler into the #validate pass :-/ It was copied from the existing theme settings funcs. 'campaign_' is the theme name.
  •  
    d.o page for adding theme-settings.php file for custom theme features available at theme configuration page. Highlighting comment that successfully adds an "upload" field for uploading images for custom features.
Daniel Gregoire

Restrict specific folders from public download (via .htaccess) | drupal.org - 0 views

  • If you set "public" as the download method, you can still protect some of your folders by settings in your .htaccess file, if you have mod_rewrite enabled. For instance, if your files live in sites/default/files, and you want to protect everything in sites/default/files/protected_download_dir, then you can add the following line to your central .htaccess file: RewriteRule ^sites\/default\/files\/(protected_download_dir\/.*)$ index.php?q=system/files/$1 The files in this folder (or, all files that match the regular expression) will not be served directly by apache, but by a full drupal request using the file_download() callback. The routing for system/files is defined in system_menu(). Access Checking for File Downloads Modules can do access checking on files downloaded through file_download(), by implementing hook_file_download(). For instance, the filefield module will do access checking for all files that you upload via filefield. It will only give access to people who are allowed to see the node and the field the file belongs to. In addition, you can look for modules that restrict file downloads based on the folder name or other criteria. Access Checking built-in with Filefield The filefield module has access checking built-in. To make use of this, please Make sure to use the latest dev version of filefield (for now). The current offical release (08/2009) has a bug in access checking. Have a look into filefield issue 516104. Configure the filefield you want to protect. Use the filefield path module, to define where the files for the filefield should be stored by default. Add a line to your .htaccess to protect this folder (see above). Use whatever modules to restrict node or field access.
Scott Blackburn

Limit Views-created block content by node author or current node | Geeks & God - 0 views

  •  
    Scenario One: Limit by author of current node Scenario Two: Limit source to CCK fields in the current node
1 - 20 of 23 Next ›
Showing 20 items per page