View entity by title

I am studying the sql code elgg and am having trouble developing a query.

How can I retrieve an entity (file blog) by name

Ex
Select * from table where title_entity = "xxxxxxxxx"

Anyone have a clue

  • $dbprefix = elgg_get_config('dbprefix');

    $options = array(

        'type' => 'object',

        'sutype' => 'my_subtype',

        'joins' => array("JOIN {$dbprefix}objects_entity ue ON e.guid = ue.guid"),

        'wheres' => array("ue.title = '{$title}'")

    );

    $entities = elgg_get_entities($options);

     

    Of course title needs to be sanitised, and you need to be aware that titles aren't unique, so it's much better to use guids instead

  • Matt Beckett! Thank you, once again you saved me.

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