Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to add fields to group creation with Group extension API (please read)


  • alfredojp
    Participant

    @alfredojp

    I’m pretty good with MySql but not so hot with PHP. I’ve spent two weeks trying to figure out how to add
    another field(s) to the group creation so that a few more fields would be standard for the groups (i already know about that plugin that lets group admin put in fields aftewards), hours and hours and hours on these same forums with little help. I ran across group extension API code ( http://codex.buddypress.org/developer-docs/group-extension-api/ ) but i have no idea how to use it. What do i add, and in what file do i put it in (functions.php, bp-custom.php) so that i can have group fields (at creation) for city, state, country and phone number.

    Any help in this is greatly appreciated.

Viewing 25 replies - 26 through 50 (of 57 total)

  • 4ella
    Participant

    @4ella

    Great job @modemlooper @boonebgorges !! , Thanks a lot for very useful plugin
    btw. I had the same error underneath description as @alfredojp , then it showed first 4/5 fields and all fields below the field PHONE number disappeared , when
    trying to insert them again I got this :

    Warning: Invalid argument supplied for foreach() in /home2/dancersr/public_html/stripunity/wp-content/plugins/buddypress-groups-extras/bpge-loader.php on line 232

    Warning: Cannot modify header information – headers already sent by (output started at /home2/dancersr/public_html/stripunity/wp-content/plugins/buddypress-groups-extras/bpge-loader.php:232) in /home2/dancersr/public_html/stripunity/wp-includes/pluggable.php on line 934

    so it seems that it conflicts with @slaffik Group Extras.
    When I have deactivated Group Extras I worked perfectly.

    When fully working how can I display all those fields ?


    4ella
    Participant

    @4ella

    I am running new clean test installation and have there both latest versions WP 3.21 / BP 1.5 and only 3 plugins together with @slaffik Groups Extras.


    4ella
    Participant

    @4ella

    second test after deactivating Group Extras was the same, so It doesn’t memorize all fields below the field “phone number” which sometimes doesn’t work too because after the saving it change the value into the value of the field above (WEBSITE), @modemlooper or @boonebgeorges if you want admin access to my testing site (www.stripunity.com – untouched brand new clean installation (latest wordpress & buddypress versions with 3 plugins in it) for your plugin testing purposes , I would gladly send you an password.


    Boone Gorges
    Keymaster

    @boonebgorges

    The code that I posted above was written for a very specific installation. It was nice of @modemlooper to make it into a plugin, but it’s not really ready to be used widely. It’s meant to be used as a model for building something specific for your own site.


    modemlooper
    Moderator

    @modemlooper

    What Boone said, I’m going to clean it up and make it more functional. So currently use it at own risk.


    alfredojp
    Participant

    @alfredojp

    I can’t thank you enough @modemlooper and @boonebgorges you have also been super helpful. I really have no need for the links so i took out line 9 all together and that error disappeared. I did however realize that when i create the group the information apart fromt he URL doesn’t stay saved and the all the information goes to a table int he database for group metadata. What do you think about a conditional statement that says if (first time run) then alter table wp-groups to add in more fields and then a good old INSERT INTO.
    else
    just an INSERT INTO (wp-roups)

    what do you think about that?


    4ella
    Participant

    @4ella

    I didn’t install it on a live site, so I am not risking anything , I am not a programmer so I try to help at least by testing, on my opinion this feature (groups custom fields ) is one of the most important features to most of Buddypress users, so thanks both Boone and Modemlooper for trying to help us.


    modemlooper
    Moderator

    @modemlooper

    @alfredojp do not do that, you should be only saving group stuff to groupmeta and not creating your own db inserts.

    I’ve changed some of the code from Boone’s example so if you are not using the plugin link code could be the reason it isn’t saving.


    alfredojp
    Participant

    @alfredojp

    @modemlooper thanks for the advice.

    I am using the plugin link code you gave me, thank you here’s the link to verify:
    https://github.com/modemlooper/buddypress-group-fields/tree/master/buddypress-group-fields

    I see thtat its saving in the groupmeta table in the database but when i go to look at it in the group details itself it doesn’t show anything in those fields. Not to mention I need for it to be searchable. Please let me know what i can do to help to make this something that the community can use. I’m a quick learner ( i think hehe).

    Any ideas how to solve that? have a look yourself http://www.caradacapoeira.com


    alfredojp
    Participant

    @alfredojp

    @modemlooper

    Hey so anything else about the my last post.

    I see thtat its saving in the groupmeta table in the database but when i go to look at it in the group details itself it doesn’t show anything in those fields. Not to mention I need for it to be searchable. Please let me know what i can do to help to make this something that the community can use.

    Please, you help is much appreciated


    4ella
    Participant

    @4ella

    For displaying member profiles fields I use this code in member-header.php:

    State/Region:

    How can we display group custom fields in group-header.php?


    4ella
    Participant

    @4ella

    For displaying member profiles fields I use this code in member-header.php:
    php if ( $data = bp_get_profile_field_data( ‘field=State’ ) ) :

    State/Region: php echo $data

    php endif
    (the code will be broken because I have forget how to insert the code on this site)
    How can we display group custom fields in group-header.php?


    4ella
    Participant

    @4ella

    If somebody interested I have modified @modemlooper buddypress-group-fields.php for my website
    I have deleted $links , so it doesn’t show WARNING , I have found an error in phone field so it works now and also other fields are memorized well , I have also added some new location and contact fields , I have created all 247 countries list (dropdown menu) – everything looks working well ,
    I don’t know how to display it in templates yet , Opening days(Monday , Tuesday , Wednesday ….) field I wanted to use checkboxes , but I wasn’t not sure if I was able to do that , so I have used dropdown menu now too.

    <?php
    add_filter( 'groups_custom_group_fields_editable', 'group_details_markup' );
    add_action( 'groups_group_details_edited', 'group_details_save' );
    add_action( 'groups_created_group', 'group_details_save' );

    function group_details_markup() {
    global $bp, $wpdb;

    $group_text = groups_get_groupmeta( $bp->groups->current_group->id, 'e2e_text' );

    ?>


    Job Description


    (Type of job you offer, detailed description of the work you offer.. etc)





    Location



    groups->current_group->id, 'e2e_country' ); ?>

    <option value="Afghanistan" selected="selected">Afghanistan
    <option value="Albania" selected="selected">Albania
    <option value="Algeria" selected="selected">Algeria
    <option value="American Samoa" selected="selected">American Samoa
    <option value="Andorra" selected="selected">Andorra
    <option value="Angola" selected="selected">Angola
    <option value="Anguilla" selected="selected">Anguilla
    <option value="Antigua & Barbuda" selected="selected">Antigua & Barbuda
    <option value="Argentina" selected="selected">Argentina
    <option value="Armenia" selected="selected">Armenia
    <option value="Aruba" selected="selected">Aruba
    <option value="Australia" selected="selected">Australia
    <option value="Austria" selected="selected">Austria
    <option value="Azerbaijan" selected="selected">Azerbaijan
    <option value="Bahamas" selected="selected">Bahamas
    <option value="Bahrain" selected="selected">Bahrain
    <option value="Bangladesh" selected="selected">Bangladesh
    <option value="Barbados" selected="selected">Barbados
    <option value="Belarus" selected="selected">Belarus
    <option value="Belgium" selected="selected">Belgium
    <option value="Belize" selected="selected">Belize
    <option value="Benin" selected="selected">Benin
    <option value="Bermuda" selected="selected">Bermuda
    <option value="Bhutan" selected="selected">Bhutan
    <option value="Bolivia" selected="selected">Bolivia
    <option value="Bonaire" selected="selected">Bonaire
    <option value="Bosnia & Herzegovina" selected="selected">Bosnia & Herzegovina
    <option value="Botswana" selected="selected">Botswana
    <option value="Brazil" selected="selected">Brazil
    <option value="British Indian Ocean Ter" selected="selected">British Indian Ocean Ter
    <option value="Brunei" selected="selected">Brunei
    <option value="Bulgaria" selected="selected">Bulgaria
    <option value="Burkina Faso" selected="selected">Burkina Faso
    <option value="Burundi" selected="selected">Burundi
    <option value="Cambodia" selected="selected">Cambodia
    <option value="Cameroon" selected="selected">Cameroon
    <option value="Canada" selected="selected">Canada
    <option value="Canary Islands" selected="selected">Canary Islands
    <option value="Cape Verde" selected="selected">Cape Verde
    <option value="Cayman Islands" selected="selected">Cayman Islands
    <option value="Central African Republic" selected="selected">Central African Republic
    <option value="Chad" selected="selected">Chad
    <option value="Channel Islands" selected="selected">Channel Islands
    <option value="Chile" selected="selected">Chile
    <option value="China" selected="selected">China
    <option value="Christmas Island" selected="selected">Christmas Island
    <option value="Cocos Island" selected="selected">Cocos Island
    <option value="Colombia" selected="selected">Colombia
    <option value="Comoros" selected="selected">Comoros
    <option value="Congo" selected="selected">Congo
    <option value="Cook Islands" selected="selected">Cook Islands
    <option value="Costa Rica" selected="selected">Costa Rica
    <option value="Cote de Ivoire" selected="selected">Cote D'Ivoire
    <option value="Croatia" selected="selected">Croatia
    <option value="Cuba" selected="selected">Cuba
    <option value="Curaco" selected="selected">Curacao
    <option value="Cyprus" selected="selected">Cyprus
    <option value="Czech Republic" selected="selected">Czech Republic
    <option value="Denmark" selected="selected">Denmark
    <option value="Djibouti" selected="selected">Djibouti
    <option value="Dominica" selected="selected">Dominica
    <option value="Dominican Republic" selected="selected">Dominican Republic
    <option value="East Timor" selected="selected">East Timor
    <option value="Ecuador" selected="selected">Ecuador
    <option value="Egypt" selected="selected">Egypt
    <option value="El Salvador" selected="selected">El Salvador
    <option value="Equatorial Guinea" selected="selected">Equatorial Guinea
    <option value="Eritrea" selected="selected">Eritrea
    <option value="Estonia" selected="selected">Estonia
    <option value="Ethiopia" selected="selected">Ethiopia
    <option value="Falkland Islands" selected="selected">Falkland Islands
    <option value="Faroe Islands" selected="selected">Faroe Islands
    <option value="Fiji" selected="selected">Fiji
    <option value="Finland" selected="selected">Finland
    <option value="France" selected="selected">France
    <option value="French Guiana" selected="selected">French Guiana
    <option value="French Polynesia" selected="selected">French Polynesia
    <option value="French Southern Ter" selected="selected">French Southern Ter
    <option value="Gabon" selected="selected">Gabon
    <option value="Gambia" selected="selected">Gambia
    <option value="Georgia" selected="selected">Georgia
    <option value="Germany" selected="selected">Germany
    <option value="Ghana" selected="selected">Ghana
    <option value="Gibraltar" selected="selected">Gibraltar
    <option value="Great Britain" selected="selected">Great Britain
    <option value="Greece" selected="selected">Greece
    <option value="Greenland" selected="selected">Greenland
    <option value="Grenada" selected="selected">Grenada
    <option value="Guadeloupe" selected="selected">Guadeloupe
    <option value="Guam" selected="selected">Guam
    <option value="Guatemala" selected="selected">Guatemala
    <option value="Guinea" selected="selected">Guinea
    <option value="Guyana" selected="selected">Guyana
    <option value="Haiti" selected="selected">Haiti
    <option value="Hawaii" selected="selected">Hawaii
    <option value="Honduras" selected="selected">Honduras
    <option value="Hong Kong" selected="selected">Hong Kong
    <option value="Hungary" selected="selected">Hungary
    <option value="Iceland" selected="selected">Iceland
    <option value="India" selected="selected">India
    <option value="Indonesia" selected="selected">Indonesia
    <option value="Iran" selected="selected">Iran
    <option value="Iraq" selected="selected">Iraq
    <option value="Ireland" selected="selected">Ireland
    <option value="Isle of Man" selected="selected">Isle of Man
    <option value="Israel" selected="selected">Israel
    <option value="Italy" selected="selected">Italy
    <option value="Jamaica" selected="selected">Jamaica
    <option value="Japan" selected="selected">Japan
    <option value="Jordan" selected="selected">Jordan
    <option value="Kazakhstan" selected="selected">Kazakhstan
    <option value="Kenya" selected="selected">Kenya
    <option value="Kiribati" selected="selected">Kiribati
    <option value="Korea North" selected="selected">Korea North
    <option value="Korea Sout" selected="selected">Korea South
    <option value="Kuwait" selected="selected">Kuwait
    <option value="Kyrgyzstan" selected="selected">Kyrgyzstan
    <option value="Laos" selected="selected">Laos
    <option value="Latvia" selected="selected">Latvia
    <option value="Lebanon" selected="selected">Lebanon
    <option value="Lesotho" selected="selected">Lesotho
    <option value="Liberia" selected="selected">Liberia
    <option value="Libya" selected="selected">Libya
    <option value="Liechtenstein" selected="selected">Liechtenstein
    <option value="Lithuania" selected="selected">Lithuania
    <option value="Luxembourg" selected="selected">Luxembourg
    <option value="Macau" selected="selected">Macau
    <option value="Macedonia" selected="selected">Macedonia
    <option value="Madagascar" selected="selected">Madagascar
    <option value="Malaysia" selected="selected">Malaysia
    <option value="Malawi" selected="selected">Malawi
    <option value="Maldives" selected="selected">Maldives
    <option value="Mali" selected="selected">Mali
    <option value="Malta" selected="selected">Malta
    <option value="Marshall Islands" selected="selected">Marshall Islands
    <option value="Martinique" selected="selected">Martinique
    <option value="Mauritania" selected="selected">Mauritania
    <option value="Mauritius" selected="selected">Mauritius
    <option value="Mayotte" selected="selected">Mayotte
    <option value="Mexico" selected="selected">Mexico
    <option value="Midway Islands" selected="selected">Midway Islands
    <option value="Moldova" selected="selected">Moldova
    <option value="Monaco" selected="selected">Monaco
    <option value="Mongolia" selected="selected">Mongolia
    <option value="Montserrat" selected="selected">Montserrat
    <option value="Morocco" selected="selected">Morocco
    <option value="Mozambique" selected="selected">Mozambique
    <option value="Myanmar" selected="selected">Myanmar
    <option value="Nambia" selected="selected">Nambia
    <option value="Nauru" selected="selected">Nauru
    <option value="Nepal" selected="selected">Nepal
    <option value="Netherland Antilles" selected="selected">Netherland Antilles
    <option value="Netherlands" selected="selected">Netherlands (Holland, Europe)
    <option value="Nevis" selected="selected">Nevis
    <option value="New Caledonia" selected="selected">New Caledonia
    <option value="New Zealand" selected="selected">New Zealand
    <option value="Nicaragua" selected="selected">Nicaragua
    <option value="Niger" selected="selected">Niger
    <option value="Nigeria" selected="selected">Nigeria
    <option value="Niue" selected="selected">Niue
    <option value="Norfolk Island" selected="selected">Norfolk Island
    <option value="Norway" selected="selected">Norway
    <option value="Oman" selected="selected">Oman
    <option value="Pakistan" selected="selected">Pakistan
    <option value="Palau Island" selected="selected">Palau Island
    <option value="Palestine" selected="selected">Palestine
    <option value="Panama" selected="selected">Panama
    <option value="Papua New Guinea" selected="selected">Papua New Guinea
    <option value="Paraguay" selected="selected">Paraguay
    <option value="Peru" selected="selected">Peru
    <option value="Phillipines" selected="selected">Philippines
    <option value="Pitcairn Island" selected="selected">Pitcairn Island
    <option value="Poland" selected="selected">Poland
    <option value="Portugal" selected="selected">Portugal
    <option value="Puerto Rico" selected="selected">Puerto Rico
    <option value="Qatar" selected="selected">Qatar
    <option value="Republic of Montenegro" selected="selected">Republic of Montenegro
    <option value="Republic of Serbia" selected="selected">Republic of Serbia
    <option value="Reunion" selected="selected">Reunion
    <option value="Romania" selected="selected">Romania
    <option value="Russia" selected="selected">Russia
    <option value="Rwanda" selected="selected">Rwanda
    <option value="St Barthelemy" selected="selected">St. Barthelemy
    <option value="St Eustatius" selected="selected">St. Eustatius
    <option value="St Helena" selected="selected">St. Helena
    <option value="St Kitts-Nevis" selected="selected">St. Kitts-Nevis
    <option value="St Lucia" selected="selected">St. Lucia
    <option value="St Maarten" selected="selected">St. Maarten
    <option value="St Pierre & Miquelon" selected="selected">St. Pierre & Miquelon
    <option value="St Vincent & Grenadines" selected="selected">St. Vincent & Grenadines
    <option value="Saipan" selected="selected">Saipan
    <option value="Samoa" selected="selected">Samoa
    <option value="Samoa American" selected="selected">Samoa American
    <option value="San Marino" selected="selected">San Marino
    <option value="Sao Tome & Principe" selected="selected">Sao Tome & Principe
    <option value="Saudi Arabia" selected="selected">Saudi Arabia
    <option value="Senegal" selected="selected">Senegal
    <option value="Seychelles" selected="selected">Seychelles
    <option value="Sierra Leone" selected="selected">Sierra Leone
    <option value="Singapore" selected="selected">Singapore
    <option value="Slovakia" selected="selected">Slovakia
    <option value="Slovenia" selected="selected">Slovenia
    <option value="Solomon Islands" selected="selected">Solomon Islands
    <option value="Somalia" selected="selected">Somalia
    <option value="South Africa" selected="selected">South Africa
    <option value="Spain" selected="selected">Spain
    <option value="Sri Lanka" selected="selected">Sri Lanka
    <option value="Sudan" selected="selected">Sudan
    <option value="Suriname" selected="selected">Suriname
    <option value="Swaziland" selected="selected">Swaziland
    <option value="Sweden" selected="selected">Sweden
    <option value="Switzerland" selected="selected">Switzerland
    <option value="Syria" selected="selected">Syria
    <option value="Tahiti" selected="selected">Tahiti
    <option value="Taiwan" selected="selected">Taiwan
    <option value="Tajikistan" selected="selected">Tajikistan
    <option value="Tanzania" selected="selected">Tanzania
    <option value="Thailand" selected="selected">Thailand
    <option value="Togo" selected="selected">Togo
    <option value="Tokelau" selected="selected">Tokelau
    <option value="Tonga" selected="selected">Tonga
    <option value="Trinidad & Tobago" selected="selected">Trinidad & Tobago
    <option value="Tunisia" selected="selected">Tunisia
    <option value="Turkey" selected="selected">Turkey
    <option value="Turkmenistan" selected="selected">Turkmenistan
    <option value="Turks & Caicos Is" selected="selected">Turks & Caicos Is
    <option value="Tuvalu" selected="selected">Tuvalu
    <option value="Uganda" selected="selected">Uganda
    <option value="Ukraine" selected="selected">Ukraine
    <option value="United Arab Erimates" selected="selected">United Arab Emirates
    <option value="United Kingdom" selected="selected">United Kingdom
    <option value="United States of America" selected="selected">United States of America
    <option value="Uraguay" selected="selected">Uruguay
    <option value="Uzbekistan" selected="selected">Uzbekistan
    <option value="Vanuatu" selected="selected">Vanuatu
    <option value="Vatican City State" selected="selected">Vatican City State
    <option value="Venezuela" selected="selected">Venezuela
    <option value="Vietnam" selected="selected">Vietnam
    <option value="Virgin Islands (Brit)" selected="selected">Virgin Islands (Brit)
    <option value="Virgin Islands (USA)" selected="selected">Virgin Islands (USA)
    <option value="Wake Island" selected="selected">Wake Island
    <option value="Wallis & Futana Is" selected="selected">Wallis & Futana Is
    <option value="Yemen" selected="selected">Yemen
    <option value="Zaire" selected="selected">Zaire
    <option value="Zambia" selected="selected">Zambia
    <option value="Zimbabwe" selected="selected">Zimbabwe


    groups->current_group->id, 'e2e_province' ); ?>

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

    groups->current_group->id, 'e2e_city' ); ?>

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

    groups->current_group->id, 'e2e_street' ); ?>

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



    Club



    groups->current_group->id, 'e2e_type' ); ?>

    <option value="agency" selected="selected">Agency
    <option value="nightclub" selected="selected">Nightclub
    <option value="stripclub" selected="selected">Stripclub
    <option value="lapdance" selected="selected">Lap dance club
    <option value="tabledance" selected="selected">Table dance club
    <option value="cabaret" selected="selected">Cabaret
    <option value="disco" selected="selected">Disco
    <option value="restaurant" selected="selected">Restaurant



    groups->current_group->id, 'e2e_capacity' ); ?>

    <option value="10" selected="selected">5-10
    <option value="20" selected="selected">10-20
    <option value="30" selected="selected">20-30
    <option value="40" selected="selected">30-40
    <option value="50" selected="selected">40-50
    <option value="60" selected="selected">50+



    groups->current_group->id, 'e2e_opened' ); ?>

    <option value="0:00" selected="selected">0:00
    <option value="0:30" selected="selected">0:30
    <option value="1:00" selected="selected">1:00
    <option value="1:30" selected="selected">1:30
    <option value="2:00" selected="selected">2:00
    <option value="2:30" selected="selected">2:30
    <option value="3:00" selected="selected">3:00
    <option value="3:30" selected="selected">3:30
    <option value="4:00" selected="selected">4:00
    <option value="4:30" selected="selected">4:30
    <option value="5:00" selected="selected">5:00
    <option value="5:30" selected="selected">5:30
    <option value="6:00" selected="selected">6:00
    <option value="6:30" selected="selected">6:30
    <option value="7:00" selected="selected">7:00
    <option value="7:30" selected="selected">7:30
    <option value="8:00" selected="selected">8:00
    <option value="8:30" selected="selected">8:30
    <option value="9:00" selected="selected">9:00
    <option value="9:30" selected="selected">9:30
    <option value="10:00" selected="selected">10:00
    <option value="10:30" selected="selected">10:30
    <option value="11:00" selected="selected">11:00
    <option value="11:30" selected="selected">11:30
    <option value="12:00" selected="selected">12:00
    <option value="12:30" selected="selected">12:30
    <option value="13:00" selected="selected">13:00
    <option value="13:30" selected="selected">13:30
    <option value="14:00" selected="selected">14:00
    <option value="14:30" selected="selected">14:30
    <option value="15:00" selected="selected">15:00
    <option value="15:30" selected="selected">15:30
    <option value="16:00" selected="selected">16:00
    <option value="16:30" selected="selected">16:30
    <option value="17:00" selected="selected">17:00
    <option value="17:30" selected="selected">17:30
    <option value="18:00" selected="selected">18:00
    <option value="18:30" selected="selected">18:30
    <option value="19:00" selected="selected">19:00
    <option value="19:30" selected="selected">19:30
    <option value="20:00" selected="selected">20:00
    <option value="20:30" selected="selected">20:30
    <option value="21:00" selected="selected">21:00
    <option value="21:30" selected="selected">21:30
    <option value="22:00" selected="selected">22:00
    <option value="22:30" selected="selected">22:30
    <option value="23:00" selected="selected">23:00
    <option value="23:30" selected="selected">23:30



    groups->current_group->id, 'e2e_closed' ); ?>

    <option value="0:00" selected="selected">0:00
    <option value="0:30" selected="selected">0:30
    <option value="1:00" selected="selected">1:00
    <option value="1:30" selected="selected">1:30
    <option value="2:00" selected="selected">2:00
    <option value="2:30" selected="selected">2:30
    <option value="3:00" selected="selected">3:00
    <option value="3:30" selected="selected">3:30
    <option value="4:00" selected="selected">4:00
    <option value="4:30" selected="selected">4:30
    <option value="5:00" selected="selected">5:00
    <option value="5:30" selected="selected">5:30
    <option value="6:00" selected="selected">6:00
    <option value="6:30" selected="selected">6:30
    <option value="7:00" selected="selected">7:00
    <option value="7:30" selected="selected">7:30
    <option value="8:00" selected="selected">8:00
    <option value="8:30" selected="selected">8:30
    <option value="9:00" selected="selected">9:00
    <option value="9:30" selected="selected">9:30
    <option value="10:00" selected="selected">10:00
    <option value="10:30" selected="selected">10:30
    <option value="11:00" selected="selected">11:00
    <option value="11:30" selected="selected">11:30
    <option value="12:00" selected="selected">12:00
    <option value="12:30" selected="selected">12:30
    <option value="13:00" selected="selected">13:00
    <option value="13:30" selected="selected">13:30
    <option value="14:00" selected="selected">14:00
    <option value="14:30" selected="selected">14:30
    <option value="15:00" selected="selected">15:00
    <option value="15:30" selected="selected">15:30
    <option value="16:00" selected="selected">16:00
    <option value="16:30" selected="selected">16:30
    <option value="17:00" selected="selected">17:00
    <option value="17:30" selected="selected">17:30
    <option value="18:00" selected="selected">18:00
    <option value="18:30" selected="selected">18:30
    <option value="19:00" selected="selected">19:00
    <option value="19:30" selected="selected">19:30
    <option value="20:00" selected="selected">20:00
    <option value="20:30" selected="selected">20:30
    <option value="21:00" selected="selected">21:00
    <option value="21:30" selected="selected">21:30
    <option value="22:00" selected="selected">22:00
    <option value="22:30" selected="selected">22:30
    <option value="23:00" selected="selected">23:00
    <option value="23:30" selected="selected">23:30



    groups->current_group->id, 'e2e_days' ); ?>

    <option value="3x THU-FRI-SAT" selected="selected">3x THU-FRI-SAT
    <option value="4x WED-THU-FRI-SAT" selected="selected">4x WED-THU-FRI-SAT
    <option value="4x THU-FRI-SAT-SUN" selected="selected">4x THU-FRI-SAT-SUN
    <option value="5x WED-THU-FRI-SAT-SUN" selected="selected">5x WED-THU-FRI-SAT-SUN
    <option value="5x THU-FRI-SAT-SUN-MON" selected="selected">5x THU-FRI-SAT-SUN-MON
    <option value="6x WED-THU-FRI-SAT-SUN-MON" selected="selected">6x WED-THU-FRI-SAT-SUN-MON
    <option value="6x THU-FRI-SAT-SUN-MON-TUE" selected="selected">6x THU-FRI-SAT-SUN-MON-TUE
    <option value="7x WED-THU-FRI-SAT-SUN-MON-TUE" selected="selected">7x WED-THU-FRI-SAT-SUN-MON-TUE



    Contact details


    groups->current_group->id, 'e2e_url' ); ?>

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

    groups->current_group->id, 'e2e_phone' ); ?>

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

    groups->current_group->id, 'e2e_email' ); ?>

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

    groups->current_group->id, 'e2e_facebook' ); ?>

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

    groups->current_group->id, 'e2e_myspace' ); ?>

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

    groups->current_group->id, 'e2e_twitter' ); ?>

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

    groups->current_group->id, 'e2e_skype' ); ?>

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

    <?php

    return;
    }

    function group_details_save( $group_id ) {
    global $bp, $wpdb;

    $plain_fields = array(
    'text',
    'country',
    'province',
    'city',
    'street',
    'type',
    'capacity',
    'opened',
    'closed',
    'days',
    'url',
    'phone',
    'email',
    'facebook',
    'myspace',
    'twitter',
    'skype'
    );


    foreach( $plain_fields as $field ) {
    $key = 'group-' . $field;
    if ( isset( $_POST[$key] ) ) {
    $value = $_POST[$key];
    groups_update_groupmeta( $group_id, 'e2e_' . $field, $value );
    }
    }


    }
    ?>

    modemlooper
    Moderator

    @modemlooper

    type=”checkbox”

    When I’m done with next version of BP mobile I’m creating a plugin that does what the profile fields does


    4ella
    Participant

    @4ella

    Thanks modemlooper , type=”checkbox” will not be enough I guess , adding the options works the same as for dropdown menu? I will study it farther , your little plugin works nice for me at the moment, I don’t need nothing else than the correct code to display those custom fields within the groups(groups-header.php) , if somebody can tell me the code for groups to display it for a public I would be very grateful :

    This is the code for the profile field “State” I use.



    State/Region:

    Custom fields for groups should work on similar basis I hope.


    4ella
    Participant

    @4ella


    php if ( $data = bp_get_profile_field_data( 'field=State' ) ) :

    State/Region: php echo $data

    php endif

    alfredojp
    Participant

    @alfredojp

    @4ella

    What did you do to the original code to make the entry save ?


    alfredojp
    Participant

    @alfredojp

    for me the only one that saves is URL


    modemlooper
    Moderator

    @modemlooper

    At the bottom you need to add a check to the array

    ` $plain_fields = array(
    ‘url’,
    ‘phone’,
    ‘text’,
    ‘check’,
    ‘price’
    );`

    Then create your checkbox input

    `
    groups->current_group->id, ‘e2e_check’ ); ?>
    <input type="checkbox" id="group-check" name="group-check" value="1" />
    `


    4ella
    Participant

    @4ella

    @alfredojp this code below is working for me well (the same as above but exact PHP code without WP-BP destroying PHP codes) and is saving all my fields:

    http://pastebin.com/X2tn22ys

    download here:
    http://pastebin.com/download.php?i=X2tn22ys

    We only need to find the way how to display those fields publicly in groups-header.php.

    @modemlooper – Thank you for your checkbox code I will check it out tomorrow and if working I will implement it into the code above. Checkboxes will help me a lot.


    alfredojp
    Participant

    @alfredojp

    couldn’t you use the same basic technique as you would for displaying information for members int he profile header?


    4ella
    Participant

    @4ella

    That’s what I want to know too , I hope that displaying group’s custom fields is a similar as the displaying profile’s custom fields code in the members-header.php. I will study it further.

    This thread as been very very helpful for me in creating custom group fields especially with my inadequate php experience. @4ella have you found the proper way to display the extra group information that has been stored in the groupmeta database? Ive been attempting retrieving that information to display in the group header but I had no luck. I tried looking up how to retrieve the data but I dont quite understand how bp uses commands like get_groups_description instead of using $fields and ‘field name’ or $row..


    4ella
    Participant

    @4ella

    @untilthen5 my PHP knowledge is adequate to zero , so I didn’t find any solution , I was studying @slaffik ‘s plugin to find something what should help us to display those fields , with my PHP knowledge I gave it up immediately.
    Slaffik’s Group Extras plugin is great , even greater now with adding unlimited group pages, it miss only function to memorize the sets of fields for all groups (you should create for every single group those sets of fields over and over again , @slaffik promised to finish it too).
    boone’s & modemlooper’s code is very quick and for me perfect solution because I don’t need the sets of fields. I need only 1 set of 10-15 extra fields on first Group creation step page which will better describe every group . Fields thanks Boone and Modemlooper we managed to get to insert into database, so group admins should see them now , fill them out , but without displaying those fields for public is now at least for me unfortunately useless .
    It looks like displaying those fields in groups doesn’t seem so simple as we were thinking (the way of displaying the fields in profiles as we know is very easy). @modemlooper said after he will finish his other works he has also intention to finish this small but very useful plugin – I suppose he meant with displaying all those fields in the template so I am going to wait when someone of them will come with fully working plugin.

    now i found what i’m looking for, hahaha im having the same problem, adding new field in the group creation form. thanks @4ella :D , so what’s the progress here?, i saw @slaffik plug ins, and it’s really cool and useful in someway but we also need to put those fields in the creation form not just in the edit group form… :(

Viewing 25 replies - 26 through 50 (of 57 total)
  • The topic ‘How to add fields to group creation with Group extension API (please read)’ is closed to new replies.
Skip to toolbar