Buddypress Group Extension API -> Post from front end-> Trouble saving custom fields to database
-
Hey Guys,
I am using WordPress 3.3.2 and BuddyPress 1.5.5. I have created custom Group’s pages with the Buddypress Group Extension API and am allowing users to post from the front end on one of these pages and am having trouble saving custom field data when I do this. Everything else (title, content, and image saves to data base perfectly.) You can see example here: http://liveitupsocial.com/groups/san-fran-adventure/add-adventure/I am allowing user’s to essentially post activities that they think the group should participate in that weekend. I am querying these posts on another custom group page and I want these posts to be group specific. To do this I am sending a hidden field with value equal to the group ID when users add an activity to that group. Through displaying POST values I know the group ID is being sent and posted to my form validation, but not being saved as metadata.
I have placed the form validation in the group’s plugins.php, and the form in the display() in my custom Buddypress Group Extension API. Using that technique all fields save perfectly except for my post metadata which I’m sending as a hidden field (Group ID): Before the code is there a better way to do this?
In my Group Extension API my funciton display() holds the form: ( I will summarize and only show the hidden field not to bloat this post with code)
`funtion display(){
}
`Then I have form validation on the top of my Group’s plugin.php (Again summarized with the only part, the custom field, I’m having trouble with).
`
groups/single/plugins.php
<PHPif (isset ($_POST)) {
$group_id = $_POST;// Insert Custom Fields
add_post_meta($post_id, ‘group_id’, $group_id, true);do_action(‘wp_insert_post’, ‘wp_insert_post’);
PHP>
`Again,my title, content, image all save perfectly, the hidden field is posting just not saving to the database. Am I missing something? Is there a better way to structure the whole posting from the front end on custom group pages using the Group Extension API? Thanks in advance.
- The topic ‘Buddypress Group Extension API -> Post from front end-> Trouble saving custom fields to database’ is closed to new replies.