Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
0 votes
1 answer
791 views

Integer user form field with min 11 digits and max 11 digits

I need an integer form field with has a validation of min 11 digits and max 11 digits. In other words; the user has to fill in an 11 digit code. How do i make this field and validation? Update: I ...
2 votes
3 answers
1k views

Node access based on view mode

I have a content type with multiple fields. Some of the fields are accessible to everyone and there are other fields for which the access is controlled. Example: There is a content type called ...
12 votes
3 answers
6k views

How to bypass node_access when using EntityFieldQuery?

With the following code, if the current user does not have 'bypass node access' (see _node_query_node_access_alter() for exact verifications), then the query checks for node_access, even though I do ...
20 votes
4 answers
15k views

How to hide a custom user field in user profile?

In Drupal 7, what is the best way to prevent any non-administrative user from changing a custom user profile field? Use case: I've created a user field called "Customer ID" that I do not want the ...
1 vote
5 answers
3k views

How to customize a textarea field?

I have created a textarea field using admin ui. It allows users to add Bio to their profile. I want to do 2 things with this field. Limit the characters to 255. Use a text format. Note: I do not want ...
0 votes
3 answers
1k views

Adding field collections programmatically

I'm trying to add a field collection to my user account on an event, and it seems to be being created properly, the fields are updated as expected and it parents it to the user account, however, even ...
0 votes
4 answers
1k views

Anyone manage to work entity metadata wrapper with profile2 entity?

