1<?php
2
3/**
4 * Implementation of hook_ctools_plugin_api().
5 */
6function user_profiles_ctools_plugin_api() {
7  list($module, $api) = func_get_args();
8  if ($module == "context" && $api == "context") {
9    return array("version" => 3);
10  }
11  elseif ($module == "panels_mini" && $api == "panels_default") {
12    return array("version" => 1);
13  }
14  elseif ($module == "strongarm" && $api == "strongarm") {
15    return array("version" => 1);
16  }
17}
18
19/**
20 * Implementation of hook_node_info().
21 */
22function user_profiles_node_info() {
23  $items = array(
24    'profile' => array(
25      'name' => t('Profile'),
26      'module' => 'features',
27      'description' => t('A user profile built as content.'),
28      'has_title' => '1',
29      'title_label' => t('Title'),
30      'has_body' => '1',
31      'body_label' => t('Body'),
32      'min_word_count' => '0',
33      'help' => '',
34    ),
35  );
36  return $items;
37}
38
39/**
40 * Implementation of hook_rules_defaults().
41 */
42function user_profiles_rules_defaults() {
43  return array(
44    'rules' => array(
45      'rules_new_user_profile_has_been_created' => array(
46        '#type' => 'rule',
47        '#set' => 'event_node_insert',
48        '#label' => 'New user profile has been created',
49        '#active' => 1,
50        '#weight' => '0',
51        '#categories' => array(
52          '0' => 'moderation queue',
53          'user_profiles' => 'user_profiles',
54        ),
55        '#status' => 'default',
56        '#conditions' => array(
57          '0' => array(
58            '#weight' => 0,
59            '#info' => array(
60              'label' => 'Created content is Profile',
61              'arguments' => array(
62                'node' => array(
63                  'type' => 'node',
64                  'label' => 'Content',
65                ),
66              ),
67              'module' => 'Node',
68            ),
69            '#name' => 'rules_condition_content_is_type',
70            '#settings' => array(
71              'type' => array(
72                'profile' => 'profile',
73              ),
74              '#argument map' => array(
75                'node' => 'node',
76              ),
77            ),
78            '#type' => 'condition',
79          ),
80          '1' => array(
81            '#settings' => array(
82              'roles' => array(
83                '0' => 1271379760,
84              ),
85              'operation' => 'OR',
86              '#argument map' => array(
87                'user' => 'user',
88              ),
89            ),
90            '#type' => 'condition',
91            '#name' => 'rules_condition_user_hasrole',
92            '#info' => array(
93              'label' => 'User has role(s)',
94              'arguments' => array(
95                'user' => array(
96                  'type' => 'user',
97                  'label' => 'User',
98                ),
99              ),
100              'module' => 'User',
101            ),
102            '#weight' => 0,
103            '#negate' => 1,
104          ),
105          '2' => array(
106            '#type' => 'OR',
107            '0' => array(
108              '#info' => array(
109                'label' => 'Created content\'s field \'field_background\' has value',
110                'arguments' => array(
111                  'node' => array(
112                    'type' => 'node',
113                    'label' => 'Content',
114                  ),
115                ),
116                'eval input' => array(
117                  '0' => 'code',
118                  '1' => 'value|0|value',
119                  '2' => 'value|0|format',
120                ),
121                'module' => 'CCK',
122              ),
123              '#negate' => 1,
124              '#name' => 'content_rules_field_has_value',
125              '#settings' => array(
126                'field_name' => 'field_background',
127                '#argument map' => array(
128                  'node' => 'node',
129                ),
130                'value' => array(
131                  '0' => array(
132                    'value' => '',
133                    'format' => '4',
134                  ),
135                ),
136                'code' => 'return array(
137  0 => array(\'value\' => NULL, \'format\' => NULL),
138);',
139                'vars' => array(),
140                '#eval input' => array(
141                  'token_rules_input_evaluator' => array(
142                    'code' => array(
143                      '0' => ':global',
144                    ),
145                    'value|0|value' => array(
146                      '0' => ':global',
147                    ),
148                    'value|0|format' => array(
149                      '0' => ':global',
150                    ),
151                  ),
152                ),
153              ),
154              '#weight' => 0,
155              '#type' => 'condition',
156            ),
157            '#weight' => 0,
158            '1' => array(
159              '#negate' => 1,
160              '#weight' => 0,
161              '#info' => array(
162                'label' => 'Created content\'s field \'field_opinions\' has value',
163                'arguments' => array(
164                  'node' => array(
165                    'type' => 'node',
166                    'label' => 'Content',
167                  ),
168                ),
169                'eval input' => array(
170                  '0' => 'code',
171                  '1' => 'value|0|value',
172                  '2' => 'value|0|format',
173                ),
174                'module' => 'CCK',
175              ),
176              '#name' => 'content_rules_field_has_value',
177              '#settings' => array(
178                'field_name' => 'field_opinions',
179                '#argument map' => array(
180                  'node' => 'node',
181                ),
182                'value' => array(
183                  '0' => array(
184                    'value' => '',
185                    'format' => '4',
186                  ),
187                ),
188                'code' => 'return array(
189  0 => array(\'value\' => NULL, \'format\' => NULL),
190);',
191                'vars' => array(),
192                '#eval input' => array(
193                  'token_rules_input_evaluator' => array(
194                    'code' => array(
195                      '0' => ':global',
196                    ),
197                    'value|0|value' => array(
198                      '0' => ':global',
199                    ),
200                    'value|0|format' => array(
201                      '0' => ':global',
202                    ),
203                  ),
204                ),
205              ),
206              '#type' => 'condition',
207            ),
208            '2' => array(
209              '#type' => 'condition',
210              '#settings' => array(
211                'field_name' => 'field_url',
212                '#argument map' => array(
213                  'node' => 'node',
214                ),
215                'value' => array(
216                  '0' => array(
217                    'value' => '',
218                  ),
219                ),
220                'code' => 'return array(
221  0 => array(\'value\' => NULL),
222);',
223                'vars' => array(),
224                '#eval input' => array(
225                  'token_rules_input_evaluator' => array(
226                    'code' => array(
227                      '0' => ':global',
228                    ),
229                    'value|0|value' => array(
230                      '0' => ':global',
231                    ),
232                  ),
233                ),
234              ),
235              '#name' => 'content_rules_field_has_value',
236              '#negate' => 1,
237              '#info' => array(
238                'label' => 'Created content\'s field \'field_url\' has value',
239                'arguments' => array(
240                  'node' => array(
241                    'type' => 'node',
242                    'label' => 'Content',
243                  ),
244                ),
245                'eval input' => array(
246                  '0' => 'code',
247                  '1' => 'value|0|value',
248                ),
249                'module' => 'CCK',
250              ),
251              '#weight' => 0,
252            ),
253            '5' => array(
254              '#type' => 'condition',
255              '#settings' => array(
256                'boolean' => '<?php echo ($node->field_image[0][\'fid\'] ? 1 : 0); ?>',
257                '#eval input' => array(
258                  'token_rules_input_evaluator' => array(
259                    'boolean' => array(
260                      '0' => ':global',
261                    ),
262                  ),
263                  'rules_input_evaluator_php' => array(
264                    'boolean' => array(
265                      '0' => 'node',
266                    ),
267                  ),
268                ),
269              ),
270              '#name' => 'rules_condition_check_boolean',
271              '#info' => array(
272                'label' => 'New profile has avatar',
273                'label callback' => FALSE,
274                'arguments' => array(
275                  'boolean' => array(
276                    'type' => 'boolean',
277                    'label' => 'Truth value',
278                  ),
279                ),
280                'module' => 'Rules',
281              ),
282              '#weight' => 0,
283            ),
284            '6' => array(
285              '#weight' => 0,
286              '#info' => array(
287                'label' => 'New profile has profile image',
288                'label callback' => FALSE,
289                'arguments' => array(
290                  'boolean' => array(
291                    'type' => 'boolean',
292                    'label' => 'Truth value',
293                  ),
294                ),
295                'module' => 'Rules',
296              ),
297              '#name' => 'rules_condition_check_boolean',
298              '#settings' => array(
299                'boolean' => '<?php echo ($node->field_profile_image[0][\'fid\'] ? 1 : 0); ?>',
300                '#eval input' => array(
301                  'token_rules_input_evaluator' => array(
302                    'boolean' => array(
303                      '0' => ':global',
304                    ),
305                  ),
306                  'rules_input_evaluator_php' => array(
307                    'boolean' => array(
308                      '0' => 'node',
309                    ),
310                  ),
311                ),
312              ),
313              '#type' => 'condition',
314            ),
315          ),
316        ),
317        '#actions' => array(
318          '1' => array(
319            '#weight' => 0,
320            '#info' => array(
321              'label' => 'Mark content for moderation',
322              'arguments' => array(
323                'node' => array(
324                  'type' => 'node',
325                  'label' => 'Content',
326                ),
327              ),
328              'module' => 'BOINC core',
329            ),
330            '#name' => 'boinccore_rules_action_mark_content_for_moderation',
331            '#settings' => array(
332              '#argument map' => array(
333                'node' => 'node',
334              ),
335            ),
336            '#type' => 'action',
337          ),
338        ),
339        '#version' => 6003,
340      ),
341      'rules_user_profile_has_been_modified' => array(
342        '#type' => 'rule',
343        '#set' => 'event_node_update',
344        '#label' => 'User profile has been modified',
345        '#active' => 1,
346        '#weight' => '0',
347        '#categories' => array(
348          '0' => 'moderation queue',
349          'user_profiles' => 'user_profiles',
350        ),
351        '#status' => 'default',
352        '#conditions' => array(
353          '0' => array(
354            '#type' => 'condition',
355            '#settings' => array(
356              'type' => array(
357                'profile' => 'profile',
358              ),
359              '#argument map' => array(
360                'node' => 'node',
361              ),
362            ),
363            '#name' => 'rules_condition_content_is_type',
364            '#info' => array(
365              'label' => 'Created content is Profile',
366              'arguments' => array(
367                'node' => array(
368                  'type' => 'node',
369                  'label' => 'Content',
370                ),
371              ),
372              'module' => 'Node',
373            ),
374            '#weight' => 0,
375          ),
376          '1' => array(
377            '#negate' => 1,
378            '#info' => array(
379              'label' => 'User has role(s)',
380              'arguments' => array(
381                'user' => array(
382                  'type' => 'user',
383                  'label' => 'User',
384                ),
385              ),
386              'module' => 'User',
387            ),
388            '#name' => 'rules_condition_user_hasrole',
389            '#settings' => array(
390              'roles' => array(
391                '0' => 3519698132,
392                '1' => 1271379760,
393              ),
394              'operation' => 'OR',
395              '#argument map' => array(
396                'user' => 'user',
397              ),
398            ),
399            '#type' => 'condition',
400            '#weight' => 0,
401          ),
402          '2' => array(
403            '#weight' => 0,
404            '#info' => array(
405              'label' => 'Compare two users',
406              'arguments' => array(
407                'user1' => array(
408                  'type' => 'user',
409                  'label' => 'User account 1',
410                ),
411                'user2' => array(
412                  'type' => 'user',
413                  'label' => 'User account 2',
414                ),
415              ),
416              'module' => 'User',
417            ),
418            '#name' => 'rules_condition_user_comparison',
419            '#settings' => array(
420              '#argument map' => array(
421                'user1' => 'user',
422                'user2' => 'author',
423              ),
424            ),
425            '#type' => 'condition',
426          ),
427          '3' => array(
428            '#type' => 'OR',
429            '0' => array(
430              '#info' => array(
431                'label' => 'Updated content\'s field \'field_background\' has been changed',
432                'arguments' => array(
433                  'node' => array(
434                    'type' => 'node',
435                    'label' => 'Content containing changes',
436                  ),
437                  'node_unchanged' => array(
438                    'type' => 'node',
439                    'label' => 'Content not containing changes',
440                  ),
441                ),
442                'module' => 'CCK',
443              ),
444              '#name' => 'content_rules_field_changed',
445              '#settings' => array(
446                'field_name' => 'field_background',
447                '#argument map' => array(
448                  'node' => 'node',
449                  'node_unchanged' => 'node_unchanged',
450                ),
451              ),
452              '#type' => 'condition',
453              '#weight' => 0,
454            ),
455            '#weight' => 0,
456            '1' => array(
457              '#weight' => 0,
458              '#info' => array(
459                'label' => 'Updated content\'s field \'field_opinions\' has been changed',
460                'arguments' => array(
461                  'node' => array(
462                    'type' => 'node',
463                    'label' => 'Content containing changes',
464                  ),
465                  'node_unchanged' => array(
466                    'type' => 'node',
467                    'label' => 'Content not containing changes',
468                  ),
469                ),
470                'module' => 'CCK',
471              ),
472              '#name' => 'content_rules_field_changed',
473              '#settings' => array(
474                'field_name' => 'field_opinions',
475                '#argument map' => array(
476                  'node' => 'node',
477                  'node_unchanged' => 'node_unchanged',
478                ),
479              ),
480              '#type' => 'condition',
481            ),
482            '2' => array(
483              '#type' => 'condition',
484              '#settings' => array(
485                'field_name' => 'field_url',
486                '#argument map' => array(
487                  'node' => 'node',
488                  'node_unchanged' => 'node_unchanged',
489                ),
490              ),
491              '#name' => 'content_rules_field_changed',
492              '#info' => array(
493                'label' => 'Updated content\'s field \'field_url\' has been changed',
494                'arguments' => array(
495                  'node' => array(
496                    'type' => 'node',
497                    'label' => 'Content containing changes',
498                  ),
499                  'node_unchanged' => array(
500                    'type' => 'node',
501                    'label' => 'Content not containing changes',
502                  ),
503                ),
504                'module' => 'CCK',
505              ),
506              '#weight' => 0,
507            ),
508            '4' => array(
509              '#type' => 'AND',
510              '#weight' => 0,
511              '1' => array(
512                '#weight' => 0,
513                '#info' => array(
514                  'label' => 'Modified profile has profile image',
515                  'label callback' => FALSE,
516                  'arguments' => array(
517                    'boolean' => array(
518                      'type' => 'boolean',
519                      'label' => 'Truth value',
520                    ),
521                  ),
522                  'module' => 'Rules',
523                ),
524                '#name' => 'rules_condition_check_boolean',
525                '#settings' => array(
526                  'boolean' => '<?php echo ($node->field_profile_image[0][\'fid\'] ? 1 : 0); ?>',
527                  '#eval input' => array(
528                    'token_rules_input_evaluator' => array(
529                      'boolean' => array(
530                        '0' => ':global',
531                      ),
532                    ),
533                    'rules_input_evaluator_php' => array(
534                      'boolean' => array(
535                        '0' => 'node',
536                      ),
537                    ),
538                  ),
539                ),
540                '#type' => 'condition',
541              ),
542              '0' => array(
543                '#info' => array(
544                  'label' => 'Modified profile image is different from previous profile image',
545                  'label callback' => FALSE,
546                  'arguments' => array(
547                    'boolean' => array(
548                      'type' => 'boolean',
549                      'label' => 'Truth value',
550                    ),
551                  ),
552                  'module' => 'Rules',
553                ),
554                '#name' => 'rules_condition_check_boolean',
555                '#settings' => array(
556                  'boolean' => '<?php echo ($node->field_profile_image[0][\'fid\'] != $node_unchanged->field_profile_image[0][\'fid\']); ?>',
557                  '#eval input' => array(
558                    'token_rules_input_evaluator' => array(
559                      'boolean' => array(
560                        '0' => ':global',
561                      ),
562                    ),
563                    'rules_input_evaluator_php' => array(
564                      'boolean' => array(
565                        '0' => 'node',
566                        '1' => 'node_unchanged',
567                      ),
568                    ),
569                  ),
570                ),
571                '#type' => 'condition',
572                '#weight' => 1,
573              ),
574            ),
575            '3' => array(
576              '#weight' => 1,
577              '#type' => 'AND',
578              '1' => array(
579                '#type' => 'condition',
580                '#settings' => array(
581                  'boolean' => '<?php echo ($node->field_image[0][\'fid\'] ? 1 : 0); ?>',
582                  '#eval input' => array(
583                    'token_rules_input_evaluator' => array(
584                      'boolean' => array(
585                        '0' => ':global',
586                      ),
587                    ),
588                    'rules_input_evaluator_php' => array(
589                      'boolean' => array(
590                        '0' => 'node',
591                      ),
592                    ),
593                  ),
594                ),
595                '#name' => 'rules_condition_check_boolean',
596                '#info' => array(
597                  'label' => 'Modified profile has avatar',
598                  'label callback' => FALSE,
599                  'arguments' => array(
600                    'boolean' => array(
601                      'type' => 'boolean',
602                      'label' => 'Truth value',
603                    ),
604                  ),
605                  'module' => 'Rules',
606                ),
607                '#weight' => 0,
608              ),
609              '0' => array(
610                '#weight' => 1,
611                '#info' => array(
612                  'label' => 'Modified profile avatar is different from previous avatar',
613                  'label callback' => FALSE,
614                  'arguments' => array(
615                    'boolean' => array(
616                      'type' => 'boolean',
617                      'label' => 'Truth value',
618                    ),
619                  ),
620                  'module' => 'Rules',
621                ),
622                '#name' => 'rules_condition_check_boolean',
623                '#settings' => array(
624                  'boolean' => '<?php echo ($node->field_image[0][\'fid\'] != $node_unchanged->field_image[0][\'fid\']); ?>',
625                  '#eval input' => array(
626                    'token_rules_input_evaluator' => array(
627                      'boolean' => array(
628                        '0' => ':global',
629                      ),
630                    ),
631                    'rules_input_evaluator_php' => array(
632                      'boolean' => array(
633                        '0' => 'node',
634                        '1' => 'node_unchanged',
635                      ),
636                    ),
637                  ),
638                ),
639                '#type' => 'condition',
640              ),
641            ),
642          ),
643        ),
644        '#actions' => array(
645          '1' => array(
646            '#weight' => 0,
647            '#info' => array(
648              'label' => 'Mark content for moderation',
649              'arguments' => array(
650                'node' => array(
651                  'type' => 'node',
652                  'label' => 'Content',
653                ),
654              ),
655              'module' => 'BOINC core',
656            ),
657            '#name' => 'boinccore_rules_action_mark_content_for_moderation',
658            '#settings' => array(
659              '#argument map' => array(
660                'node' => 'node',
661              ),
662            ),
663            '#type' => 'action',
664          ),
665        ),
666        '#version' => 6003,
667      ),
668    ),
669  );
670}
671
672/**
673 * Implementation of hook_views_api().
674 */
675function user_profiles_views_api() {
676  return array(
677    'api' => '2',
678  );
679}
680