1. Home
  2. Docs
  3. How to
  4. How To Make WordPress into a Salesforce Portal with Unlimited Users

How To Make WordPress into a Salesforce Portal with Unlimited Users

Use the user logins feature in WordPress to build engaging portals that provide selected access to Salesforce records.

When WordPress users feature is mentioned, most people think about Admin users, a login for your marketing head and another for your web developer.

WordPress comes with powerful user management functions, the same is even used to run an entire e-commerce site by popular frameworks like WooCommerce and Easy Digital Downloads.

Both these apps store all of the purchase information inside WordPress.

What if we want to use the same user management features of WordPress AND have the information populate real-time from Salesforce.

We could set up a portal login where members can view information ONLY assigned to them.

This would be immensely beneficial when you have :

  • Project and Case Managers who want access to specific record info they manage
  • Volunteer Team Leaders who want to view hours worked by their team members
  • Donors who want to view list of past transactions, or details of causes they donated to
  • Members who simply what to access their registered info on Salesforce

There are two ways to set it up: 

Connect WordPress users by creating a field for WordPress ID

  1. Every User in WordPress has a unique user ID, you can check this out by visiting Users -> All Users from the WordPress Dashboard. Click on any user, you will see their user ID in the link on the page. We can get a list of all their IDs by exporting the users list using a free plugin like this one.
  2. The next step is to set up a field on Salesforce to identify them with their WordPress profile.

    once created, use Dataloader or Salesforce Import Wizard and update the IDs from your WordPress user ids list.
  3. Now we need a way to restrict access to certain pages on WordPress as Member only, use any of the plugins listed here. There are lot of free options in the WordPress plugins directory as well.
  4. Now when members log into to these pages that are protected by a login, WordPress identifies them as their users. All we have to do now is to connect to salesforce and pull info into WordPress related to the logged in user. Get the latest version of our plugin to do just this!
  5. Since we have the WordPress IDs now on Salesforce we can pull any records related them and display them on WordPress.

    Here’s how the ideal relationship would look like (Diagram made with draw.io)
  6. Navigate to the Add Cards & Tables screen on the plugin screen on WordPress. Let’s query a custom object named Session. 

    in this particular setup on Sessions is connected via Contacts through a Lookup field. We access the WordPress Id through a Formula field named Related WordPress ID.
  7.  Here’s how the filter can be setup : Related_WordPress_ID__c  = then select WordPress User ID. This will dynamically match retrieve Salesforce records with Related WordPress ID same as the ID of logged in user.

    If using User ID and field you created in Salesforce is String, surround it with quotes as well – ‘$WPId’

  8. All set! Copy paste the short code to your page, that is protected by the log in.

Connect WordPress users by Email

This approach is easier, since you wouldn’t have to create new fields or update existing records. For this to work well you need to make sure that:

  • WordPress user login email and the Email field in Salesforce for the users are the same
  • The Email fields are unique for the records in Salesforce

The steps to connect using Email field and using WordPress ID are similar. The only difference in this filter step, we set Email instead of WordPress ID. This could be an existing field or a new one that you have created for the object.

In the filter set Email (API name of Email field ) = WordPress (Logged In User Email).

The filter looks like below. If you have custom email field it might look like Email__c or similar.

Note the use of single quotes around the WordPress variable, it should be : ‘$WPEmail’ ‘$WPUserName’

Now when the user accesses the page after logging in, the plugin will query Salesforce for their specific record!

Feel free to send us a message if you’d like more information on setting this up.

Was this article helpful to you? Yes 3 No 1