WordPress.org

Ready to get started?Download WordPress

Forums

Events Manager
Can't see event in buddypress group (10 posts)

  1. nirzol
    Member
    Posted 2 years ago #

    Hello
    When I create an event only admin and moderator can see it in group

    Can help plz ?

    I use buddypress with wordpress

    http://wordpress.org/extend/plugins/events-manager/

  2. agelonwl
    Member
    Posted 2 years ago #

    tested it and works fine on me, does your user e.g. subscriber is part of the group? otherwise can you try to deactivate other plugins or revert to default theme to see if there's any conflict and try again? also, try to turn-on WP_DEBUG to see if there's any other error.

  3. nirzol
    Member
    Posted 2 years ago #

    I found why
    I m on a wordpress + buddypress but wordpress in network mode

    So when a new user is created, by default (i don't know why) this user doesn't add in my user list on the default site (where buddypress is active) so he haven't got a role .

    Si I have to add this user in manual mode with add buton and set a role.

    Do you know how can do it auto ?

    Thx
    sorry for very bad english I'm french

    PS: Just to notice with debug mode TRUE I have :
    Notice: Trying to get property of non-object in .../wp-content/plugins/events-manager/templates/buddypress/group-events.php on line 62 Notice: Trying to get property of non-object in .../wp-content/plugins/events-manager/templates/buddypress/group-events.php on line 62 Notice: Trying to get property of non-object in .../wp-content/plugins/events-manager/templates/buddypress/group-events.php on line 62

    Notice: Undefined variable: category in .../wp-content/plugins/events-manager/templates/buddypress/group-events.php on line 112

  4. nirzol
    Member
    Posted 2 years ago #

    hum by default user is added to the network not to the default site. So he haven't got a default role ....

    Some help ? thx a lot

  5. nirzol
    Member
    Posted 2 years ago #

    Maybe if in my function.php I add :

    http://codex.wordpress.org/Plugin_API/Action_Reference/user_register
    with
    http://codex.wordpress.org/WPMU_Functions/add_user_to_blog

    it 's the good solution?? or they are an other better one ? plz

  6. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 2 years ago #

    add_user_to_blog would be the one. If you just run that on each instance, I believe it just adds a user to the blog if they're not a member already.

    you may want to wrap that in an is_user_logged_in()

  7. nirzol
    Member
    Posted 2 years ago #

    thx for help Marcus
    For people with the same probleme like me . This is what I do :
    2 functions, one to put user in my default site and an other for the new user.

    //add new user to default site id=1. Don't forget to change $blogid !!
    function efg_add_user_to_blog($user_id) {
        global $wpdb;
            $blogid = 1;
            $role = 'subscriber';
            add_user_to_blog($blog_id, $user_id, $role);
    }
    add_action( 'user_register', 'efg_add_user_to_blog');
    
    //add old user to default site id=1. Don't forget to change $blogid !!
    if ( is_user_logged_in() ) {
    get_currentuserinfo();
            $blogid = 1;
            $role = 'subscriber';
            add_user_to_blog($blog_id, $current_user->ID, $role);
     }

    thx

  8. agelonwl
    Member
    Posted 2 years ago #

    thx for sharing

  9. nirzol
    Member
    Posted 2 years ago #

    it's normal agelonwl :)

    But is better to do like that : (I hope , I use the good function)
    Filter people who have NO ROLE in the site.
    add this line : if ( !current_user_can( 'edit_posts' ) and !current_user_can('subscriber')){

    </strong>
    //add old user to default site id=1. Don't forget to change $blogid !!
    if ( is_user_logged_in() ) {
            if ( !current_user_can( 'edit_posts' ) and !current_user_can('subscriber')){
                    get_currentuserinfo();
                    $blogid = 1;
                    $role = 'subscriber';
                    add_user_to_blog($blog_id, $current_user->ID, $role);
            }
     }

  10. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 2 years ago #

    yup, even better! there may be one more improvement there... I think there's a function to just see if a user is a user of that blog.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic