bp_blogs_update_blogmeta

Update a piece of blog meta.

Description

(bool|int) bp_blogs_update_blogmeta( (int) $blog_id, (string) $meta_key, (mixed) $meta_value, (string) $prev_value = '' ); 

Returns (bool|int)

Returns false on failure. On successful update of existing metadata, returns true. On successful creation of new metadata, returns the integer ID of the new metadata row.

Parameters (4)

0. $blog_id (int)
ID of the blog whose metadata is being updated.
1. $meta_key (string)
Key of the metadata being updated.
2. $meta_value (mixed)
Value to be set.
3. $prev_value — Optional. (string) => ''
If specified, only update existing metadata entries with the specified value. Otherwise, update all entries.

Usage

  1. if ( !function_exists( 'bp_blogs_update_blogmeta' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-blogs/bp-blogs-functions.php'; 
  3.  
  4. // ID of the blog whose metadata is being updated. 
  5. $blog_id = -1; 
  6.  
  7. // Key of the metadata being updated. 
  8. $meta_key = ''; 
  9.  
  10. // Value to be set. 
  11. $meta_value = null; 
  12. $prev_value = ''; 
  13.  
  14. // NOTICE! Understand what this does before running. 
  15. $result = bp_blogs_update_blogmeta($blog_id, $meta_key, $meta_value, $prev_value); 
  16.  

Defined (1)

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

/bp-blogs/bp-blogs-functions.php  
  1. function bp_blogs_update_blogmeta( $blog_id, $meta_key, $meta_value, $prev_value = '' ) { 
  2. $retval = update_metadata( 'blog', $blog_id, $meta_key, $meta_value, $prev_value ); 
  3.  
  4. return $retval;