Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

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

  • pratibhasvaksha
    Participant

    @pratibhasvaksha

    @venutius

    I’ve used this action add_action('bp_before_group_header_meta', 'show_info_in_header'); and it worked perfectly.

    Thank you so much for your help! Really appreciate it!


    pratibhasvaksha
    Participant

    @pratibhasvaksha

    @venutius
    Hi! Could you please guide me or provide me any reference?


    pratibhasvaksha
    Participant

    @pratibhasvaksha

    @venutius
    This is the code which I’m using to add two fields in group creation form.

    function custom_field($meta_key='') {
      //get current group id and load meta_key value if passed. If not pass it blank
      return groups_get_groupmeta( bp_get_group_id(), $meta_key) ;
    }
    
    function group_header_fields_save( $group_id ) {
      global $bp, $wpdb;
      $plain_fields = array(
        'group-month',
        'group-year'
      );
      foreach( $plain_fields as $field ) {
        $key = $field;
        if ( isset( $_POST[$key] ) ) {
          $value = $_POST[$key];
          groups_update_groupmeta( $group_id, $field, $value );
        }
      }
    }
    add_action( 'groups_group_details_edited', 'group_header_fields_save' );
    add_action( 'groups_created_group',  'group_header_fields_save' );
    
    // Show the custom field in the group header
    function show_field_in_header( ) {
      echo "<p> Month: " . custom_field('group-month') . "</p>";
      echo "<p> Year: " . custom_field('group-year') . "</p>";
    }
    add_action('bp_group_header_meta' , 'show_field_in_header') ;

    I’ve manually added the code to display the fields in create.php file. In frontend, the field is visible on group listing (groups-loop.php) and on single group page.

    Now, I want to add a meta box to the group edit to update the field information directly from the admin panel.

    I’ll be grateful If you can help me out! Looking forward to your reply.

    Thanks!


    pratibhasvaksha
    Participant

    @pratibhasvaksha

    @venutius
    Hi, Thank you so much for reply!
    I tried it but it’s not working. I just need them to display on the group admin to edit/remove the fields data.


    pratibhasvaksha
    Participant

    @pratibhasvaksha

    Hi @venutius,
    Thanks for the reply. Could you please elaborate a bit? Are you talking about this function and how we access it using a filter/action?

    function bp_nouveau_set_nav_item_order( $nav = null, $order = array(), $parent_slug = '' ) {
    	if ( ! is_object( $nav ) || empty( $order ) || ! is_array( $order ) ) {
    		return false;
    	}
    	$position = 0;
    	foreach ( $order as $slug ) {
    		$position += 10;
    		$key = $slug;
    		if ( ! empty( $parent_slug ) ) {
    			$key = $parent_slug . '/' . $key;
    		}
    		$item_nav = $nav->get( $key );
    		if ( ! $item_nav ) {
    			continue;
    		}
    		if ( (int) $item_nav->position !== (int) $position ) {
    			$nav->edit_nav( array( 'position' => $position ), $slug, $parent_slug );
    		}
    	}
    	return true;
    }

    pratibhasvaksha
    Participant

    @pratibhasvaksha

    Hi Varun,
    Thanks for the reply. The navigation API does not solve my problem. I don’t want to change the inner pages navigation menu. I want to rearrange the menu items in the header under the user profile picture.

    Rearranging the below menu:

    1. Dashboard
    2. Profile
    3. Notifications
    4. Messages
    5. Friends
    6. Groups
    7. Settings
    8. Logout

    to the this menu:

    1. Dashboard
    2. Groups
    3. Notifications
    4. Messages
    5. Friends
    6. Profile
    7. Settings
    8. Logout

    pratibhasvaksha
    Participant

    @pratibhasvaksha

    Hello,
    can anyone help to make group avatar uploading mandatory?


    pratibhasvaksha
    Participant

    @pratibhasvaksha

    No, I haven’t used the hook. I explored the templates and found out that it’s using another plugin for file handling. The js file are as follows:
    1. plupload.min.js
    2. moxie.min.js

    I even tried making the input field required using jquery but the id in the input field is coming dynamically. I cannot target the input field directly.


    pratibhasvaksha
    Participant

    @pratibhasvaksha

    function group_header_fields_save( $group_id ) {

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