How to Display & Enable Search for Administrative Notes Field

Hi! I just hacked a file quickly to make administrative notes searchable, so we can find demoted users by typing their previous Payment IDs, amongst other things (thanks for leaving that for us to use @clavaque :wink:).

To do that, I replaced FALSE with TRUE at line 97 (on Version 201209-RC, adjust if using another) of the file /s2member/src/includes/classes/

Original Version (search capability OFF, less resource intensive):

if(apply_filters(“ws_plugin__s2member_users_list_search_admin_notes”, FALSE, get_defined_vars())) // Off by default; this can get very slow on large sites.

Modified Version (search ON, sorry I don’t know how to do this using an external file, so I just changed the original for now, I’ll update this once I learn how to do it :grimacing:):

if(apply_filters(“ws_plugin__s2member_users_list_search_admin_notes”, TRUE, get_defined_vars())) // Off by default; this can get very slow on large sites.

I also added the column to the user list by adding some code, so it’s available under “screen options” if you want to see them as well:

New Line 155 ADDED:

$cols[“s2member_notes”] = “Notes”;

New Lines 250 & 251 ADDED (after adding the line above, just be sure the block is inserted BEFORE $last_user_id = $ user_id; or you’ll get a fatal error):

else if($col === “s2member_notes”)
$val = ($v = get_user_option(“s2member_notes”, $user_id)) ? esc_html($v) : “—”;

Please accept my apologies in advance for my inelegant job here, I just wanted a quick way to achieve that result and that’s what I did for now. :slight_smile:

1 Like

Quick update, I added this to my “custom modifier plugin” and it seems to be working:

// s2Member Search - User List - Include Administrative Notes
add_filter('ws_plugin__s2member_users_list_search_admin_notes', '__return_true');

To show the column on the user list I am using the plugin Admin Columns.

This way I don’t need to keep updating the file previously mentioned after each plugin update.

Sorry for my hack jobs here and there, I am still learning. :grimacing:

I hope you can find this information useful.

1 Like