1. NOTICE: If you are using Fabrik and update to Joomla 3.10, you will need to update to Fabrik 3.10. And, if you are using Fabrik, do not upgrade to Joomla 4, we do not have a supported version ready for release. More information on a release date coming soon. Also, please note that Fabrik 3.10 will not install on any Joomla sites less than 3.8.
    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