{"id":246,"date":"2019-01-22T10:51:59","date_gmt":"2019-01-22T10:51:59","guid":{"rendered":"https:\/\/sfplugin.com\/docs\/how-to\/transform-your-wordpress-into-a-salesforce-portal\/"},"modified":"2025-01-24T19:49:43","modified_gmt":"2025-01-24T19:49:43","slug":"make-wordpress-into-a-salesforce-portal","status":"publish","type":"docs","link":"https:\/\/sfplugin.com\/docs\/how-to\/make-wordpress-into-a-salesforce-portal\/","title":{"rendered":"How To Make WordPress into a Salesforce Portal with Unlimited Users"},"content":{"rendered":"<p><b>Use the user logins feature in WordPress to build engaging portals that provide selected access to Salesforce records.<\/b><\/br><br \/>\nWhen WordPress users feature is mentioned, most people think about Admin users, a login for your marketing head and another for your web developer.<\/p>\n<p>WordPress comes with powerful user management functions, the same is even used to run an entire e-commerce site by popular frameworks like <a href=\"https:\/\/woocommerce.com\/\">WooCommerce<\/a> and <a href=\"https:\/\/easydigitaldownloads.com\">Easy Digital Downloads<\/a>.<\/p>\n<p>Both these apps store all of the purchase information inside WordPress.<\/p>\n<p>What if we want to use the same user management features of WordPress <strong>AND<\/strong> have the information populate real-time from Salesforce.<\/p>\n<p>We could set up a portal login where members can view information <strong>ONLY<\/strong> assigned to them.<\/p>\n<p>This would be immensely beneficial when you have :<\/p>\n<ul>\n<li>Project and Case Managers who want access to specific record info they manage<\/li>\n<li>Volunteer Team Leaders who want to view hours worked by their team members<\/li>\n<li>Donors who want to view list of past transactions, or details of causes they donated to<\/li>\n<li>Members who simply what to access their registered info on Salesforce<\/li>\n<\/ul>\n<h3><strong>There are two ways to set it up:\u00a0<\/strong><\/h3>\n<ul>\n<li><a href=\"#connect-wordpress-id-field\">Using the WordPress ID<\/a><\/li>\n<li><a href=\"#connect-email-field\">Using the Email Field (easier to setup)<\/a><\/li>\n<\/ul>\n<h3 id=\"connect-wordpress-id-field\">Connect WordPress users by creating a field for WordPress ID<\/h3>\n<ol>\n<li>Every User in WordPress has a unique user ID, you can check this out by visiting <strong>Users -&gt; All Users\u00a0<\/strong>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 <a href=\"https:\/\/wordpress.org\/plugins\/export-users-to-csv\/\">this one<\/a>.<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-250\" src=\"https:\/\/sfplugin.com\/docs\/wp-content\/uploads\/2019\/01\/wordpress-salesforce-portal-plugin-connect.png\" alt=\"\" width=\"482\" height=\"200\" srcset=\"https:\/\/sfplugin.com\/docs\/wp-content\/uploads\/2019\/01\/wordpress-salesforce-portal-plugin-connect.png 482w, https:\/\/sfplugin.com\/docs\/wp-content\/uploads\/2019\/01\/wordpress-salesforce-portal-plugin-connect-300x124.png 300w, https:\/\/sfplugin.com\/docs\/wp-content\/uploads\/2019\/01\/wordpress-salesforce-portal-plugin-connect-480x200.png 480w\" sizes=\"auto, (max-width: 482px) 100vw, 482px\" \/><\/li>\n<li>The next step is to set up a field on Salesforce to identify them with their WordPress profile.<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-251\" src=\"https:\/\/sfplugin.com\/docs\/wp-content\/uploads\/2019\/01\/Screen-Shot-2019-01-22-at-9.01.27-pm.png\" alt=\"\" width=\"203\" height=\"45\" \/><br \/>\nonce created, use Dataloader or Salesforce Import Wizard and update the IDs from your WordPress user ids list.<\/li>\n<li>Now we need a way to restrict access to certain pages on WordPress as Member only, use any of <a href=\"https:\/\/www.elegantthemes.com\/blog\/tips-tricks\/how-to-restrict-access-to-areas-of-your-wordpress-website\">the plugins listed here<\/a>. There are lot of free options in the<a href=\"https:\/\/wordpress.org\/plugins\/search\/memberships\/\"> WordPress plugins directory<\/a> as well.<\/li>\n<li>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. <a href=\"https:\/\/sfplugin.com\/\">Get the latest version of our plugin to do just this!<\/a><\/li>\n<li>Since we have the WordPress IDs now on Salesforce we can pull any records related them and display them on WordPress.\n<p><figure id=\"attachment_253\" aria-describedby=\"caption-attachment-253\" style=\"width: 480px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-253 size-full\" src=\"https:\/\/sfplugin.com\/docs\/wp-content\/uploads\/2019\/01\/Make-WordPress-Portal-Salesforce-fields.png\" alt=\"\" width=\"480\" height=\"444\" srcset=\"https:\/\/sfplugin.com\/docs\/wp-content\/uploads\/2019\/01\/Make-WordPress-Portal-Salesforce-fields.png 480w, https:\/\/sfplugin.com\/docs\/wp-content\/uploads\/2019\/01\/Make-WordPress-Portal-Salesforce-fields-300x278.png 300w\" sizes=\"auto, (max-width: 480px) 100vw, 480px\" \/><figcaption id=\"caption-attachment-253\" class=\"wp-caption-text\">Here&#8217;s how the ideal relationship would look like <em>(Diagram made with <a href=\"https:\/\/www.draw.io\">draw.io<\/a>)<\/em><\/figcaption><\/figure><\/li>\n<li>Navigate to the <strong>Add Cards &amp; Tables <\/strong>screen on the plugin screen on WordPress. Let&#8217;s query a custom object named <strong>Session.\u00a0<\/strong><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-254 aligncenter\" src=\"https:\/\/sfplugin.com\/docs\/wp-content\/uploads\/2019\/01\/Restricted-WordPress-Salesforce-Plugin-Connect.png\" alt=\"\" width=\"686\" height=\"452\" srcset=\"https:\/\/sfplugin.com\/docs\/wp-content\/uploads\/2019\/01\/Restricted-WordPress-Salesforce-Plugin-Connect.png 686w, https:\/\/sfplugin.com\/docs\/wp-content\/uploads\/2019\/01\/Restricted-WordPress-Salesforce-Plugin-Connect-300x198.png 300w\" sizes=\"auto, (max-width: 686px) 100vw, 686px\" \/><br \/>\nin this particular setup on\u00a0<strong>Sessions<\/strong> is connected via Contacts through a Lookup field. We access the WordPress Id through a Formula field named\u00a0<strong>Related WordPress ID.<\/strong><\/li>\n<li>\u00a0Here&#8217;s how the filter can be setup : <strong>Related_WordPress_ID__c\u00a0<\/strong> = then select\u00a0<strong>WordPress User ID<\/strong>. This will dynamically match retrieve Salesforce records with <strong>Related WordPress ID<\/strong> same as the ID of logged in user.<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-255\" src=\"https:\/\/sfplugin.com\/docs\/wp-content\/uploads\/2019\/01\/Salesforce-Wordpress-portal-fields-.png\" alt=\"\" width=\"996\" height=\"364\" srcset=\"https:\/\/sfplugin.com\/docs\/wp-content\/uploads\/2019\/01\/Salesforce-Wordpress-portal-fields-.png 996w, https:\/\/sfplugin.com\/docs\/wp-content\/uploads\/2019\/01\/Salesforce-Wordpress-portal-fields--300x110.png 300w, https:\/\/sfplugin.com\/docs\/wp-content\/uploads\/2019\/01\/Salesforce-Wordpress-portal-fields--768x281.png 768w\" sizes=\"auto, (max-width: 996px) 100vw, 996px\" \/>\n<p>If using User ID and field you created in Salesforce is String, surround it with quotes as well &#8211; &#8216;$WPId&#8217; <\/p>\n<\/li>\n<li>All set! Copy paste the short code to your page, that is protected by the log in.<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-256\" src=\"https:\/\/sfplugin.com\/docs\/wp-content\/uploads\/2019\/01\/WordPress-Salesforce-Portal-Connect-Add-Users.gif\" alt=\"\" width=\"600\" height=\"628\" \/><\/p>\n<h3 id=\"connect-email-field\">Connect WordPress users by Email<\/h3>\n<p>This approach is easier, since you wouldn&#8217;t have to create new fields or update existing records. For this to work well you need to make sure that:<\/p>\n<ul>\n<li>WordPress user login email and the Email field in Salesforce for the users are the same\n<li>The Email fields are unique for the records in Salesforce\n<\/ul>\n<p>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. <\/p>\n<p>In the filter set Email (API name of Email field ) = WordPress (Logged In User Email). <\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/sfplugin.com\/docs\/wp-content\/uploads\/2019\/01\/Select-WordPress-user-email-field-300x121.png\" alt=\"\" width=\"300\" height=\"121\" class=\"aligncenter size-medium wp-image-996\" srcset=\"https:\/\/sfplugin.com\/docs\/wp-content\/uploads\/2019\/01\/Select-WordPress-user-email-field-300x121.png 300w, https:\/\/sfplugin.com\/docs\/wp-content\/uploads\/2019\/01\/Select-WordPress-user-email-field.png 543w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>The filter looks like below. If you have custom email field it might look like Email__c or similar. <\/p>\n<p>Note the use of single quotes around the WordPress variable, it should be : &#8216;$WPEmail&#8217; &#8216;$WPUserName&#8217; <\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/sfplugin.com\/docs\/wp-content\/uploads\/2019\/01\/Filter-email-300x49.png\" alt=\"\" width=\"300\" height=\"49\" class=\"aligncenter size-medium wp-image-997\" srcset=\"https:\/\/sfplugin.com\/docs\/wp-content\/uploads\/2019\/01\/Filter-email-300x49.png 300w, https:\/\/sfplugin.com\/docs\/wp-content\/uploads\/2019\/01\/Filter-email.png 475w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>Now when the user accesses the page after logging in, the plugin will query Salesforce for their specific record! <\/p>\n<p>Feel free to send us a message if you&#8217;d like more information on setting this up. <\/p>\n","protected":false},"featured_media":0,"parent":148,"menu_order":4,"comment_status":"closed","ping_status":"closed","template":"","doc_tag":[],"class_list":["post-246","docs","type-docs","status-publish","hentry"],"comment_count":0,"_links":{"self":[{"href":"https:\/\/sfplugin.com\/docs\/wp-json\/wp\/v2\/docs\/246","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sfplugin.com\/docs\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/sfplugin.com\/docs\/wp-json\/wp\/v2\/types\/docs"}],"replies":[{"embeddable":true,"href":"https:\/\/sfplugin.com\/docs\/wp-json\/wp\/v2\/comments?post=246"}],"version-history":[{"count":16,"href":"https:\/\/sfplugin.com\/docs\/wp-json\/wp\/v2\/docs\/246\/revisions"}],"predecessor-version":[{"id":1448,"href":"https:\/\/sfplugin.com\/docs\/wp-json\/wp\/v2\/docs\/246\/revisions\/1448"}],"up":[{"embeddable":true,"href":"https:\/\/sfplugin.com\/docs\/wp-json\/wp\/v2\/docs\/148"}],"next":[{"title":"How to Show Salesforce field values on WordPress Pages and Posts Content (and HTML)","link":"https:\/\/sfplugin.com\/docs\/how-to\/how-to-use-section-layouts-to-show-salesforce-field-values-on-wordpress-pages-and-posts-content\/","href":"https:\/\/sfplugin.com\/docs\/wp-json\/wp\/v2\/docs\/283"}],"prev":[{"title":"How to Add Volunteer Calendar Data from Salesforce to WordPress Website","link":"https:\/\/sfplugin.com\/docs\/how-to\/add-a-volunteer-calendar-from-salesforce-in-wordpress\/","href":"https:\/\/sfplugin.com\/docs\/wp-json\/wp\/v2\/docs\/229"}],"wp:attachment":[{"href":"https:\/\/sfplugin.com\/docs\/wp-json\/wp\/v2\/media?parent=246"}],"wp:term":[{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/sfplugin.com\/docs\/wp-json\/wp\/v2\/doc_tag?post=246"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}