Drupal 7

Provide a link to add content from VIEWS

I found out a better way to provide "Add content" link at the footer region of a VIEW. We can achieve followings:

- Pass any number of arguments.
- User can access link only if he/she has permission.

N.B- use Entity Reference for prepopulating valued from URL

Example:

<?php
global $user;
$view = views_get_current_view();
$args = $view->args[0];
if (user_access('create test_report content', $user)) {
$output=l(t('Add new Biochemistry Test '), 'node/add/test-report', array(
'query' => array(
'field_tr_patient_ref' =>$args,

Update File Path in Drupal

We have a site that we had been migrating since Drupal 4. Few days back when we tried to migrate the same from Drupal 6 to Drupal 7. There was an issue with respect to file location that was present since previous upgrades. To resolve that a symlink was created called "files" with linked to sites/default/files during D6 upgrade. This led to first loss of many files as Drupal does not handle symlink based file saving well. Secondly the files created were saved under public://files/filename.ext instead of public:://filename.ext which caused created files not being accessible.

User Profiles On Registrations - Per Role

Technologies: 

Dear Dhongis,

We have almost all sites where we have multiple roles and we need a different profile for each role. This was so far rocket science since we did not have a mechanism to create different looking registration forms per user role. We handled this situation post login when we asked people to create profiles as per their roles.

Also, we have an issue of assigning roles when logically a person should be able to choose their role and admins should simple approve or disapprove of it.

Walking by the PC
One September Afternoon
I found the solution
But not very soon

Creating a Drupal 7 Node Programmatically


<?php
/**
* Basic Node Creation Example for Drupal 7
*
* This example:
* - Assumes a standard Drupal 7 installation
* - Does not verify that the field values are correct
*/
$body_text = 'This is the body text I want entered with the node.';

$node = new stdClass();
$node->type = 'article';
node_object_prepare($node); //Creates default settings for the node of a type
$node->title = 'Node Created Programmatically on ' . date('c');
$node->language = LANGUAGE_NONE; //String constant value for "und"

/* If u have body text do the following below