Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Chad Butler

    (@cbutlerjr)

    Radio buttons are not natively supported yet, but may be in the future.

    Yes, you could add them with the wpmem_register_form filter. I would create a placeholder field (text) in the field manager and then use PHP’s str_replace to replace the text field with the radio button.

    Thread Starter Jefferson

    (@jrtideias)

    Ok.
    Thanks!

    Thread Starter Jefferson

    (@jrtideias)

    Hey,
    sorry I’m not a programmer, so I tried this:

    add_filter( 'wpmem_register_form', 'input_replace' );
    function input_replace( $form )
    {
    
    	$old = array(  'test','text', '' );
    	$new = array(  'test','radio', 'sim' );
    
    	$form = str_replace( $old, $new, $form );
    
    	return $form;
    }
    
    and this:
    add_filter( 'wpmem_register_form', 'input_replace' );
    function input_replace{
    	$old = '<input type="text" class="textbox" value="" id="test" name="test">';
    	$new = '<<input type="radio" name="test" value="yes">yes<input type="radio" name="test" value="no">no';
    
    	$form = str_replace( $old, $new, $form );
    
    	return $form;
    }

    [Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]

    but doesn’t work…

    Can you help me, please?

    Plugin Author Chad Butler

    (@cbutlerjr)

    I’m not sure what you are doing with the first one, but the second has a couple of problems.

    First, you neglected to include a section for arguments when you defined your function:

    function input_replace{

    This will create a syntax error as your function must have () after the function name. And in this case, you need to pass the generated form to the function as an argument:

    function input_replace( $form ) {

    Second, the string that you are searching for (defined as $old in your code) MUST be an EXACT match of what is generated in the form. I would suggest the following:

    • I assume that you have created this field as a placeholder in the plugin’s field manager. If not, you need to do that.
    • Bring up the form in your browser and view source in your browser.
    • Find the field in the html source and copy/paste that into your code as the string you are searching for.

    My guess is the string you should be searching for in this should look something like this (assuming you called it “test” and it is a text field):

    <input name="test" type="text" id="test" value="" class="textbox" />

    Great Man !

    Hi all,
    I am using WP-member plugin , now to add custom fields for simple one it work,but for fields like hobbies with chatterboxes have values like ‘reading’, ‘writing’,etc
    Now how to add it Please give me answer with which file or form admin how to change it. with simplified code.So on registration page look like
    Hobbies:
    check box option1
    check box option2

    Please provide me solution

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Radiobox Register Form’ is closed to new replies.