BuddyDev

Search

Replies

  • Participant
    Level: Enlightened
    Posts: 38
    Javier on in reply to: [Resolved] BuddyPress 'Super User' #4169

    Thank you very much, Brajesh.

    Do you recommend adding this kind of hooks to bp-custom.php or to a plugin? I’m doing this in a custom plugin now.

    Thank you,
    Javier

  • Participant
    Level: Enlightened
    Posts: 38
    Javier on in reply to: [Resolved] Restrict Site Access #4163

    That’s it! Thanks, Ravi.

    I put the code in a plugin, so site is restricted no matter what theme is active.
    I also have my BuddyPress hooks in that plugin, but I guess it would be better to place those in bp-custom.php.

    Regards
    Javier

  • Participant
    Level: Enlightened
    Posts: 38
    Javier on in reply to: [Resolved] Restrict Site Access #4160

    Thank you, Brajesh.

    I remember doing that Facebook check while ago: I should have had that in mind.

    One weird thing is happening now: if I set BuddyPress site-wide activity page as the frontpage, it bypasses the restriction and anyone can see… This works except for activity archives:

    function restrict_site() {

    if ( is_user_logged_in() ) {
    return false;
    }

    if ( function_exists( ‘bp_is_active’ ) ) {
    if ( bp_is_activation_page() || bp_is_register_page() ) {
    return false;
    }
    }

    $redirect_page = wp_login_url();

    //Custom redirect page
    $custom_redirect_page = get_page_by_title( ‘Login’ );

    if ( !empty( $custom_redirect_page ) ) {

    if (get_permalink( $custom_redirect_page )) {

    $redirect_page = get_permalink($custom_redirect_page);

    // If we are actually on the redirect page – abandon
    if ( is_page( $custom_redirect_page ) ) {
    return false;
    }
    }
    }

    wp_redirect( $redirect_page );
    exit;

    }
    add_action( ‘template_redirect’, ‘restrict_site’ );

    I think I’m missing something

  • Participant
    Level: Enlightened
    Posts: 38

    Wow Ravi, you guys are great.

    Thank you very much,
    Javier

  • Participant
    Level: Enlightened
    Posts: 38

    Thank you, that’s very kind of you!

    Best regards,
    Javier

  • Participant
    Level: Enlightened
    Posts: 38

    Hello, again.

    If we maintain those requirements you stated:

    1. User are sitewide and they will appear in the members directory
    2. A group admin will not be able to delete/edit user

    could we tweak code in the future to suit all the needs? Do those requirements above compromise future modifications?
    For now, just allowing group admins to register users and select the group they belong to, would be really nice for me. There’s a plugin to display groups on the registration page: https://wordpress.org/plugins/buddypress-registration-groups-1/

    Also, I’m searching the codex to look for activation page hooks to display content (“Terms of Service”) there.

    Thank you,
    Javier

    • This reply was modified 8 years, 7 months ago by Javier.
  • Participant
    Level: Enlightened
    Posts: 38

    Thank you for the feedback, Brajesh.

    On the things you’ve pointed:

    1.Its okay that users appear in the members directory but, is it possible to include the group they belong to or, even better, group them in the directory?
    2.In the future, I’d like to give group admins the ability to delete/edit users. Maybe not now, but it would be the ideal scenario, is this doable?

    About the question:

    1.I’d prefer the users to manually activate their accounts so I can put there (in the activation page) the “Terms of service” they are accepting to access the service

    What do you think about this?

    Thank you,
    Javier

  • Participant
    Level: Enlightened
    Posts: 38

    That really did the trick!

    I was redefining $user_data and $user_login to make things work… I’m not an expert here, as you can clearly see.

    Thank you very much, Brajesh and Ravi.

    All the best,
    Javi

  • Participant
    Level: Enlightened
    Posts: 38

    Hi Brajesh,

    Unfortunately is not working. Some arguments missing:

    
    Warning: Missing argument 2 for buddy_new_reset_password_email() [...] on line 3
    
    Warning: Missing argument 3 for buddy_new_reset_password_email() [...] on line 3
    
    Warning: Missing argument 4 for buddy_new_reset_password_email() [...] on line 3
    
    Notice: Undefined variable: user_data in [...] on line 6
    
    Notice: Trying to get property of non-object in [...] on line 6
    
    Notice: Undefined variable: user_data in [...] on line 9
    
    Notice: Trying to get property of non-object in [...] on line 9
    
    Notice: Undefined variable: user_email in [...] on line 20
    

    Also, I think we need to override $user_email, instead of $email. I turned $email to $user_email, but still getting the missing arguments.

    Thank you for your time,
    Javier

    • This reply was modified 8 years, 7 months ago by Javier.
    • This reply was modified 8 years, 7 months ago by Javier.
    • This reply was modified 8 years, 7 months ago by Javier.
  • Participant
    Level: Enlightened
    Posts: 38

    Hello Ravi,

    This works pretty well, thank you very much!

    Now I need to fetch the xProfile email value and check if its empty. Maybe it would be better to do this outside ‘buddy_new_reset_password_email()’ within another function. I’m not a php black belt, just guessing the smartest way to do this.

    Thank you again,
    Javier