Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)

  • savantking99
    Participant

    @savantking99

    So how can I improve this?


    savantking99
    Participant

    @savantking99

    that is my own function: line 48.

    and this is the doucumentation from buddyboss:

    apply_filters( 'bp_members_signup_error_message', string $value, string $fieldname )

    So I pass two arguments.


    savantking99
    Participant

    @savantking99

    thank you. But then I get this error:

    
    Fatal error: Uncaught ArgumentCountError: Too few arguments to function function_voornaam(), 1 passed in E:\Xampp\htdocs\wordpress\wp-includes\class-wp-hook.php on line 303 and exactly 2 expected in E:\Xampp\htdocs\wordpress\wp-content\themes\buddyboss-theme-child\functions.php:48 Stack trace: #0 E:\Xampp\htdocs\wordpress\wp-includes\class-wp-hook.php(303): function_voornaam('show_messagge') #1 E:\Xampp\htdocs\wordpress\wp-includes\plugin.php(189): WP_Hook->apply_filters('show_messagge', Array) #2 E:\Xampp\htdocs\wordpress\wp-content\themes\buddyboss-theme-child\functions.php(66): apply_filters('bp_members_sign...', 'show_messagge') #3 E:\Xampp\htdocs\wordpress\wp-settings.php(546): include('E:\\Xampp\\htdocs...') #4 E:\Xampp\htdocs\wordpress\wp-config.php(97): require_once('E:\\Xampp\\htdocs...') #5 E:\Xampp\htdocs\wordpress\wp-load.php(50): require_once('E:\\Xampp\\htdocs...') #6 E:\Xampp\htdocs\wordpress\wp-blog-header.php(13): require_once('E:\\Xampp\\htdocs...') #7 E:\Xampp\htdocs\wordpress\index.php(17): require('E:\\Xampp\\htdocs...') #8 {main} thrown in E:\Xampp\htdocs\wordpress\wp-content\themes\buddyboss-theme-child\functions.php on line 48
    

    savantking99
    Participant

    @savantking99

    But if I do this:

    apply_filters('bp_members_signup_error_message', 'function_voornaam()');
    
    function function_voornaam($value,  $fieldname)
    {
    
        if ($fieldname == 'field_1') {
    
            return '<style>{font-family:bold}</style> wrong name';
        }
    }

    I don’t get errors. But also the text is not changed. It is still shown:

    This is a required field.

    And I found this documentation:

    bp_members_signup_error_message


    savantking99
    Participant

    @savantking99

    Yes, I have done that. So the complete code is then like this:

    add_filter('bp_members_signup_error_message', 'function_voornaam');
    
    function function_voornaam($value,  $fieldname)
    {
    
        if ($fieldname == 'field_1') {
    
            return '<style>{font-family:bold}</style>  you have to enter name.';
        }
    }

    But then I get this error:

    
    atal error: Uncaught ArgumentCountError: Too few arguments to function function_voornaam(), 1 passed in E:\Xampp\htdocs\wordpress\wp-includes\class-wp-hook.php on line 303 and exactly 2 expected in E:\Xampp\htdocs\wordpress\wp-content\themes\buddyboss-theme-child\functions.php:49 Stack trace: #0 E:\Xampp\htdocs\wordpress\wp-includes\class-wp-hook.php(303): function_voornaam('show_messagge') #1 E:\Xampp\htdocs\wordpress\wp-includes\plugin.php(189): WP_Hook->apply_filters('show_messagge', Array) #2 E:\Xampp\htdocs\wordpress\wp-content\themes\buddyboss-theme-child\functions.php(68): apply_filters('bp_members_sign...', 'show_messagge') #3 E:\Xampp\htdocs\wordpress\wp-settings.php(546): include('E:\\Xampp\\htdocs...') #4 E:\Xampp\htdocs\wordpress\wp-config.php(97): require_once('E:\\Xampp\\htdocs...') #5 E:\Xampp\htdocs\wordpress\wp-load.php(50): require_once('E:\\Xampp\\htdocs...') #6 E:\Xampp\htdocs\wordpress\wp-blog-header.php(13): require_once('E:\\Xampp\\htdocs...') #7 E:\Xampp\htdocs\wordpress\index.php(17): require('E:\\Xampp\\htdocs...') #8 {main} thrown in E:\Xampp\htdocs\wordpress\wp-content\themes\buddyboss-theme-child\functions.php on line 49
    
Viewing 5 replies - 1 through 5 (of 5 total)
Skip to toolbar