Skip to content

This guide provides instructions and information about Stanford Web Services Jumpstart platform, based on Drupal 7.

We've released our new Stanford Sites on Drupal 8 (D8) platform — the new framework for Stanford Sites in 2020 and beyond. Check out our new User Guide to help you set up your website on the D8 platform. 

Read more about our road to D8 

Tampering Imported Profile Data from CAPx

Programmatically Modifying Data Imported from CAP Using Tamper

Data manipulation (tamper) was added to the CAPx module in version 2.1, and allows you to programmatically modify data that is imported from CAP. For example, you can create a tamper to remove “Professor” from any first names for profiles imported from CAP, as some faculty may include their title as part of their preferred first name. The concept of tamper in CAPx is based off of Feeds Tamper.

Prerequisites

  1. Ensure that CAPx 2.1 or newer with the capx_tamper module is enabled on your site. If you are unsure, please contact us for support. 

  2. Ensure that CAPx is Connected for your site.

  3. Tampers require an existing mapper; create a new mapper if needed.

Adding Tampers to a Mapper

  1. Log into your site as an administrator.

  2. Via the admin menu, navigate to Configuration > CAPx > Map.

  3. On your Map list page, click on the Tampers action next to the mapper which you’d like to tamper: 

  4. Each Field and CAP API Path pair used has its own set of tampers. Click Add Plugin below the field that you would like to add tampers: 

5. On the Add Tamper Plugin page, under The plugin to add, select the tamper plugin you would like to apply to your field.

a. There are many different types of tamper plugins you can use, which are generally based off of the Feeds Tamper plugins. A short description of each can be seen on drupal.org’s documentation page. However some in this list have been excluded.

6. Add a useful Description and, if needed, add a unique Machine name to the tamper.

7. Fill out the fields as needed, based on the description of the tamper plugin being used. For example, for the Find replace plugin:

    Will search in the title <- $display.Name field for the text Cathy, and then replace it with Catherine.

a. Check the Case sensitive box if you would like the text to find to be case sensitive.

b. Check the Respect word boundaries box if you would like to search for the word on its own.

c. Check the Match whole word/phrase box if you would like to do an exact search on the field.

 8. Click Add to add your tamper to the field. This automatically saves it, and will now appear in your Tamper Plugins list.

 9. Repeat as needed for adding more tampers to that field, or to other fields.

10. You can click on the directional arrow icon next to the tamper to drag it and rearrange the order of tampers for a field. The top tamper in the list will run first.

Editing a Tamper on a Mapper

  1. Log into your site as an administrator.

  2. Via the admin menu, navigate to Configuration > CAPx > Map.

  3. On your Map list page, click on the Tampers action next to the mapper which has the tamper(s) you would like to edit. 

  4. On the Tamper Plugins list page, click the Edit action next to the specific tamper you would like to modify.

  5. On the Tamper Plugin edit page, change the fields as needed. 

a. Once a tamper plugin is added, you cannot change the type of tamper plugin it is. If you’d like to change the plugin action, you need to delete the old plugin and create a new one.

  6. Click Save when finished.

Disabling a Tamper on a Mapper

  1. Log into your site as an administrator.

  2. Via the admin menu, navigate to Configuration > CAPx > Map.

  3. On your Map list page, click on the Tampers action next to the mapper which has the tampers(s) you’d like to delete.

  4. On the Tampers Plugin list page, uncheck the Enabled box next next to the specific tamper you would like to disable.

  5. Click Save at the bottom of the page when finished.

Deleting a Tamper on a Mapper

  1. Log into your site as an administrator.

  2. Via the admin menu, navigate to Configuration > CAPx > Map.

  3. On your Map list page, click on the Tampers action next to the mapper which has the tampers(s) you’d like to delete.

  4. On the Tampers Plugin list page, click the Delete action next to the specific tamper you would like to delete.

  5. Click Delete to confirm deletion of that tamper.

Notes and Troubleshooting

  • A set of tampers are tied to a specific field within a specific mapper. If you would like the same tampers applied to another field and/or another mapper, you will need to re-create those tampers.

  • If your data is not tampering as expected, double check your tampers to ensure that they are set correctly. 

    • Tampers are run in a fixed order. Click and drag the rows to change the order that they are run. Or, you can click Show row weights and set the row weights manually. 

      • Lower weights have higher priority. Be sure to click Save at the bottom of the page after changing your row weights.

  • Once a tamper plugin is added, you cannot change the type of tamper plugin it is. If you’d like to change the plugin action, you need to delete the old plugin and create a new one.

  • Deleting a mapper will delete all tampers associated with it.

  • Tampers are run after the importer and filters complete, and right before the creation of content.

  • Adding, saving, deleting, or disabling/enabling any tamper will cause the importer to sync all profiles during the next sync.