This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Implements hook_node_accces(). | |
*/ | |
function example_schedules_node_access($node, $op, $account) { | |
if ($op !== 'view' && $node->type == 'class') { | |
if($profile = example_account_profile($account->uid)){ | |
if ($profile->type == 'teacher') { | |
if ($op == 'create'){ | |
return NODE_ACCESS_ALLOW; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function MYMODULE_form_alter(&$form, &$form_state, $form_id){ | |
if ($form_id == 'user_register_form') { | |
$fields = array_filter($form['profile_PROFILE_TYPE_NAME'], "_filter_required_fields"); | |
foreach ($fields as $field_name => $field) { | |
$form['profile_PROFILE_TYPE_NAME'][$field_name]['und']['#access'] = false; | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function get_orders($user){ | |
$query = new EntityFieldQuery(); | |
$query->entityCondition('entity_type','commerce_order'); | |
$query->entityCondition('bundle', 'commerce_order'); | |
$query->propertyCondition('user','uid',$user,'='); | |
$results = $query->execute['commerce_order']; | |
if ($results){ | |
return $results; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$view = new view(); | |
$view->name = 'user_autocomplete_example'; | |
$view->description = ''; | |
$view->tag = 'default'; | |
$view->base_table = 'users'; | |
$view->human_name = 'User Autocomplete Example'; | |
$view->core = 7; | |
$view->api_version = '3.0'; | |
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
core = 7.x | |
api = 2 | |
projects[drupal][version] = "7.x" | |
projects[admin_menu][version] = "3.0-rc3" | |
projects[ctools][version] = "1.0" | |
projects[commerce][version] = "1.3" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var bcrypt = require('bcrypt'); | |
load('application'); | |
before(loadUser, {only: ['show', 'edit', 'update', 'destroy']}); | |
before(loadGroups, {only: ['new', 'edit']}); | |
action('new', function () { | |
this.title = 'New user'; | |
this.user = new User; |
NewerOlder