jacksleight / statamic-memberbox

This Statamic addon adds a few member related extras on top of Statamic’s existing user features.
https://statamic.com/addons/jacksleight/memberbox
Other
2 stars 3 forks source link

Related fields in Member Export #32

Closed mikemartin closed 1 year ago

mikemartin commented 1 year ago

I think it would be more user friendly if the Member Exports outputted the entry slugs instead of the IDs for related entries.

jacksleight commented 1 year ago

Hey Mike,

Slugs aren't necessarily unique (the entries field could allow selection from multiple collections, and you can have duplicates within nested collections), so changing the IDs to slugs could result in it being impossible to distinguish different entries.

However, I agree that it would be nice to be able to include that (and other) data within the export.

I've just tagged v2.1.0 which will now include any computed values in the export, so you can add something like this to your app service provider and it will include those values in the export:

use Statamic\Facades\User;

User::computed('my_entry_slug', function ($user) {
    return $user->my_entry->slug;
});
mikemartin commented 1 year ago

Brilliant. Thanks so much!