All Questions
294 questions
0
votes
1
answer
1k
views
How to make the permissions of a module more granular?
Assume a (contributed) D7 module, say module ABC, comes with only a few permissions (which can be set on the typical /admin/people/permissions page). For example:
Administer module ABC.
Access (view) ...
2
votes
1
answer
1k
views
Rule to store user's last post date and scheduled rule based 30 day reminder
In this scenario, user's can post 1 node of a specific content type every 30 days (interval changes depending on user role). We are using node_limit to accomplish this; it's doesn't play with rules.
...
2
votes
1
answer
347
views
Which user related token(s) can be used to create a Rule for setting up a message type?
I have created few activity logs using the Message module. All works ok, but when I try to create a message type for example "username started following you on github". When setting up the rules for ...
51
votes
6
answers
44k
views
Programmatically create a user and assign a role
I'm programmatically creating a user with the following code.
$newUser = array(
'name' => $mail,
'pass' => 'password', // note: do not md5 the password
'mail' => $mail,
'status' =&...
21
votes
3
answers
16k
views
How do I create a multisite with shared users and nodes? [closed]
I want to create a multisite with Drupal 7: Every site works separately but users, and nodes must be shared among the sites.
How do I achieve it?
11
votes
10
answers
7k
views
How do I enable comments for user profiles?
With users being entities in D7 I assumed the user type would would have built in "comment" option. That doesn't seem to be the case.
I just want to allow users to leave comments on the user profile ...
4
votes
3
answers
686
views
How to prevent access to Views-only content?
When I'm developing sites in Drupal, I create various content types and taxonomy vocabularies that I use with Views to build displays. I might not ever want the nodes to be viewable in their own right ...
44
votes
7
answers
46k
views
How do I programmatically log in a user?
I am looking for the API that will let me login a user by passing it the username and password.
Does anyone have experience with this?
To clarify, I am trying to make an AJAX login box that appears as ...
38
votes
4
answers
8k
views
How do I debug permissions?
How do I debug permissions in Drupal 7?
I use core reporting, error logs, devel module error logs, backtrace and node access permission block but sometimes it is not enough.
What else should I check ...
9
votes
2
answers
19k
views
How can I display a change password form on its own?
I have a need to place a user's password reset form in areas outside the context of the user edit page.
This Change Password module looked promising; however, it is only available for drupal 6 and ...
1
vote
1
answer
3k
views
How can I display a picture from a field as the user picture rather than the drupal default with user-picture.tpl.php?
Because my site requires user pictures to be approved, the default Drupal user picture is not suitable.
Instead, I want to show a picture from a field in each user's profile as the user's profile ...
1
vote
2
answers
5k
views
drupal /?q=user is working but /user not working
I have recently moved my files from dev server to test server. same setting and db of dev server were copied to test server. In dev server all is working fine but when I have am checking in test sever ...
4
votes
2
answers
10k
views
Adding more fields to the registration process
In Drupal 7, is there a way to add more fields to the registration process? I was thinking along the lines of birthday, fullname, gender, twitter, etc. Also how do I access this data once it's in, so ...
1
vote
1
answer
6k
views
Field level permissions in Drupal 7
What is the best way to create a piece of content with multiple fields... allowing users to edit the content as a whole yet blocking the ability to edit.
The setup I have is a piece of content that ...
48
votes
8
answers
75k
views
Check if a user has a role
How can I check if a user has a certain role?
20
votes
4
answers
12k
views
Send user's password in mail
I want to send a reminder email to the users to log in to my website with their username and password. My mail script is ready with the login ID, but I don't know how to decrypt the user's password.
...
18
votes
2
answers
12k
views
How to prevent user registration
I'm getting a couple of user registrations on my personal website (presumably from bots or people trying to hack my site). How do I disable new user registration entirely?
9
votes
2
answers
1k
views
"changed by" on nodes
mysql> select nid, uid, created, changed from node;
+-----+-----+------------+------------+
| nid | uid | created | changed |
+-----+-----+------------+------------+
| 1 | 8 | 1336040166 |...
8
votes
3
answers
5k
views
How to display a flag to anonymous users?
I'm using the Flag module, but I have a problem in displaying a flag to anonymous users.
I have 2 flags called "make feature" and "add to Favorites". I want to display this flag to anonymous users ...
8
votes
3
answers
5k
views
In hook_user_login is there a way to know if this is the first time the user has logged in?
I'm overriding hook_user_login to redirect users to a specific page when they log in. The problem is I'm using the verification email setting on registration which requires the user to set their ...
8
votes
4
answers
2k
views
How can anonymous users be allowed to post while still maintaining content integrity?
A little background: As you see on http://charlotte.ebayclassifieds.com, if you click 'post an ad' and then choose a category, you can fill out the form and submit content without having to sign up. ...
4
votes
4
answers
6k
views
After logging off, a user is able to see the pages by pressing back button of the browser
I have a requirement in which the user should not be able to see the books in the site unless he is logged in. And the user is not able to see the content.
The problem is when a user logs in, views a ...
2
votes
1
answer
847
views
How to revoke edit access to the node's author after publishing a node?
I am trying to build a new rule on Drupal 7 with both the Rules and Content Access modules (and its sub module Content Access Rules integration). Thus, I get new actions like "grant or revoke an ...
2
votes
2
answers
252
views
Custom Login form question
In my website have two types people login one is designer another is reader, i want people come to login my website by role. Mean designer go to design login form to login. Reader go to reader login ...
23
votes
5
answers
39k
views
How to add extra fields to user profile?
I'd like to add additional fields to the user profile. I'd like user to be able to edit almost all the information I store in the database about him.
I have some ideas: maybe it's possible to do ...
18
votes
3
answers
27k
views
How do I find the role id from role name?
On log in I want to check a third party data source (table in the db) for a user, and if found I want to add a role to that user.
I don't want to guess the rid of the role, I want to get it from the ...
17
votes
1
answer
14k
views
How to programmatically create new user with custom fields?
I want to create user with some custom fields. I have created extra fields through config > people > site information > manage fields and fields like first name, last name, city etc. I want to create ...
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 ...
11
votes
4
answers
10k
views
Print registration and login forms on same page
How do I print the register and login forms on the same page?
I think I am really looking just for the form IDs, but if you've got the right render function handy it would be very appreciated.
9
votes
5
answers
6k
views
How do I programmatically assign the access to a block?
I have created a block programmatically but I don't know how I can programmatically assign the access to it. How can I achieve it?
8
votes
2
answers
9k
views
No one can login and access denied message
The site worked till yesterday and just now it's behaving strangely.
The site is not created with features, an archive dump including the code and database is copied to server, and the old ...
8
votes
1
answer
14k
views
Changing the registration form
I would like to revise the default new user registration form in Drupal 7.
Rather than to requst "username", I want to request "full name" with helper instructions to enter the text "username is your ...
6
votes
2
answers
4k
views
Select organic group on the user registration form
There's a post already on the post installation forum, but I'm not sure if this is a OG bug. http://drupal.org/node/1108884
I am using Drupal 7 and OG 7.x-2.1 version. There is no "Group Audience" in ...
6
votes
2
answers
593
views
What approach for showing custom user fields on a node?
I've added a few custom user fields which users complete when registering.
What is the simplest approach to show these fields when viewing content that user has created?
For example, when viewing a ...
6
votes
1
answer
3k
views
New User Registration Sequence for Services 3.4?
This comment outlines a working way to login with the new CSRF token:
POST to /rest/user/login (nothing in headers). Construct the $cookie from session name + id
GET to /services/session/token (...
4
votes
2
answers
3k
views
How can I allow users to cancel their accounts without requiring e-mail confirmation?
In Drupal 7, users can cancel their accounts from the account settings page. However, by default this requires e-mail confirmation.
There is an option "Require e-mail verification when a visitor ...
3
votes
2
answers
504
views
How to implement a Rules Condition like [account:last-login] = never?
Here is my contextual explanation:
I would like to redirect on a special page for first time after login. But registering system is using an email validation, so the path to the first login is "user/...
3
votes
2
answers
1k
views
How can I get the real password via hook_user_update()?
I want to change the current user password, and get the new password(the real password, not md5 encryption) when edit the account profile via user profile form(e.g.: example.com/user/1/edit) and save. ...
2
votes
1
answer
94
views
How to implement admin verification for selected user profile fields?
After the user fills the registration form, if the profile is appropriate, the administrator user approves it, and the profile goes live; if it is not appropriate, the administrator user will reject ...
1
vote
1
answer
1k
views
Node Access User Reference module tries to grant access twice, creates integrity violation
I have a site (7.18) in which I want to grant teachers access to assignments created by their students. My current solution is to set a teacher for each student, using a User Reference field. I then ...
0
votes
2
answers
1k
views
Send user a reminder email after x-number of days if Profile2 field is empty and user has specific role
I have a multi-step user signup process. When the user creates their account, they are assigned role "A" and are redirected to a Profile2 form with various fields. If they complete and save their ...
0
votes
1
answer
289
views
User Relationships view showing the right number of users, but showing my profile link, not theirs
I'm not very good with Views and Panes, but I've almost completely managed to get what I want working.
I have User Relationships configured to have non-reciprocal relationships (so like Twitter, ...
18
votes
2
answers
30k
views
Do you have an example of hook_menu() access callback?
I have downloaded the examples project, but in the menu_example module all the access callback are set to true.. hard to understand how it works.
In my example, my meno entry should be visible on ...
15
votes
3
answers
19k
views
How to track and display selected user activities in a site?
I wonder how to track and display user activities in a Drupal site. Examples of such activities are:
posts.
comments.
page posts.
I've found some modules that track the users' activites all over the ...
14
votes
7
answers
355
views
Is it possible to make a second "edit account" page that only allows users to edit some profile fields?
So here is my situation: users on my site have to fill out a rather large number of fields upon registration. However, after they register, only four (out of about twenty) of these fields need to be ...
12
votes
4
answers
10k
views
Programmatically assign user role
I have multiple roles on my website, and I want to assign a certain role to some users when they register to my site.
How can I assign a specific role to new users programmatically when they submit ...
11
votes
1
answer
7k
views
How to display a profile form using profile2 module
Profile2 is a module that uses entities to create profiles that are separate from the user account.
From within my module, I want to be able to display a form to edit the profile entities. Possibly ...
10
votes
2
answers
6k
views
How to create user with role(s) through REST service?
I could able to create a new user by the following JSON format.(Using POSTER add-on to post this data to REST service.)
{
"name":"user34",
"pass":"3323",
"mail":"[email protected]",
"...
10
votes
1
answer
2k
views
Programmatically impersonating another user without causing the currently logged-in user to log out
How should a module change the value of the global $user, execute its own code, and restore the original value of $user without causing the current user to be logged out if an error happens?
9
votes
2
answers
5k
views
Show menu items with limit access to anonymous users
I have a website that uses Private module in order set the access to the content, and of course some of my pages have menu items. Now if I set a page to be private, only users with proper permission ...