Simple Membership Plugin › Forums › Simple Membership Plugin › Sort Members by "Access Starts"
- This topic has 5 replies, 2 voices, and was last updated 6 years, 4 months ago by
GreenBandana.
-
AuthorPosts
-
December 21, 2019 at 7:31 pm #19504
GreenBandana
ParticipantI was able to edit the Members page code to add sorting by the header “Access Starts”:
[your-site]/wp-admin/admin.php?page=simple_wp_membership
Is there a hook I can add into the functions.php to ensure this change continues even when there are plugin updates?
Thanks!
December 26, 2019 at 1:07 am #19523admin
KeymasterThis is not a request we gotten before. Please let me know where you need an action or filter hook in the code and I will work on adding that for the next release.
December 26, 2019 at 9:02 pm #19528GreenBandana
ParticipantTo be honest, I’m not that advanced of a developer to answer the question. I merely looked at the existing code and saw a possible “gap” and tried a solution, which appears to work. If the plugin itself can be updated, then a hook or filter would be unnecessary.
In the class.swpm-members.php file, I added the following line which did not exist before.
'subscription_starts' => array( 'subscription_starts', false ),in
function get_sortable_columns() { return array( 'member_id' => array( 'member_id', true ), //True means already sorted 'user_name' => array( 'user_name', false ), 'first_name' => array( 'first_name', false ), 'last_name' => array( 'last_name', false ), 'email' => array( 'email', false ), 'alias' => array( 'alias', false ), 'subscription_starts' => array( 'subscription_starts', false ), 'account_state' => array( 'account_state', false ), 'last_accessed' => array( 'last_accessed', false ), ); }The “Access Starts” was included in get_columns() but not get_sortable_columns().
As mentioned, if this can simply be added to the plugin for the next update, that would be perfect. Otherwise, if you can instruct what we would need to do to preserve this change, that would be great. From my research, it appears it would involve a hook or filter, but I don’t know more than this. Thank you!
January 9, 2020 at 8:55 am #19583GreenBandana
ParticipantAny thoughts on if this adjustment could be incorporated into a future update of the plugin?
January 15, 2020 at 11:46 pm #19626admin
KeymasterThank you. This has been added in the new version of the plugin.
January 16, 2020 at 4:11 am #19628GreenBandana
ParticipantFantastic, thank you!
-
AuthorPosts
- You must be logged in to reply to this topic.