BuddyDev

Search

Restrict the Default Profile Type (aka the “—“)

Tagged: 

  • Participant
    Level: Initiated
    Posts: 8
    BrianGumble on #44078

    Previously ya’ll helped me restrict the comment activity of specific profile types such as student…but I am wondering if either of the following customizations is possible?

    1) make the default type the restricted profile type (1st choice solution)

    2) OR Limit profile type drop down options to just two profile types, excluding the default type

    Thank you

  • Keymaster
    (BuddyDev Team)
    Posts: 24149
    Brajesh Singh on #44079

    Hi,
    Thank you for the question.

    Are you using member type profile field? If yes, you can set the default field type option as well as disable the “–”

    Please visit Dashboard->Users->Profile Fields and edit the member type field settings.

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 8
    BrianGumble on #44109

    No, I think I may not be clear. Sorry. Below is the bp-custom.php script ya’ll helped me to create that restricts “none” profile type’s reply comments. And my question is how to I block the “Default” option rather than the “none” option. I tried leaving it blank like (‘ ‘) and the website crashed, so…how do I do that?

    <?php
    function buddydev_user_can_reply_on_comment( $can ) {
    // Replace ‘student’ with your member type.
    $is_restricted = bp_has_member_type( get_current_user_id(), ‘none’);

    if ( $is_restricted ) {
    $can = false;
    }

    return $can;

  • Participant
    Level: Initiated
    Posts: 8
    BrianGumble on #44134

    Any suggestions? Also I don’t see the Dashboard >Users>Profile Field area in my wordpress dashboard. Please let me know what I should replace the ‘none’ with in order to make the default the “‘none'”

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 2908
    Ravi on #44138

    Hello Brian,

    Can you point me to the option you want to modify using some screenshots so that We can understand your problem more clearly?

    Regards
    Ravi

  • Participant
    Level: Initiated
    Posts: 8
    BrianGumble on #44159

    Yes, in this screen you will see 3 profile type options: ‘—-‘, ‘none’, and ‘practicing’. And I’d like to either remove the ‘—-‘ option from the dropdown or in my custom.php script make this option the one that cannot send replies.
    https://ibb.co/3pjM4Zy

    NOTE: the ‘—-‘ seems to be a default or “null” profile type which I can’t seem to remove. Ideally I would just remove it.

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 2908
    Ravi on #44164

    Hello Brian,

    Thank you for sharing the screenshots. Please replace the old code which is shared here:

    https://buddydev.com/support/forums/topic/how-do-i-restrict-certain-member-types-from-comment-replying/#post-43765

    with

    
    
    /**
     * Restrict member type for replying
     *
     * @param bool $can Bool.
     *
     * @return bool
     */
    function buddydev_user_can_reply_on_comment( $can ) {
    	// Replace 'student' with your member type.
    	$user_member_types = bp_get_member_type( get_current_user_id(), false );
    $user_member_types = empty( $user_member_types ) ? array() : $user_member_types;
    
    	if ( ! $user_member_types || in_array( 'student', $user_member_types ) ) {
    		$can = false;
    	}
    
    	return $can;
    }
    
    add_filter( 'bp_activity_can_comment_reply', 'buddydev_user_can_reply_on_comment' );
    
    

    Please check

    Regards
    Ravi

    • This reply was modified 2 years ago by Ravi.
  • Participant
    Level: Initiated
    Posts: 8
    BrianGumble on #44244

    It works! One related question…it seems that the custom.php file causes my media popup for buddypress polls to appear behind the modal for front-end post submission…do you know how I can make the media upload modal popup over the front-end submission instead of behind?

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 2908
    Ravi on #44248

    Hello Brian,

    Thank you for the acknowledgement. Please try using the CSS property Z-index on the modal popup.

    Regards
    Ravi

You must be logged in to reply to this topic.

This topic is: not resolved