Add users from a text file to a Drupal User Role

Hypertufa Mix
Hypertufa Garden Pots @ 10 years

Add users from a text file to a Drupal User Role

#!/bin/bash

# Add Users To a Specific Role
# Setup These Variables

# Set Site Path
sitepath="/opt/var/www/htdocs/"

# Set Site Name
site="example.com"

# add user to ContentAuthor
#echo "Add users to ContentAuthor role"
cat example-users.txt | while read line
do
drush -d -r $sitepath -u 1 -l $site user-add-role "ContentAuthor" $line

#echo $line
done
 

#####################
#
# Drupal 7 Example - used for printing fields in template files
# Check if a field exists, then do something

$public_field_location = field_get_items('node', $node, 'field_public_display_location');

if ($public_field_location) {
// do something
echo "<div id=\"node_section\"><h2> Where: </h2><div id=\"node_section_text\"> ";
print render($content['field_public_display_location']);
echo "</div></div>";
} else {
echo " No public location Set" ;
}