• YellowPlanet

    (@yellowplanet)


    Some background:
    I have a site with Woocommerce, where people should be able to register as default customers and as authors, who can also post products. I tried to find a way to make separate registration forms for the users, but couldn’t, except with expensive plugins. I decided to make just one and hide/show fields that are needed. The admin will change the role for the ones registering as authors.

    The problem:
    The login/registration page is created by Woocommerce and I’m using WP-members to add fields. I added a checkbox labeled ‘Register as an author’. If you check it, a javascript code will show additional fields. I wanted to add a div around the author fields, to easily hide and show all at once. I read about the wpmem_register_form_rows hook here
    http://rocketgeek.com/plugins/wp-members/users-guide/filter-hooks/wpmem_register_form_rows/

    and found some examples on how to use it
    https://wordpress.org/support/topic/moving-inputslabels-inline
    https://wordpress.org/support/topic/specify-default-text-in-text-boxtext-area
    http://stackoverflow.com/questions/26394829/wp-members-plugin-add-class-to-label-input

    I added this to my functions to test it

    add_filter( 'wpmem_register_form_rows', 'my_register_form_rows_filter', 10, 2 );
    function my_register_form_rows_filter( $rows, $toggle ) {
        $rows['artist_name']['field_before'] = '<div class="div_text new_class">';
        return $rows;
    }

    It’s same as in the examples, I only changed the artist_name, which is the option name for one of my fields. However, it’s not doing anything. I also tried other field names, field instead of field_before and changing the html that is added to the page. Should the code be somewhere else than functions, is there something wrong with the code or am I missing something else that could affect it?

    I have WordPress 4.2.1, Woocommerce 2.3.8 and WP-Members 2.9.9.1.

    https://wordpress.org/plugins/wp-members/

The topic ‘Problems using wpmem_register_form_rows’ is closed to new replies.