Tips to customize Member Profile Modification page

I have a page that uses the shortcode [s2Member-Profile /] to display the Member Profile Modification panel, and wanted to customize it in two ways. I'm just sharing in case it helps others.
1) HIDE CERTAIN ROWS
Since the username is not an editable value, I don't want to show it as a disabled input field, which could confuse a user. I am displaying it simply as text elsewhere on the page, above the shortcode, using php to get the value. To hide the Username row, I looked at s2member/includes/profile.inc.php, and found Action Hooks before and after each TR, so i use those hooks to add html comments around the row i want to hide:
in my mu-plugins/s2-hacks.php:
I'd prefer to somehow use the hooks to prevent the php from ever outputting the html in the first place, but couldn't figure out how, since the html is just echo'd out line by line in profile.inc.php.
2) ADJUST WIDTH OF INPUT FIELDS
On the Profile Modification panel (again, from profile.inc.php), the input fields all have a hardcoded width from a style="width:99%;" attribute. I could use CSS to make the container less wide, but that also make the Labels wrap prematurely/unnecessariy (particularly the Password label). So i'm using jQuery (in header.php) to REMOVE that hardcoded style attribute:
1) HIDE CERTAIN ROWS
Since the username is not an editable value, I don't want to show it as a disabled input field, which could confuse a user. I am displaying it simply as text elsewhere on the page, above the shortcode, using php to get the value. To hide the Username row, I looked at s2member/includes/profile.inc.php, and found Action Hooks before and after each TR, so i use those hooks to add html comments around the row i want to hide:
in my mu-plugins/s2-hacks.php:
- Code: Select all
add_action('ws_plugin__s2member_during_profile_during_fields_before_username','my_hide_start',10);
function my_hide_start ( $vars = array() ) {
echo "<!-- \n";
}
add_action('ws_plugin__s2member_during_profile_during_fields_after_username','my_hide_end',10);
function my_hide_end ( $vars = array() ) {
echo " --> \n";
}
I'd prefer to somehow use the hooks to prevent the php from ever outputting the html in the first place, but couldn't figure out how, since the html is just echo'd out line by line in profile.inc.php.
2) ADJUST WIDTH OF INPUT FIELDS
On the Profile Modification panel (again, from profile.inc.php), the input fields all have a hardcoded width from a style="width:99%;" attribute. I could use CSS to make the container less wide, but that also make the Labels wrap prematurely/unnecessariy (particularly the Password label). So i'm using jQuery (in header.php) to REMOVE that hardcoded style attribute:
- Code: Select all
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery('form#ws-plugin--s2member-profile input').removeAttr("style");
});
</script>