BuddyDev

Search

How can leave comment?

  • Participant
    Level: Initiated
    Posts: 6
    Andrey on #20643

    There is a need to ask a question, but there is no way to write a message. How can I do it?
    Theme: https://buddydev.com/bp-redirect-to-profile-plugin-redirect-users-to-their-profile-on-login-on-buddypress-sites/#comments

    P.s. Brajesh

    Thanks

  • Keymaster
    (BuddyDev Team)
    Posts: 24212
    Brajesh Singh on #20648

    Hi Andrey,
    Welcome to BuddyDev.

    Please post the question here.
    We have changed the blog comment policy to leave it open only for 30 days. It helps us manage better here(In past, we had too many unanswered, un-managed comments on very old posts)

    Using forums provide a better platform for code sharing, so I encourage it.

    I am looking forward to your question.

    Regards
    Brjesh

  • Participant
    Level: Initiated
    Posts: 6
    Andrey on #20656

    Hi Brajesh,
    thanks for your reply.

    I Inserted in functions.php code but unfortunately its doesnt work : /
    How can I find whats the reason is?

    add_filter( ‘bp_login_redirect’, ‘bpdev_redirect_to_profile’, 11, 3 );

    function bpdev_redirect_to_profile( $redirect_to_calculated, $redirect_url_specified, $user ){

    if( empty( $redirect_to_calculated ) )
    $redirect_to_calculated = admin_url();

    //if the user is not site admin,redirect to his/her profile

    if( isset( $user->ID) && ! is_super_admin( $user->ID ) )
    return bp_core_get_user_domain( $user->ID );
    else
    return $redirect_to_calculated; /*if site admin or not logged in,do not do anything much*/

    }

    I tried through the plugin the same situation.
    http://wordpress.org/extend/plugins/bp-redirect-to-profile/

    Version BP is: 4.1.0

  • Keymaster
    (BuddyDev Team)
    Posts: 24212
    Brajesh Singh on #20661

    Hi Andrey
    Thank you for the question.

    Are you using a custom theme or any plugin that controls site access?

    If yes, Please provide the name/details.

    Thank you
    Brajesh

  • Participant
    Level: Initiated
    Posts: 6
    Andrey on #20669
    This reply has been marked as private.
  • Keymaster
    (BuddyDev Team)
    Posts: 24212
    Brajesh Singh on #20693

    Hi Andrey,
    I am sorry, the sweetdate theme uses ajax login and the above code won’t work for that.

    In the code from my blog post, try changing

    bp_login_redirect with login_redirect. That may work(depends on your settings if reload is not enabled).

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 6
    Andrey on #20807

    Hi Brajesh,
    thanks for your reply.

    Re-name filter and my code in functions.php look like:

    add_filter( ‘login_redirect’, ‘bpdev_redirect_to_profile’, 11, 3 );

    function bpdev_redirect_to_profile( $redirect_to_calculated, $redirect_url_specified, $user ){

    if( empty( $redirect_to_calculated ) )
    $redirect_to_calculated = admin_url();

    //if the user is not site admin,redirect to his/her profile

    if( isset( $user->ID) && ! is_super_admin( $user->ID ) )
    return bp_core_get_user_domain( $user->ID );
    else
    return $redirect_to_calculated; /*if site admin or not logged in,do not do anything much*/

    }

    Unfortunately the result the same : /

  • Keymaster
    (BuddyDev Team)
    Posts: 24212
    Brajesh Singh on #20819

    Hi Andrey,
    I am sorry for the inconvenience.

    Please post the code to your theme authors and ask them for support. It is most probably theme is controlling the redirect.

    The above snippets work on default wp/bp setup.

    Regards
    Brajesh

You must be logged in to reply to this topic.

This topic is: not resolved