How to redirect members to their own profile entry after login
By default, when a member signs in to your site, WordPress sends them to its admin area. For a member directory, that is rarely what you want. A more useful destination is the member’s own profile entry: the record they created when they registered.
This article walks through how to set that up. There are two pieces:
- A “My Profile” page that, when visited, automatically displays whichever member is logged in.
- A login redirect that sends every member to that page after they sign in.
Before you start #
You’ll need:
- A member directory View built on your Gravity Forms registration form.
- GravityView Pro, which includes the Advanced Filter extension.
- The Gravity Forms User Registration Add-On configured to create a WordPress user for each registration. GravityView automatically links each registration entry to the user it creates.
1. Duplicate your directory View #
Duplicate your directory View; call the copy “My Profile” or whatever you like. Open its Filter & Sort tab and add an Advanced Filter condition: Created By is Currently Logged-in User. Save. The copy inherits your directory’s form and Single Entry Layout, so nothing else to design.
If you want the “My Profile” page to look different from a directory entry, customize the Single Entry Layout in the copy.
2. Build the “My Profile” page #
Create a regular WordPress page. Title it “My Profile” or anything you like; the URL slug becomes the path, e.g. /my-profile/. In the page content, add a Shortcode block with the [gventry] shortcode:
Replace YOUR_VIEW_ID with the ID of the copy you just made. You can find the View ID by going to Views in the WordPress admin and editing the View; the ID is the number after post= in the URL.
Save the page. Take note of its URL; you’ll need it in step 3.
Why this works
The [gventry] shortcode renders one entry using the View’s Single Entry layout. The entry_id="first" argument tells it to grab the first entry the View returns. Because the View is filtered to “Created By is Currently Logged-in User”, the only entries it can return for a given visitor are entries that visitor created themselves. “First” of that filtered set is their own entry.
So Alice visits /my-profile/ and sees her own entry. Bob visits the same URL and sees his. Same URL, different content per visitor, no per-user URLs needed.
If you want members to be able to edit their profile, add a Link to Edit Entry field inside your View’s Single Entry layout.
3. Send members to the page after they log in #
The redirect is the piece outside GravityView. Pick the option that matches how members sign in on your site.
Gravity Forms Login widget
If you have placed the Gravity Forms Login widget on your site, open its settings and set the Login Redirect URL field to the URL of your “My Profile” page. The widget redirects users there on successful login.
See User Registration Add-On Login Widget on the Gravity Forms docs site.
Gravity Forms login shortcode
If you are using the Gravity Forms login shortcode on a page, pass the URL through the login_redirect attribute:
See Login Form Shortcode on the Gravity Forms docs site.
Standard WordPress login screen
If your members sign in through the standard WordPress login screen at /wp-login.php, neither of the two options above applies to that path. The cleanest no-code option for that case is the LoginWP plugin (formerly Peter’s Login Redirect). After activating it, add a rule for the role your registered members get (usually Subscriber) pointing to your “My Profile” page URL.
Note: the free version of LoginWP only intercepts the standard WordPress login screen. It does not intercept submissions made through the Gravity Forms login widget or shortcode. Those have their own redirect setting, documented above.
Handling logged-out visitors #
If a logged-out visitor lands on the “My Profile” page, the Advanced Filter returns no entries and [gventry entry_id="first"] outputs nothing. They will see a blank space where the profile should be.
Options to handle this:
- Restrict the page to logged-in users with a plugin like the free WordPress Members plugin or Redirection. See Restricting View content to be members-only.
- For developers, the
gravityview/shortcodes/gventry/outputfilter lets you override the output for logged-out users. See the filter examples in the [gventry] shortcode reference.
Test it #
Log in as a non-admin test user in an incognito window (or a second browser). After login, the user should land on the “My Profile” page and see their own entry rendered with your View’s Single Entry layout. Use a non-admin account for this test. Your own admin account behaves differently from a regular registered member.