Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add filters to have custom columns on CSV export #26

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

cfaria
Copy link

@cfaria cfaria commented May 29, 2024

Hi @loureirorg,

can you consider merging this PR to the next plugin version?

I've added two filters:
uewm_custom_columns
uewm_custom_column_value_xxxxxxxx

Then we can hook them to add custom values to the CSV export for each user.

I personally use them to have data that it's not as user meta. For instance, I use the WooCommerce Subscriptions plugin and this allows me to have a column with the subscription status for each user. Sth like this:

add_filter('uewm_custom_columns', function( $columns ) {
    $columns[] = 'subscription-status';

    return $columns;
});

add_filter('uewm_custom_column_value_subscription-status', function( $value, $user_id ) {
    if ( wcs_user_has_subscription( $user_id, '', 'active' ) ) {
        return 'active';
    }

    return '-';
}, 10, 2);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant