Modify existing user-based field via a form

1 reply [Last post]
mariagwyn
Offline
Last seen: 7 years 21 weeks ago
Joined: 2011-08-17

I am trying to create a form which allows the submission of a specific user-based field ("sign this") without having the user return to their account page. Since the field is boolean, it creates a table entry every time a user is created. So...

  1. If the user is no logged in, the form needs to allow the creation of a user (I assume I can show only the essential user account fields).
  2. If the user is already logged in, the query needs to modify a column based on the currently logged in user.

I think I get how to do 1, though your user module shows mostly how to alter the user form, not create a separate form on a different page that also registers a user. However, i am not sure how to check for an already existing user, and modify the specific field. Any suggestions? Snippets?

Thanks,
Maria

mariagwyn
Offline
Last seen: 7 years 21 weeks ago
Joined: 2011-08-17
After further investigation,

After further investigation, it seems that what I want is the db_update function, where it looks for the 'entity_id' and modifies when the uid matches the entity id. I can see the update function in the trails tutorial. However, what I don't get is how to set it so the first parameter($trail_id) actually looks for the currently logged in user, and sets that as the entity_id that is being updated.

Add to playlist

Add to , or

Add to new playlist:

Add to playlist
This is a member-only feature
But, it's easy to become a member

Add to cart:


Loading...
Contact us

Below are the supported keyboard shortcuts for our video player.

space
Start / stop video
shift
Go to next video
shift
Go to previous video
Increase or decrease player speed by 20%
Skip ahead or go back by 15 seconds
1...9
Jump to a percentage (2 is 20%, for example)
f
Toggle full screen
Videos Pricing More Search
BuildAModule Logo Icon BuildAModule Logo Icon
Become a member!
$29
1 month
$156
6 months
10% off
$276
12 months
20% off
All memberships come with the following:
24 / 7 access to the entire 1800+ video library
An innovative video player with a rolling transcript
Extensive Drupal and cross-platform training
A thorough and thoughtful training style
Progress tracking
Take notes on specific video sections
Intuitive multi-user management
How many users?
user
Go solo with a single user, or give multiple team members access through one account and get discounts by bundling multiple users into a single membership.