Code: $profile = profile2_load_by_user($account); $profile = $profile['main']; $wrapper = entity_metadata_wrapper('profile2_type', $profile); $wrapper->field_first_name->set(...
0 votes
1 answer
409 views

Entity Reference - User reference field Hide "Restricted access" label instead of showing useless choices

i have an entity reference (7.x-1.5) select-list within a checkout pane which is being used to allow the user to attach a child to a product during a checkout process. The user can add multiple "...
0 votes
1 answer
76 views

Update user profile picture using entity_metadata_wrapper

I am trying to update the user profile picture using entity_metadata_wrapper. But I am getting "Unknown data property picture." error. When I check the user property info, I cant see the ...
5 votes
3 answers
3k views

How do I create extra permissions for an eck created entity?

I have created an entity using Entity Construction Kit (ECK) and wish to add extra permissions for that entity such as view own, edit own and delete own. I see there has been some movement in this ...
0 votes
1 answer
686 views

Creating custom field with Display Suite and Profile 2

I am trying to use Display Suite (newest version) to format the profile page for users. I am using the Profile2 module and the default main-profile type. I have the user's full name (not username) ...
2 votes
4 answers
3k views

How not to display some required fields on registration form?

My user form is pretty long and many of the fields are required. However I don't want to discourage lazy users from registering. I would like them to register and pay first then make them fill out the ...
3 votes
1 answer
1k views

Programatically create field collection into Profile2 on new user creation

I've set up my own custom multi-step registration form, because I just couldn't find a way of making anything out there do what I want. I've found other questions on here like this one and this one ...
0 votes
2 answers
176 views

How to let user add multiple sub-content fields in the main content?

If I want user to create a main content which can be able to add multiple sub-content for example I wanna do apartment renting website. User have to create the apartment details which contain these ...
1 vote
1 answer
234 views

List of images with checkbox (user registration)

This is what I would like to do: When a user registers on the website they have to give in if some options like for example if they are politically engaged, professionally engaged, an expert, ... . ...
0 votes
0 answers
66 views

How to get a list of users based on the radius?

I want to allow users (workers) to give their address using addressfield and also give a distance or radius they are prepared to travel. It is a job site. When a client posts a job (node) and provides ...
2 votes
1 answer
103 views

Create a hidden character field?

How can I create a hidden character field in D7 for a text field that hides the user input like the password field does? For example a field called "social security number" should not display the ...
0 votes
1 answer
94 views

How to grant referenced user access to Profile page

I use Node access user reference module in many projects. I have a very similar task: Grant access to a profile page for those user who is referenced in that profile. Unfortunately, Node access user ...
2 votes
1 answer
65 views

How to delete all Drupal content owned by a particular user?

It seems like there should be a drush command to achieve this, but I cannot find one. I am not clever enough to fashion an SQL query that will delete all nodes owned by a user as well as clean up all ...
0 votes
1 answer
228 views

Adding multiple users to a field using user/autocomplete

I have the following code to add a field to my custom module to add in users. But I can only add in one user using the user/autocomplete feature. $form['usershare'] = array( '#title' => t('...
4 votes
3 answers
1k views

altering user_admin_account form

I am working to change the standard display when pressing the "People" button. Instead of showing "Username" I want it to show a custom field. For example "Last name". I almost made it work, but the ...
1 vote
1 answer
269 views

How to create access permissions system similar to Organic Groups access, using Eck entities

There currently still is not a working version for Organic Groups access control, compatible with ECK entities. My current site contains entity type project and entity type project content. The ...
0 votes
1 answer
31 views

User referencing another user causes unexpected error

I have a Drupal 7 site with a bunch of users. Some are clients and others are sellers (role). I put an entity reference field field_seller on the user account form which filters users with the seller ...
0 votes
1 answer
15 views

How can I show field from profile2 instead of username depends on user's role?

I have 2 profile2 types (and two common user roles) - "employer" and "applicant". I have "field_company_name" in "profile_employer" and "field_real_name" in "profile_applicant". I want to show ...
0 votes
2 answers
375 views

Create user profile using content type or add additional fields to the default registration form

I am good enough to build an entire drupal 7 website but my problem goes below: I am in the process of building a very simple drupal website for all volunteers in my country. So every volunteer will ...
0 votes
1 answer
74 views

Creating/registering a user (of a custom profile type) when a certain webform is submitted?

Before all else - Here's my current code. function hook_webform_submission_insert($node, $submission) { $password = user_password(8); //set up the user fields $new_user = array( 'name' =&...
2 votes
1 answer
79 views

How to calculate user scores based on 3 variables to assign an appropriate text label?

I need to calculate a score for users in D7 based on 3 variables and then assign an appropriate text label and a CSS class. So, using data from Voting API, time ago joined, and number of nodes ...
2 votes
1 answer
172 views

Custom access callbacks for user entities not being called

I'm trying to implement some custom access control for user entities, in Drupal 7. I've used hook_entity_info_alter to set $entity_info['user']['access callback'] = 'MYMODULE_user_access_callback'; ...
0 votes
1 answer
358 views

Specified template file for user-profile-form based on role

I use drupal 7.x and field_group and nultiple registration module. How I can use a template file (.tpl) for user-profile-form only based on roles. in other words when a user with A role login to site ...
2 votes
1 answer
139 views

How to create report to list users who change only specific field?

I have a content type with several fields which are updated manually over time by different users. Let's say, for example, the content type name is Ticket and the fields in this content type are: ...
0 votes
1 answer
115 views

How to approximate user location on IP&Geoloc maps

I'm using the combinaison of this modules : Address field Geofield Ip&Geoloc Leaflet I need to approximate the location of user's markers on the map for privacy reason. For exemple if somebody ...
0 votes
1 answer
91 views

How to make user picture editable without opening edit profile page?

I wanted to allow users to edit profile without going to edit profile page. I found few useful modules like Editable field and Editable fields as link. These modules provide field formatter which make ...
0 votes
1 answer
36 views

Why are custom User Account fields not shown after account is saved?

Just upgraded to Drupal 7.54 and now when a user account is saved, any other users (other than admin 1 user) are unable to view or update the custom fields associated with the user account. They just ...
0 votes
0 answers
217 views

How to clear cache only for users's field?

I have some cache issues on website when I run some process. I'm looking for a way for clear cache only for user's fields from a custom module. K dn't want clear all cache for save performances. I ...
1 vote
1 answer
24 views

How to restrict field permissions to referenced user?

I have a submit-review process where submitters choose their reviewer. The reviewers are linked By User Reference module. Submissions are public but have an Accept/Deny review button implemented with ...
1 vote
1 answer
59 views

Profile 2, user relation access? A hard one!

The site contains 2 user types besides admin, lets call the 2 user types "Private" and "Corporate". Private users have a "profile 2" type, where alot of different fields are filled. In a view or ...
0 votes
1 answer
445 views

allowed values for node/entity/user reference field

Can you get allowed values for reference field? i tried with: $all_fields_info = field_info_fields(); $allowed_values= list_allowed_values($all_fields_info["field_user_ref"]); but it is not working ...
1 vote
2 answers
85 views

How to migrate data from custom user account fields to a single new field?

For my Drupal 7 User Accounts I have 5 separate fields (Field Type: Boolean, Widget: 'Single on/off checkbox') used to indicate comms preferences. Without losing any data I want to migrate these ...
1 vote
2 answers
810 views

Restrict User Roles in viewing a Node Content Type without installing a module

Currently I want to keep my site slim without having to install big modules to do a small function. I know I can use the content_access module to restrict a user role to view a specific content type, ...
1 vote
1 answer
120 views

How to make the Rules module block flagged users from sending entityform submissions?

I am trying to create a simple block user functionality on my site. I have a "Block/Unblock User" Flag that other users can block and unblock so they stop getting contact emails from (via entityform) ...
4 votes
2 answers
890 views

Display roles in profile?

I'm trying to display roles in the default user profile (no profile2) with consistent formatting to the other fields being displayed. In user-profile.tpl.php I have this: <div class="profile"<?...
1 vote
2 answers
196 views

How to implement moderation of data entered through user profile pages?

I am in need of a means of moderating data entered through a user's profile page, or at least for certain specified fields, both upon initial submission and after any revision. These are fields that ...
5 votes
1 answer
6k views

Restricting Field Access by Role

I'm working on a site in which I'd like anon users to be able to create nodes of a certain type, but I only want them to be able to see/edit some of the fields on that content type. I can't go into ...
2 votes
1 answer
34 views

Should I create a role for every user?

On Drupal 7 I have tested many modules, because I simply want in the user view some fields which are public and others can only see friends (user relationship or flag friend, ...). would be nice if I ...
1 vote
1 answer
101 views

Save certain registration fields elsewhere in database

This is for Drupal 7. I am trying to write my first real custom module but I'm running into some difficulty and I'm just not sure how to look for my answers. I've created a new entity for my module (...
1 vote
0 answers
38 views

How do prepopulate a Field Type Postal Address with values from a user profile

I'm using address field module (addressfield-7.x-1.2) and I don't know how to prepopulate the address field from users profile2 (profile2-7.x-1.3) addressfield I managed to prepopulate other single ...
1 vote
2 answers
10k views

Updating user fields in Drupal 7

I have created several custom fields for my Drupal 7 users, which I imported from an external users table. I am now trying to automate the population of these custom fields using a custom module, ...
1 vote
0 answers
12 views

Render a content based on access permission

I have two content_types,Type_A and Type_B. I have referenced one field in Type_B to Type_A by using entity reference type. But when the particular Type_A node is not published,then also anonymous ...
8 votes
2 answers
4k views

How to check for entity access when displaying views fields?

I have a custom entity. There is an access callback defined in hook_entity_info() and it is called when I access the entity. Also in views when I select to display rendered entities, the entity is ...
2 votes
1 answer
431 views

How to use Rules to disable access to selected fields while editing an existing node?

Based on couple of features I require to restrict/disable access to certain field based on other fields while editing the node. The problem is that in Rules module, there's no "While editing an ...