neyoung (@neyoung)

Forum Replies Created

Viewing 4 replies - 26 through 29 (of 29 total)
  • @neyoung

    Member

    Well, it turns out I shouldn’t play with bbpress/wpmu when I’m tired at 2am. I never ended up activating the plugin o.O . Anyways, I got the code that Detective wrote to work once I pulled my head outta my butt!

    Here’s for anyone else that has this problem…

    toss this into a file called default-role.php and put it in your my-plugins directory within your bbpress install folder.

    <?php

    /*

    Plugin Name: bbpress wpmu default role

    Plugin URI: https://bbpress.org/forums/topic/yet-another-integration-bug-no-role-set-on-registration?replies=5

    Description: Sets a default WPMU role for all new bbpress users.

    Author: Detective

    Author URI: http://www.ryuuko.cl/

    */

    function wpbb_add_user_role_rk($user_id) {

    $user = new WP_User($user_id);

    $user->set_role(get_option(‘default_role’));

    }

    add_action( ‘bb_new_user’, ‘wpbb_add_user_role_rk’);

    ?>

    @neyoung

    Member

    I’ve got μ loaded through the config.php file. I’ll look into some of the μ functions and see what I can do.

    I don’t think that trk_addDefaultRole function is being called from bb_new_user at all. Is there a way I can test to see if it is?

    @neyoung

    Member

    Sorry for the duplicate post, I think I was tired when I posted the other one and I’d sort of forgot about it.

    Anyways, I’ve been playing with the two bits of code and I think I’ve ‘almost’ got it working. If I execute Detectives query manually from the terminal it works, but for some reason when I put it all in a little plugin nothing happens. Is there a type-o or a noob error somewhere?

    `<?php

    /*

    Plugin Name: bbpress wpmu default role

    */

    function trk_addDefaultRole($user_id) {

    global $bbdb;

    $bbdb->query(“INSERT INTO wp_usermeta ( user_id, meta_key, meta_value ) VALUES ( ‘$user_id’, ‘wp_1_capabilities’, ‘a:1:{s:10:”subscriber”;b:1;}’ )”);

    }

    add_action(‘bb_new_user’, ‘trk_addDefaultRole’);

    ?>

    @neyoung

    Member

    Where do I put this code? In bbpress/register.php somewhere I’m assuming?

Viewing 4 replies - 26 through 29 (of 29 total)