• I want add some custom field when i create new grup, (i used for countdown)?but is not work when i create new group, only work when edit groups.

    function save_custom_buddypress_group_textinput($group_id) {
        if ( isset($_POST['custom_group_textinput']) ) {
            if ( $group_id == 0 ) { 
                $group_id = buddypress()->groups->new_group_id; 
            }elseif(bp_get_current_group_id() > 0) {
                $group_id = bp_get_current_group_id();
            }
            $text_input_value = sanitize_text_field($_POST['custom_group_textinput']);  
            groups_update_groupmeta($group_id, 'custom_group_textinput', $text_input_value);
        }
    }
    add_action('groups_group_after_save', 'save_custom_buddypress_group_textinput');
    add_action('groups_group_create_complete', 'save_custom_buddypress_group_textinput');
    add_action('groups_group_edit_save_complete', 'save_custom_buddypress_group_textinput');`
    
    
     </code></pre>
    
    
    
    <pre class="wp-block-code"><code></code></pre>
    
    
    
    <p class="">my code is designed to save custom fields in BuddyPress groups when a group is created or edited. However, i mentioned that it's not working when creating a new group.</p>
    
    
    
    <p class="">$group_id become 0 and not working</p>
    

    The page I need help with: [log in to see the link]

  • The topic ‘Buddypress custom fields when create new grup, no work’ is closed to new replies.