Jūs esateŽurnalai / Ernestas Kardzys's blog / ELGG. How to get group by its group name?

ELGG. How to get group by its group name?


ParašėErnestas Kardzys - 2010 Liepos 08

ELGG has method get_user_by_username(), which returns the object ElggUser. Unfortunately, there is no method called get_group_by_groupname(). So, I made one :) /** * Returns a group specified by its name * @param string $groupname The name of the group * @return mixed ElggGroup - if ElggGroup exists, false - otherwise */ function get_group_by_groupname($groupname) { global $CONFIG; $groupname = sanitise_string($groupname); $access = get_access_sql_suffix('e'); $row = get_data_row("SELECT e.* from {$CONFIG->dbprefix}groups_entity g join {$CONFIG->dbprefix}entities e on e.guid=g.guid where g.name='$groupname' and $access "); if ($row) { return new ElggGroup($row); } return false; } Good luck ;)

Skelbti naują komentarą

Šio laukelio turinys bus laikomas privatus ir nerodomas viešai.
  • Web puslapiu adresai ir el. pašto adresai automatiškai tampa nuorodomis.
  • Leidžiamos HTML žymės: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Linijos ir paragrafai atskiriami automatiškai
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <c>, <cpp>, <drupal5>, <drupal6>, <java>, <javascript>, <php>, <python>, <ruby>. The supported tag styles are: <foo>, [foo].

Daugiau informacijos apie teksto formatavimą

CAPTCHA
Šis klausimas yra skirtas įsitikinti, jog jūs esate žmogus, ir sustabdyti automatinį šlamšto siuntimą.