Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

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

  • Grant Derepas
    Participant

    @dr_scythe

    Buddypress User Account Type was built before the introduction of member types. The plugin would need to be completely rewritten to work as a feature add-on to the core BuddyPress member types.


    Grant Derepas
    Participant

    @dr_scythe

    I’m thinking this might be possible using the gravity forms user registration addon and a member type field on the signup form.

    Gravity Forms user registration has a hook upon user creation so we could do something like:

    
    add_action("gform_user_registered", "add_custom_user_meta", 10, 4);
    function add_custom_user_meta($user_id, $config, $entry, $user_pass) {    
        $membertype = rgar( $entry, '1' );
        $set_member_type = bp_set_member_type( $user_id, $membertype );
    }
    

    The ‘1’ would be substituted for the field_id of the field where the user selects their member type (field value should be equal to the slug of the member type)


    Grant Derepas
    Participant

    @dr_scythe

    Still need to come up with a way to change this meta data for profiles


    Grant Derepas
    Participant

    @dr_scythe

    Achieved what I was after with the following code

    function global_remove_media_tab() {
    
    global $bp;
    
    $profileid = bp_displayed_user_id();
    $profiletype = xprofile_get_field_data( 'User Type', $profileid );
    if ($profiletype == 'Groupie'){
    	bp_core_remove_nav_item('media');
    	}
    }
    
    add_action('bp_setup_nav','global_remove_media_tab');

    Grant Derepas
    Participant

    @dr_scythe

    //For own profile
    //First i need the logged in users id
    function global_remove_media_tab() {
    
    global $bp;
    
    $userid = bp_loggedin_user_id();
    //Then use that ID to work out what type of user they are
    $usertype = xprofile_get_field_data( 'User Type', $userid );
    if ($usertype == 'Groupie'){
    	bp_core_remove_nav_item('media');
    	}
    }
    
    add_action('bp_setup_nav','global_remove_media_tab');

    Ok this code “works”.
    But it removes the media tab for every profile when logged in as a “Groupie” User type.
    What I want is to remove the tab from all Groupie Member profiles only including groupie members looking at their own profile.


    Grant Derepas
    Participant

    @dr_scythe

    After some further debugging the code is failing at this line:

    $usertype = bp_profile_field_data( 'field=User Type&user_id=$userid' );

    I’ve also tried the following and the correct data is still not being pulled from the database

    $usertype = bp_get_profile_field_data( array(‘user_id’=>$userid,’field’=>'User Type' ));

    In both cases I’ve also tried swapping the field= to the field id number which still doesn’t work.


    Grant Derepas
    Participant

    @dr_scythe

    
    //For own profile
    //First i need the logged in users id
    global $bp;
    $userid = bp_loggedin_user_id();
    //Then use that ID to work out what type of user they are
    $usertype = bp_profile_field_data( 'field=User Type&user_id=$userid' );
    
    if ($usertype == 'type1'){
    	function remove_media_tab(){
    	bp_core_remove_nav_item('media');
    	}
    }
    
    add_action('bp_friends_setup_nav','remove_media_tab');
    

    Ok updated that code and added it to my themes functions.php file.

    Upon testing the code doesn’t seem to be doing anything. Logged in as specified user type and viewed my own profile as well as another member of that types profile and both are still showing the media tab.

    Thoughts?


    Grant Derepas
    Participant

    @dr_scythe

    Anyone got any ideas on how to proceed with achieving this?


    Grant Derepas
    Participant

    @dr_scythe

    Update: tried disabling all plugins and changing to default theme and still experiencing this issue


    Grant Derepas
    Participant

    @dr_scythe

    Getting the same issue on my website running the Mingle Theme

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