This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'buddyforms_process_submission_end', 'my_buddyforms_process_submission_end', 10, 1 ); | |
function my_buddyforms_process_submission_end($args){ | |
if( ! isset( $args['user_id'] ) ){ | |
return; | |
} | |
$user_id = $args['user_id']; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'buddyforms_wp_insert_user_activation_mail', 'my_buddyforms_wp_insert_user_activation_mail', $sent, $user_id ); | |
function my_buddyforms_wp_insert_user_activation_mail(){ | |
// | |
// use the $user_id to perform any custom action | |
// | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Add a new div to the listing insite the "li" | |
add_action('buddyforms_the_loop_li_last', 'my_buddyforms_the_loop_li_last', 10, 2); | |
function my_buddyforms_the_loop_li_last($post_id, $form_slug){ | |
// Check if this is the correct form. | |
// Change "FORM_SLUG" to your form | |
if($form_slug != 'posts'){ | |
return; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Hook into the the-loop.php template and add an new table head | |
add_action('buddyforms_the_thead_tr_inner_last', 'my_buddyforms_the_thead_tr_inner_last', 10, 2); | |
function my_buddyforms_the_thead_tr_inner_last($post_id, $form_slug){ | |
// Check if this is the correct form. | |
// Change "FORM_SLUG" to your form | |
if($form_slug != 'FORM_SLUG'){ | |
return; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Hook Post Meta ( Custom Fields ) under the title of the listing | |
add_action('buddyforms_the_loop_item_title_after', 'my_buddyforms_the_loop_item_last', 10, 1); | |
// Hook Post Meta ( Custom Fields ) under the excerpt of the listing | |
// This hook only exists in the the-loop.php template | |
add_action('buddyforms_the_loop_item_excerpt_after', 'my_buddyforms_the_loop_item_last', 10, 1); | |
// Example function for the title and the excerpt after hooks |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$field_wp_type = isset( $customfield['field_wp_type'] ) ? $customfield['field_wp_type'] : false; | |
$form_fields['general']['field_wp_type'] = new Element_Select( '<b>' . __( 'Save field as ', 'buddyforms' ) . '</b>', "buddyforms_options[form_fields][" . $field_id . "][field_wp_type]", | |
array( | |
'user_meta' => 'User Meta', | |
'post_meta' => 'Post Meta Custom Field', | |
'user_meta' => 'User Meta', | |
), array( | |
'value' => $field_wp_type, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'pre_get_posts', 'jim_filter_cpt_listing_by_author' ); | |
function buddyforms_filter_cpt_listing_by_author( $wp_query_obj ) { | |
// First let us check if this is a page. We not want to restrict pages | |
if( !isset( $wp_query_obj->query ) || isset( $wp_query_obj->query['page'] ) || 'page' == $wp_query_obj->query['post_type'] ){ | |
return $wp_query_obj; | |
} | |
// Check if the user is logged in and display a page to logged off users |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Register the new Shortcode | |
add_shortcode( 'my_bf_gallery_shortcode' , 'my_custom_gallery_shortcode' ); | |
// ShortCode function: | |
function my_custom_gallery_shortcode($attr){ | |
global $post, $buddyforms; | |
extract(shortcode_atts(array( | |
'form_element_slug' => '', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* In this example we generally allow all to create and edit posts. This would be really dangerous and only should be used in closed intranets. | |
* In most situation you will use the filter to only fire in some situations. Please see the Groups Extension for a more complex example | |
* Link to the Groups Extension Example: https://github.com/BuddyForms/BuddyForms-Attach-Post-with-Group/blob/7d7d1b9c475cdfb076ef34963aeb94952a2e9545/includes/group-extension.php#L47 | |
*/ | |
add_filter( 'buddyforms_user_can_edit', 'buddyforms_user_can_edit' , 10, 3 ); | |
function buddyforms_user_can_edit( $found ) { | |
return true; |