How to retrieve the contents of modules in a group

Hello
I created a plugin that allows you to create and access remote databases from groups of my Elggsite.
But I have a worry because I do not know how to find all the databases in the same group. The pathis displayed in the activity of my group but I do not know how to go to retrieve the name of the database.
Someone should track it?
Thank you in advance

  • Your question does not make much sense. Can you rephrase?

    Will adding metadata to your group entities work?

  • It'not easy to explain!!!
    When i am in a group, i can create databases with my plugin called couchdbs.
    When i am in the group i can see plugins activated like blog, bookmarks,..., and my plugin couchdbs.

    Under my group i can see every databases created in my group like i see all activity of group under group activity or when i go to myserver/myplugin/group/mygroupid/all i see all groups databases but i don't knowhow i can do get the name of all of these databases to permit databases access to group's users.

    source of my all.php

    <?php
    elgg_pop_breadcrumb();
    elgg_push_breadcrumb(elgg_echo('couchdbs'));
    $offset = (int)get_input('offset', 0);
    $content = elgg_list_entities(array(

    'type' => 'object',
    'subtype' => 'couchdbs',
    'limit' => 10,
    'offset' => $offset,
    'full_view' => false,
    'view_toggle_type' => false

    ));

    $title = elgg_echo('couchdbs:everyone');
    $body = elgg_view_layout('content', array(

    'filter_context' => 'all',
    'content' => $content,
    'title' => $title,
    'sidebar' => elgg_view('couchdbs/sidebar'),

    ));

    echo elgg_view_page($title, $body);

    ?>

  • If you replace elgg_list_entities() with elgg_get_entities() you will have an array of all couchdbs objects. You can then iterate through them and get attributes and metadata, e.g.

    foreach ($dbs as $db) {

    echo $db->title; // assuming the name of the database is stored as 'title'

    echo $db->my_custom_meta;

    }

  • i was wrong this next is the source where i can seee the couchdbs of my group

     

    <?php 
    $group = $vars['entity'];
    $icon = elgg_view_entity_icon($group, 'tiny');
    $metadata = elgg_view_menu('entity', array(
    'entity' => $group,
    'handler' => 'groups',
    'sort_by' => 'priority',
    'class' => 'elgg-menu-hz',
    ));

    if (elgg_in_context('owner_block') || elgg_in_context('widgets')) {
    $metadata = '';
    }

    if ($vars['full_view']) {
    echo elgg_view("groups/profile/profile_block", $vars);

    } else {// brief view
    $params = array(
    'entity' => $group,'metadata' => $metadata,
    'subtitle' => $group->briefdescription,
    );

    $params = $params + $vars;
    $list_body = elgg_view('group/elements/summary', $params);
    echo elgg_view_image_block($icon, $list_body, $vars);

    }

     

  • yes it's ok with the for each you have given me thanks

Beginning Developers

Beginning Developers

This space is for newcomers, who wish to build a new plugin or to customize an existing one to their liking