[buddypress-trac] [BuddyPress Trac] #7837: Group Detail Pages Not Showing w/ Custom Meta Plug-Ins in Version 3.0.0
buddypress-trac
noreply at wordpress.org
Fri May 18 19:39:01 UTC 2018
#7837: Group Detail Pages Not Showing w/ Custom Meta Plug-Ins in Version 3.0.0
--------------------------+------------------------
Reporter: gcmaryland | Owner: r-a-y
Type: defect (bug) | Status: reviewing
Priority: normal | Milestone: 3.0.1
Component: Templates | Version: 3.0.0
Severity: normal | Resolution:
Keywords: |
--------------------------+------------------------
Changes (by r-a-y):
* owner: (none) => r-a-y
* status: new => reviewing
* version: => 3.0.0
* component: Groups => Templates
* milestone: Awaiting Review => 3.0.1
Comment:
Duplicated the problem with bp-nouveau. bp-legacy works fine.
Here's my test code:
{{{#!php
<?php
// Add a custom field to the group creation process and on a group's
"Manage > Details" page.
add_action( 'groups_custom_group_fields_editable', function() {
if ( bp_get_current_group_id() ) {
$todo = groups_get_groupmeta( bp_get_current_group_id(),
'my_group_todo' );
} else {
$todo = '';
}
$todo = esc_textarea( $todo );
$markup = <<<EOD
<div>
<label for="group-todo">Group Todo</label>
<textarea name="group-todo" id="group-todo" aria-
required="true" placeholder="Write whatever you need to do
here.">{$todo}</textarea>
<p></p>
</div>
EOD;
echo $markup;
} );
// Save our custom group meta entry when it is updated.
function my_groupmeta_save() {
if ( ! isset( $_POST['group-todo'] ) ) {
return;
}
// Handles fetching the group ID during the group creation phase.
if ( 'groups_create_group_step_save_group-details' ===
current_action() ) {
$group_id = isset( buddypress()->groups->new_group_id ) ?
buddypress()->groups->new_group_id : 0;
} else {
$group_id = bp_get_current_group_id();
}
if ( $group_id ) {
groups_update_groupmeta( $group_id, 'my_group_todo',
$_POST['group-todo'] );
}
}
add_action( 'groups_create_group_step_save_group-details',
'my_groupmeta_save' );
add_action( 'groups_group_details_edited', 'my_groupmeta_save' );
}}}
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/7837#comment:2>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac
More information about the buddypress-trac
mailing list