• HomePagina Inicial
  • Blog Mis cosillas
  • Portfolio Mis trabajos
  • Acerca deeste blog y su autor
    • Sobre Mi 
    • Oridoki 
  • ContactarFormulario
  • Categorias

    • Blog
      • Control de Versiones
        • GIT
      • Diseño
      • Frameworks
        • CakePHP
        • CodeIgniter
      • JavaScript
        • EXT JS
        • JQuery
      • Magento
      • Maquetación
        • CSS
        • HTML
      • MiniCodes
      • MySQL
      • PHP
      • Proyectos
      • TextMate
      • Varios
      • Wordpress
    • Portfolio

Buddypress – Automatizar creacion de grupos

Posted by Adrià Cidre Categories: Blog, MiniCodes, PHP, Wordpress

Con esta función podemos crear desde PHP nuestros grupos en PHP.

function create_a_group() {

  $new_group = new custom_group;

      $new_group->creator_id = 1;
      $new_group->name = ‘test’;
      $new_group->slug = ‘test’;
      $new_group->description = ‘nothing’;
      $new_group->news = ‘whatever’;
      $new_group->status = ‘public’;
      $new_group->is_invitation_only = 1;
      $new_group->enable_wire = 1;
      $new_group->enable_forum = 1;
      $new_group->enable_photos = 1;
      $new_group->photos_admin_only = 1;
      $new_group->date_created = current_time(‘mysql’);
      $new_group->total_member_count = 1;
      $new_group->avatar_thumb = ’some kind of path’;
      $new_group->avatar_full = ’some kind of path’;

  $new_group -> save();

  groups_update_groupmeta( $id, ‘total_member_count’, 1 );
  groups_update_groupmeta( $id, ‘last_activity’, time() );
  groups_update_groupmeta( $id, ‘theme’, ‘buddypress’ );
  groups_update_groupmeta( $id, ’stylesheet’, ‘buddypress’ );

}

Share This Post!

Subscribe to our RSS feed. Tweet this! StumbleUpon Reddit Digg This! Bookmark on Delicious Share on Facebook

Deja un comentario Cancelar respuesta

Tu dirección de correo electrónico no será publicada. Los campos necesarios están marcados *

*

*

Puedes usar las siguientes etiquetas y atributos HTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Search our website

  • Inicio
  • Blog
  • Consultor Web
  • Contactar
  • E-Commerce
  • Oridoki
  • Outsourcing
  • Portfolio
  • Sobre Mi
  • Social Media
© Adrià  Cidre Jugo - 2011