bp_gifts_newgift

The Buddypress Gifts Latest 2014 bp gifts newgift function.

Description

bp_gifts_newgift( (string) $giftname, $giftimage, (string) $category = 'gifts', (int) $point = 0 ); 

Parameters (4)

0. $giftname (string)
The giftname.
1. $giftimage
The giftimage.
2. $category — Optional. (string) => 'gifts'
The category.
3. $point — Optional. (int)
The point.

Usage

  1. if ( !function_exists( 'bp_gifts_newgift' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress-gifts-latest-2014/includes/bp-gifts-classes.php'; 
  3.  
  4. // The giftname. 
  5. $giftname = ''; 
  6.  
  7. // The giftimage. 
  8. $giftimage = null; 
  9.  
  10. // The category. 
  11. $category = 'gifts'; 
  12.  
  13. // The point. 
  14. $point = -1; 
  15.  
  16. // NOTICE! Understand what this does before running. 
  17. $result = bp_gifts_newgift($giftname, $giftimage, $category, $point); 
  18.  

Defined (1)

The function is defined in the following location(s).

/includes/bp-gifts-classes.php  
  1. function bp_gifts_newgift($giftname, $giftimage, $category = 'gifts', $point = 0) { 
  2.  
  3. global $bp, $wpdb; 
  4.  
  5. $insertgift = $wpdb->prepare("INSERT INTO {$bp->gifts->table_name} (gift_name, gift_image, category, point) VALUES (%s, %s, %s, %f)", $giftname, $giftimage, $category, $point); 
  6.  
  7. $newgift = $wpdb->query( $insertgift ); 
  8.  
  9. return $newgift; 
  10.  
  11.  
  12.  
  13. }