Skip to:
Content
Pages
Categories
Search
Top
Bottom

i want to edit buttons.


  • qaribhinder
    Participant

    @qaribhinder

    how can i edit buttons?
    ‘Friends to Connections’
    ‘Add Friend to Connect’
    also in all notifications this edition should apply.

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

  • leog371
    Participant

    @leog371

    /* Example to Change item names of user’s and group’s nav menus ...
    Profile Menu https://codex.buddypress.org/developer/navigation-api/#examples
    */ 
    function bpcodex_rename_profile_tabs() {
      
          buddypress()->members->nav->edit_nav( array( 'name' => __( 'My Forums', 'textdomain' ) ), 'forums' );
          buddypress()->members->nav->edit_nav( array( 'name' => __( 'MY Groups', 'textdomain' ) ), 'groups' );
      
    }
    add_action( 'bp_actions', 'bpcodex_rename_profile_tabs' );
    /* Example to Rename Group Menus https://codex.buddypress.org/developer/navigation-api/#examples*/ 	
    function bpcodex_rename_group_tabs() {
     
        if ( ! bp_is_group() ) {
            return;
        }
        
        buddypress()->groups->nav->edit_nav( array( 'name' => __( 'Group Discussion', 'buddypress' ) ), 'forum', bp_current_item() );
    	buddypress()->groups->nav->edit_nav( array( 'name' => __( 'Group Members', 'buddypress' ) ), 'members', bp_current_item() );
    	buddypress()->groups->nav->edit_nav( array( 'name' => __( 'Group Activity', 'buddypress' ) ), 'home', bp_current_item() );
    }
    add_action( 'bp_actions', 'bpcodex_rename_group_tabs' );	
    	
    /* Example to Remove subnav tabs from Group Settings  https://codex.buddypress.org/developer/navigation-api/#examples*/ 	
    	function bpcodex_remove_group_manager_subnav_tabs() {   
        // site admin will see all tabs
        if ( ! bp_is_group() || ! ( bp_is_current_action( 'admin' ) && bp_action_variable( 0 ) ) || is_super_admin() ) {
            return;
        }
           // all subnav items are listed here.
           // comment those you want to show
            $hide_tabs = array(             
            //  'group-settings'    => 1,
            //    'delete-group'      => 1,
             //   'group-avatar'      => 1,
            //  'group-invites'     => 1,
             //   'manage-members'    => 1,
            //  'forum'             => 1,
            //  'group-cover-image' => 1
            );
                       
            $parent_nav_slug = bp_get_current_group_slug() . '_manage';
      
        //Remove the nav items
        foreach ( array_keys( $hide_tabs ) as $tab ) {
            bp_core_remove_subnav_item( $parent_nav_slug, $tab, 'groups' );
        }   
    }
    add_action( 'bp_actions', 'bpcodex_remove_group_manager_subnav_tabs' );
    

    leog371
    Participant

    @leog371

    /**
     * Output the Add Friend button.
     *
     * @since 1.0.0
     *
     * @see bp_get_add_friend_button() for information on arguments.
     *
     * @param int      $potential_friend_id See {@link bp_get_add_friend_button()}.
     * @param int|bool $friend_status       See {@link bp_get_add_friend_button()}.
     */
    function ct_add_friend_button( $potential_friend_id = 0, $friend_status = false ) {
    	echo get_add_friend_button( $potential_friend_id, $friend_status );
    }
    
    /**
    	 * Create the Add Friend button.
    	 *
    	 * @since 1.1.0
    	 *
    	 * @param int  $potential_friend_id ID of the user to whom the button
    	 *                                  applies. Default: value of {@link bp_get_potential_friend_id()}.
    	 * @param bool $friend_status       Not currently used.
    	 * @return false|string HTML for the Add Friend button.
    	 */
    	function get_add_friend_button( $potential_friend_id = 0, $friend_status = false ) {
    
    		if ( empty( $potential_friend_id ) )
    			$potential_friend_id = bp_get_potential_friend_id( $potential_friend_id );
    
    		$is_friend = bp_is_friend( $potential_friend_id );
    
    		if ( empty( $is_friend ) )
    			return false;
    
    		switch ( $is_friend ) {
    			case 'pending' :
    				$button = array(
    					'id'                => 'pending',
    					'component'         => 'friends',
    					'must_be_logged_in' => true,
    					'block_self'        => true,
    					'wrapper_class'     => 'friendship-button pending_friend',
    					'wrapper_id'        => 'friendship-button-' . $potential_friend_id,
    					'link_href'         => wp_nonce_url( bp_loggedin_user_domain() . bp_get_friends_slug() . '/requests/cancel/' . $potential_friend_id . '/', 'friends_withdraw_friendship' ),
    					'link_text'         => __( 'Cancel Friendship Request', 'buddypress' ),
    					'link_id'           => 'friend-' . $potential_friend_id,
    					'link_rel'          => 'remove',
    					'link_class'        => 'friendship-button pending_friend requested'
    				);
    				break;
    
    			case 'awaiting_response' :
    				$button = array(
    					'id'                => 'awaiting_response',
    					'component'         => 'friends',
    					'must_be_logged_in' => true,
    					'block_self'        => true,
    					'wrapper_class'     => 'friendship-button awaiting_response_friend',
    					'wrapper_id'        => 'friendship-button-' . $potential_friend_id,
    					'link_href'         => bp_loggedin_user_domain() . bp_get_friends_slug() . '/requests/',
    					'link_text'         => __( 'Friendship Requested', 'buddypress' ),
    					'link_id'           => 'friend-' . $potential_friend_id,
    					'link_rel'          => 'remove',
    					'link_class'        => 'friendship-button awaiting_response_friend requested'
    				);
    				break;
    
    			case 'is_friend' :
    				$button = array(
    					'id'                => 'is_friend',
    					'component'         => 'friends',
    					'must_be_logged_in' => true,
    					'block_self'        => false,
    					'wrapper_class'     => 'friendship-button is_friend',
    					'wrapper_id'        => 'friendship-button-' . $potential_friend_id,
    					'link_href'         => wp_nonce_url( bp_loggedin_user_domain() . bp_get_friends_slug() . '/remove-friend/' . $potential_friend_id . '/', 'friends_remove_friend' ),
    					'link_text'         => __( 'Unfriend', 'buddypress' ),
    					'link_id'           => 'friend-' . $potential_friend_id,
    					'link_rel'          => 'remove',
    					'link_class'        => 'friendship-button is_friend remove'
    				);
    				break;
    
    			default:
    				$button = array(
    					'id'                => 'not_friends',
    					'component'         => 'friends',
    					'must_be_logged_in' => true,
    					'block_self'        => true,
    					'wrapper_class'     => 'friendship-button not_friends',
    					'wrapper_id'        => 'friendship-button-' . $potential_friend_id,
    					'link_href'         => wp_nonce_url( bp_loggedin_user_domain() . bp_get_friends_slug() . '/add-friend/' . $potential_friend_id . '/', 'friends_add_friend' ),
    					'link_text'         => __( 'Add Friend', 'buddypress' ),
    					'link_id'           => 'friend-' . $potential_friend_id,
    					'link_rel'          => 'add',
    					'link_class'        => 'btn btn-danger'
    				);
    				break;
    		}
    
    		/**
    		 * Filters the HTML for the add friend button.
    		 *
    		 * @since 1.1.0
    		 *
    		 * @param string $button HTML markup for add friend button.
    		 */
    		return bp_get_button( apply_filters( 'get_add_friend_button', $button ) );
    	}
    ?>

    leog371
    Participant

    @leog371

    put in bp-custom.php and change them how you like


    Varun Dubey
    Participant

    @vapvarun

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.
Skip to toolbar