Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Group Invitation using email address. The registration fails when the Site Registration of new users is disabled #72

Closed
jeabakker opened this issue Nov 26, 2014 · 0 comments
Labels

Comments

@jeabakker
Copy link
Member

from the community https://community.elgg.org/plugins/736791/releases/2.10?offset=25

Testing 3.0 at Elgg 1.9.5. Feature: Group Invitation using email address. The registration fails when the Site Registration of new users is disabled.

After tracking the issue, I found that function "group_tools_check_group_email_invitation" returns False instead of True.

My workaround: move the "elgg_set_ignore_access" before the "elgg_get_annotations" (Line 38) at funtions.php file.

Thanks for your great plugin.

    function group_tools_check_group_email_invitation($invite_code, $group_guid = 0) {
        $result = false;

        if (!empty($invite_code)) {

            // note not using elgg_get_entities_from_annotations
            // due to performance issues with LIKE wildcard search
            // prefetch metastring ids for use in lighter joins instead
            $name_id = add_metastring('email_invitation');
            $code_id = add_metastring($invite_code);
            $sanitized_invite_code = sanitize_string($invite_code);
            $options = array(
                'limit' => 1,
                'wheres' => array(
                    "n_table.name_id = {$name_id} AND (n_table.value_id = {$code_id} OR v.string LIKE '{$sanitized_invite_code}|%')"
                )
            );

            if (!empty($group_guid)) {
                $options["annotation_owner_guids"] = array($group_guid);
            }


    $ia = elgg_set_ignore_access(true);       //EOC

            $annotations = elgg_get_annotations($options);

            if (!$annotations) {
                return $result;
            }

            // find hidden groups
    //EOC    $ia = elgg_set_ignore_access(true);

            $group = $annotations[0]->getEntity();

            if ($group) {
                $result = $group;
            }

            // restore access
            elgg_set_ignore_access($ia);
        }

        return $result;
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

1 participant