Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to create more fields in a group?


  • ericooliveira
    Member

    @ericooliveira

    I would like to know if there a plugin or other way to create more fields for users fill when he are creating a group. Thanks.

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

  • crazywhistlepig
    Participant

    @crazywhistlepig

    As would I. I am using a buddypress installation to manage organizations as groups, and need to add the org’s address, and other info. Is this possible?

    Thanks!


    r-a-y
    Keymaster

    @r-a-y

    No plugin exists for this at the moment.

    This has to be manually coded. If you’re a plugin developer, check out this codex article:
    https://codex.buddypress.org/developer-docs/group-extension-api/

    And also check out the groupmeta functions in /bp-groups.php.

    There are a few threads about this on buddypress.org. I’d suggest doing a search on Google.

    An example can be found here:
    https://buddypress.org/community/groups/how-to-and-troubleshooting/forum/topic/profile-fields-for-groups#post-78706


    4ella
    Participant

    @4ella

    I would like to know that too , it is strange that nobody didn’t create it till now , because many times the groups are companies , and those have addresses so it should be nice to have all location info of any group on some group “map- location-contact” page .


    nit3watch
    Participant

    @nit3watch

    I put this together some time ago though should still work. change gcode and dress code to what you would like. Save it as what ever you would like, with a php extension and place it in your plugins. Active and gl :P I also greated some group map plugin some time ago thats floating around on the forums.. you would have to search or wait for gpress.

    `<?php
    /*
    Plugin Name: BuddyPress Group Dress Code
    Plugin URI:
    Description: This plugin adds an additional field to group creation for a dress code
    Version: 1.0
    Revision Date: June 25, 2010
    License: GNU General Public License 2.0 (GPL) http://www.gnu.org/licenses/gpl.html
    Author: Charl Kruger
    Author URI:
    */

    /* Show group dresscode number in group header */
    $gdcode_show_dresscode_in_header = true ;

    /* – HERE BEGINS THE CODE – */

    // create the form to add the field
    function gdcode_add_dresscode_form() {
    ?>

    <input type="text" name="group-dresscode" id="group-dresscode" value="” />

    <?php

    }
    add_action( ‘groups_custom_group_fields_editable’, ‘gdcode_add_dresscode_form’ );

    // Save the dresscode number in the group meta – perhaps use serialize() and maybe_unserialize()
    function gdcode_save_dresscode( $group_id ) {
    global $bp;

    if($bp->groups->new_group_id)
    $id = $bp->groups->new_group_id;
    else
    $id = $group_id;

    if ( $_POST )
    groups_update_groupmeta( $id, ‘gdcode_group_dresscode’, $_POST );
    }

    // Get or return the dresscode number
    function gdcode_group_dresscode() {
    echo gdcode_get_group_dresscode();
    }
    function gdcode_get_group_dresscode( $group = false ) {
    global $groups_template;
    if ( !$group )
    $group =& $groups_template->group;
    $group_dresscode = groups_get_groupmeta( $group->id, ‘gdcode_group_dresscode’ );
    $group_dresscode = stripcslashes( $group_dresscode );
    return apply_filters( ‘gdcode_get_group_dresscode’, $group_dresscode );
    }

    // show dresscode number in group header
    function gdcode_show_dresscode_in_header( $description ) {
    global $gdcode_show_dresscode_in_header;
    if ( gdcode_get_group_dresscode() && $gdcode_show_dresscode_in_header ) {
    $description .= ‘

    ‘. __(‘Dress code’, ‘gdcode’).’: 

    ‘.gdcode_make_dresscode_for_group().”;
    }
    return $description;
    }
    add_filter( ‘bp_get_group_description’, ‘gdcode_show_dresscode_in_header’ );

    // show number for an individual group
    function gdcode_make_dresscode_for_group() {
    global $bp, $wpdb, $gdcode_args;

    $group_dresscode = gdcode_get_group_dresscode();
    $group_dresscode = ‘

    ‘.$group_dresscode.’

    ‘;

    return $group_dresscode;
    }

    add_action( ‘groups_create_group_step_save_group-details’, ‘gdcode_save_dresscode’ );
    add_action( ‘groups_details_updated’, ‘gdcode_save_dresscode’ );
    ?>`

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to create more fields in a group?’ is closed to new replies.
Skip to toolbar