WP-Members: Membership Framework
[resolved] [Plugin: WP-Members] Customize submit button (11 posts)

  1. webbrewers
    Posted 3 years ago #

    Searched high and low but can't seem to find a way to change out the button or its wording. Is it possible?


  2. Chad Butler
    Plugin Author

    Posted 3 years ago #

    The plugin does have some pluggable functions, of which the registration form is one. However, to do that, you do need to make sure you watch that your plugged function remains compatible with future versions, which to me seems like a lot of work to change one button.

    The registration form (I assume that's what we are talking about, since that is the only button that says "submit") is in wpmem_inc_registration_NEW in wp-members-dialogs.php. (Note: the legacy forms (_OLD) are scheduled to be deprecated in an upcoming version, so this function may be reverted to wpmem_inc_registration)

    Info on pluggable functions in WP-Members:

  3. webbrewers
    Posted 3 years ago #

    Brilliant - thank you. I hid the text with css but this a better option. The user wanted the button changed.......

  4. Marcus Tibesar
    Posted 3 years ago #

    Perhaps another option would be to change the wp-members.css file. I changed the Submit; Login and Clear Form buttons for a more modern look:

    background: #4D7570;
    color: #FFFFFF !important;
    margin-left: 0px;
    border-width: 1px;
    border-style: solid;
    border-color: rgba(0, 0, 0, 0.25) rgba(0, 0, 0, 0.25) rgba(0, 0, 0, 0.35);
    border-radius: 5px 5px 5px 5px;
    text-shadow: 0 -1px 1px rgba(0, 0, 0, 0.25);
    text-decoration: none;
    margin-bottom: 10px;
    padding: 5px;
    cursor: pointer;
    display: inline-block;
    padding: 5px 10px 6px;
    position: relative;

    Not sure if this helps - just my 2 cents :-)

  5. webbrewers
    Posted 3 years ago #

    Trouble is I needed to change the value/text so I did initially use css to hide it and then add a background image. But I think it's better to be able to change the actual button.

  6. Chad Butler
    Plugin Author

    Posted 3 years ago #

    With the release of the 2.7.4 version, you could use the filter for the form. If we are talking about the registration form, the filter is wpmem_register_form and the generated html of the form is passed through the filter. You could use php's str_replace to filter the submit button to read 'register':

    add_filter( 'wpmem_register_form', 'my_submit_button_filter' );
    function my_submit_button_filter( $string ) {
    	// the html of the form is the parameter $string
    	// use str_replace like:
    	// $new_string = str_replace( $needle, $replacement, $haystack );
    	$string  = str_replace( 'Submit', 'Register', $string );
    	return $string;
  7. Marcus Tibesar
    Posted 3 years ago #

    I will add this filter to my child theme's functions.php file and test it this evening.

    Should be a beneficial customization to the Registration form's Submit button.

    Thank you.

  8. Marcus Tibesar
    Posted 3 years ago #

    The worked great.

    Now the button text is more appropriate and the button itself looks modern.

    Thank you for all the help with this Chad and webbrewers!

  9. Win7Mac
    Posted 3 years ago #

    Hi Chad and fellas!
    Great plugin this is, thanks for sharing I first have to say.
    Been fumbling around with it for almost a day now, but haven't tried the above yet, as I didn't understand it exactly.
    I'm no expert, so sorry for stupid qustions. I don't know about filters and messing with the CSS or theme stuff, but I can edit simple code in html or php.

    So is it possible to change the "LOGIN" "CLEAR FORM" and "SUBMIT" buttons within the plugin?

    If not,
    - I would suggest this feature for the next update. Just think of different languages, wich is my actual reason for wanting this adjusted. (I'm on german version and the buttons actually are not translated)
    - how exactly can I get this going with simplest code possible?

    Thanks again.

  10. Chad Butler
    Plugin Author

    Posted 3 years ago #

    Thanks for the comments @Win7Mac - actually, the buttons can be translated. I believe all of them are gettext strings. If your buttons are not translating, it could be that you are working from an out-of-date .pot file. The most recent file included in the download does have them (see: http://plugins.svn.wordpress.org/wp-members/trunk/lang/wp-members.pot).

    So if translation is your need, then that's the simplest way.

    As an aside, you mentioned that you can edit simple code in php. If that's the case, I would recommend you learn the power of the filter hook in WordPress. Action and filter hooks are all accessed via php code. The WP-Members plugin provides many hooks for customization following the WP standard for hooks. If you learn how to use these, your ability to customize both WP-Members and WP itself is immense.

  11. Shashank Shekhar
    Posted 2 years ago #

    I am using wp-members 2.8.1 with wp 3.5.
    I also want to customize the form buttons and last required label.
    I tried with above sample code for custom filter, it worked for changing button text.

    But to customize the html to a larger extent, its not working.

    Edited the post, created a separate topic here (as here it was marked resolved)..


    Go through the topic there above and Please help.


Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WP-Members: Membership Framework
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic