-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME.txt
More file actions
79 lines (58 loc) · 2.9 KB
/
README.txt
File metadata and controls
79 lines (58 loc) · 2.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
The User Reference URL Widget module adds a new widget to the User Reference
field type. It auto-populates a user reference field with a value from the URL,
and does not allow this value to be changed once set.
Dependencies
------------
* User Reference (part of References)
Install
-------
Installing the User Reference URL Widget is simple:
1) Copy the userreference_url folder to the sites/all/modules folder in your
installation.
2) Enable the module using Administer -> Modules (admin/modules)
3) Add or edit a User Reference field from admin/structure/types/manage/[type]/fields.
When configuring the field, use the "Reference from URL" option.
4) Follow on-screen help text to configure your Node Reference URL Widget.
Advanced: Build your own links
------------------------------
Normally you can prepopulate a User Reference URL widget simply by creating a
link with the following structure:
As HTML:
<a href="/node/add/story/10">Add a story</a>
Or in PHP code:
<a href="<?php print url('node/add/story/' . $user->uid); ?>">Add a story</a>
However if using multiple Node Reference fields, you can populate them by
using a query string instead of embedding the IDs directly in the URL. Assuming
you had two fields, named "field_ref_a" and "field_ref_b", the URL to
prepopulate both of them at the same time would look like this:
In HTML:
<a href="/node/add/story?ref_a=10&ref_b=20">Add a story</a>
Or in PHP code:
<a href="<?php print url('node/add/story', array('query' => array('ref_a' => $uid1, 'ref_b' => $uid2))); ?>">Add a story</a>
Advanced: Support for non-standard URLs
---------------------------------------
By default User Reference URL Widget will only work with node form paths that
match the standard Drupal install: "node/add/%type", where %type is a node type
like "blog" or "story". If you want to use User Reference URL Widget on
non-standard URLs, you may do so by informing User Reference URL Widget of these
special paths.
To do so, add additional paths to your settings.php with the following code:
$conf['userreference_url_paths'] = array(
'node/add/%type/%uid',
'node/%/add/%type/%uid',
);
Only two tokens are supported:
%type: The node type that will be created.
%uid: The node ID that will be referenced.
The % wildcard may be used when including other dynamic IDs.
In the above example, Node Reference URL Widget will work at either
"node/add/story/2" or "node/1/add/story/2", where "2" is the user ID being
referenced. Important to note: The first URL will be used in the links that User
Reference URL Widget provides. If needing advanced configuration of links, look
into the Custom Links module: http://drupal.org/project/custom_links.
Support
-------
If you experience a problem with this module or have a problem, file a
request or issue in the User Reference URL Widget queue. DO NOT POST IN THE FORUMS.
Posting in the issue queues is a direct line of communication with the module
authors.