Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

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

  • markbildner
    Participant

    @markbildner

    If it helps, I did a clean wordpress installation (5.5), with the twentytwenty theme, and the only two plugins were Loginizer and Buddypress. PHP is 7.4

    I still got the same result. It ran, didn’t create any errors, but it didn’t join the user to the group.


    markbildner
    Participant

    @markbildner

    Thanks for your offer of help! I am not seeing php errors. As for the javascript, it pops up the box and I submit. But then the page reloads but no action occurs. I put some logging into the code (see below) It looks to me like $_REQUEST is not set and so the loop never executes at all. This returns false false false

    function console_log($data){
      echo '<script>';
      echo 'console.log('. json_encode( $data ) .')';
      echo '</script>';
    }
    
    function add_users_to_bpgroup() {   
        if( bp_is_active('groups') ):
                  console_log(isset( $_REQUEST['action'] ));
                  console_log(isset( $_REQUEST['bp_gid'] ));
                  console_log(isset( $_REQUEST['allusers'] ));
            if( isset( $_REQUEST['action'] ) && isset( $_REQUEST['bp_gid'] ) && isset( $_REQUEST['allusers'] ) ) {
                $group_id = $_REQUEST['bp_gid'];
                $users = $_REQUEST['allusers'];
    
                foreach ( $users as $user_id ) {
                    groups_join_group( $group_id, $user_id );
                }
            }
            //form submission
            add_action( 'admin_footer', function() { ?>
                <script type="text/javascript" charset="utf-8">
                    jQuery("select[name='action']").append(jQuery('<option value="groupadd">Add to BP Group</option>'));
                    jQuery("#doaction").click(function(e){
                        if(jQuery("select[name='action'] :selected").val()=="groupadd") { e.preventDefault();
                            gid=prompt("Enter a Group ID","1");
                            jQuery(".wrap form").append('<input type="hidden" name="bp_gid" value="'+gid+'" />').submit();
                        }
                    });
                </script>
            <?php
            });
             
        endif;
    }

    markbildner
    Participant

    @markbildner

    Sorry I meant buddypress 6.2, WordPress 5.5 Not sure how I fix this post.


    markbildner
    Participant

    @markbildner

    Thank you for taking the time to respond. Unfortunately I cannot assign everyone of a certain role to the same class. They are all students and therefore Subscribers. And I cannot just do it for new groups when they are created.

    I have an easy way to delete members in bulk, via the Bulk Actions on the Groups->Edit page.
    I have an easy way to invite members, via the front end Invite page.
    But I do not have an easy way to directly add members, without going through the very slow search dialog box for each name on the Groups->Edit page. Why can’t that be a set of checkboxes?

Viewing 4 replies - 1 through 4 (of 4 total)
Skip to toolbar