Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

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

  • djmazi12
    Participant

    @djmazi12

    function wc_custom_user_redirect( $redirect, $user ) {
    // Get the first of all the roles assigned to the user
    $role = $user->roles[0];
    
    $myaccount = get_permalink( wc_get_page_id( 'myaccount' ) );
    
    if( $role == 'child' ) {
       $redirect = bp_core_get_user_domain( $user->ID );
    } 
       } else {
    //Redirect any other role to the previous visited page or, if not available, to the home
    $redirect = wp_get_referer() ? wp_get_referer() : home_url();
    }
       return $redirect;
    }
    add_filter( 'woocommerce_login_redirect', 'wc_custom_user_redirect', 10, 2 );

    Gives me internal error.


    djmazi12
    Participant

    @djmazi12

    Paul you are the man!

    I have no idea either why that would work, however it did!
    Thank you so much for your help.


    djmazi12
    Participant

    @djmazi12

    Hi Paul

    You’ve been a great help!

    I managed to find the correct buddypress index file.

    If it isn’t too much I would like your help to one last thing.
    So i created my div, however i want it to be visible to only the administrator.

    I found a code i can use:

    <?php
    if (current_user_can(‘edit_users’)){
    ?>
    <div class="opretbruger">Opret bruger</div>
    <?php
    }
    ?>

    however it doesn’t seem to work – it simply hides the div for every user even though my administrator role has the right to edit users. I also tried with ‘administrator’. Am i doing anything wrong?


    djmazi12
    Participant

    @djmazi12

    Hi Paul

    Thanks a lot for your help. 🙂

    I tried your suggestion, however the members directory look now changed. However i was able to insert my html/css, so that is good. What would i have to do in order to keep the look it was before and still be able to insert my html/css? I tried just inserting my html in the original folder, but it doesn’t seem to show.


    djmazi12
    Participant

    @djmazi12

    See my comment. Forgot to do it as a reply.


    djmazi12
    Participant

    @djmazi12

    Hi Paul

    Sounds great. Yes i know how to some basic HTML and CSS – not very good at PHP. But where would i have to edit this file? Am i right if its in the child theme, so it won’t be overwritten when i update?

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