-
Notifications
You must be signed in to change notification settings - Fork 5
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 support to use import members from CSV file Add On combined with … #31
base: dev
Are you sure you want to change the base?
Add support to use import members from CSV file Add On combined with … #31
Conversation
…Group accounts Add On * Hook into after import action to insert parent and child accounts.
* Rename hook callback function name * Add few WPCS tweaks.
* cast to int values to insert, the same way the addon does in other places
…Group accounts Add On * Hook into after import action to insert parent and child accounts.
* Rename hook callback function name * Add few WPCS tweaks.
* cast to int values to insert, the same way the addon does in other places
If owner is passed is a child account
9ad648b
to
439e9ea
Compare
…github.com/MaximilianoRicoTabo/pmpro-group-accounts into pr/31" This reverts commit 71b7b67, reversing changes made to 9ad648b.
5225b7e
to
71b7b67
Compare
* Change aproach to just update seats for group accounts * Create Group Member account if the level can be claimed with a code.
* Reworked import members from CSV logic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we're getting close here, but it feels like there are still a few tricky situations to work through. Going to hold off on merging this PR for the time being
$group_level_settings = pmprogroupacct_get_settings_for_level( $membership_id ); | ||
$parent_group = PMProGroupAcct_Group::get_group_by_parent_user_id_and_parent_level_id( $user->ID, $membership_id ); | ||
$group_id = $user->pmprogroupacct_group_id; // Child accounts would pass through the Group ID. | ||
$seats = ! empty( $user->pmprogroupacct_group_total_seats ) ? intval( $user->pmprogroupacct_group_total_seats ) : $group_level_settings['max_seats']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we always want to default to the max seats for a group, or if the number of seats is not specified, do we instead just not want to alter group seat data?
if ( ! empty( $parent_group ) ) { | ||
//Update seats if the user has a total seats value from CSV. | ||
$parent_group->update_group_total_seats( $seats ); | ||
} elseif ( empty( $group_id ) ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is tricky. I think we only want to create a new group if:
- The level being imported is a group level
- The number of seats for the group to be created with is specified
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi,
I can't find the required csv structure for using this code.
Can you help me ?
…Group accounts Add On
All Submissions:
Changes proposed in this Pull Request:
Resolves #30 .
How to test the changes in this Pull Request:
Other information:
Changelog entry