1. Fabrik 3.9 has been released. If you have updated Joomla to 3.9, this is a required update.
    Dismiss Notice

Form Email Plugin Condition Failing

Discussion in 'Community' started by SoilentRed, Jun 16, 2021.

  1. SoilentRed

    SoilentRed Caaan do!

    Level: Community
    I'm trying to send an email to a "leader of leaders". So I'm building an array of the groups (id) he runs. Then I'm building an array of the submitter's groups and I'm seeing if there are any matches to return the desired true or false value.
    Code (Text):

    // Get Mark Groups and build array
    $dbMarkGroups = JFactory:: getDbo();
    $dbMarkGroups->setQuery('SELECT id FROM #__community_groups WHERE ownerid = 4453');
    $markGroups = $dbMarkGroups->loadObjectList();
    foreach ($markGroups as $markGroup => $mg) {
    $mgroups[] = $mg['id'];
    }
    // Get Agent Groups and build array
    $dbAgent = JFactory:: getDbo();
    $dbAgent->setQuery('SELECT groupid FROM #__community_groups_members WHERE memberid = {$my->id}');
    $agentGroups = $db->loadObjectList();
    foreach ($agentGroups as $agentGroup => $ag) {
    $agroups[] = $ag['groupid'];
    }
    //Compare arrays. If there's anything in the array, send the message.
    $comparison = array_intersect($mgroups, $agroups);
    if (!empty($comparison)) {
    return true;
    } else {
    return false;
    }
     
    Everything looks hunky-dory to me, but I'm getting this error:
    Code (Text):
    0 - Cannot use object of type stdClass as array
    Does anyone see where I'm messed up?
     
  2. troester

    troester Well-Known Member Staff Member

    Level: Community

Share This Page