示例#1
0
/**
 * Disables a user upon registration.
 *
 * @param string $hook
 * @param string $type
 * @param bool   $value
 * @param array  $params
 * @return bool
 */
function uservalidationbyemail_disable_new_user($hook, $type, $value, $params)
{
    $user = elgg_extract('user', $params);
    // no clue what's going on, so don't react.
    if (!$user instanceof ElggUser) {
        return;
    }
    // another plugin is requesting that registration be terminated
    // no need for uservalidationbyemail
    if (!$value) {
        return $value;
    }
    // has the user already been validated?
    if (elgg_get_user_validation_status($user->guid) == true) {
        return $value;
    }
    // disable user to prevent showing up on the site
    // set context so our canEdit() override works
    elgg_push_context('uservalidationbyemail_new_user');
    $hidden_entities = access_get_show_hidden_status();
    access_show_hidden_entities(TRUE);
    // Don't do a recursive disable.  Any entities owned by the user at this point
    // are products of plugins that hook into create user and might need
    // access to the entities.
    // @todo That ^ sounds like a specific case...would be nice to track it down...
    $user->disable('uservalidationbyemail_new_user', FALSE);
    // set user as unvalidated and send out validation email
    elgg_set_user_validation_status($user->guid, FALSE);
    uservalidationbyemail_request_validation($user->guid);
    elgg_pop_context();
    access_show_hidden_entities($hidden_entities);
    return $value;
}
示例#2
0
$user_guids = get_input('user_guids');
$error = FALSE;
if (!$user_guids) {
    register_error(elgg_echo('uservalidationbyemail:errors:unknown_users'));
    forward(REFERRER);
}
$access = access_get_show_hidden_status();
access_show_hidden_entities(TRUE);
foreach ($user_guids as $guid) {
    $user = get_entity($guid);
    if (!$user instanceof ElggUser) {
        $error = TRUE;
        continue;
    }
    // don't resend emails to validated users
    $is_validated = elgg_get_user_validation_status($guid);
    if ($is_validated !== FALSE || !uservalidationbyemail_request_validation($guid)) {
        $error = TRUE;
        continue;
    }
}
access_show_hidden_entities($access);
if (count($user_guids) == 1) {
    $message_txt = elgg_echo('uservalidationbyemail:messages:resent_validation');
    $error_txt = elgg_echo('uservalidationbyemail:errors:could_not_resend_validation');
} else {
    $message_txt = elgg_echo('uservalidationbyemail:messages:resent_validations');
    $error_txt = elgg_echo('uservalidationbyemail:errors:could_not_resend_validations');
}
if ($error) {
    register_error($error_txt);
示例#3
0
$guids = get_input('user_guids');
if ($guids) {
    $count = count($guids);
    $error_nouser = $error_canedit = $error = $success = $validated = 0;
    foreach ($guids as $guid) {
        $user = get_entity($guid);
        if (!elgg_instanceof($user, 'user')) {
            $error_nouser++;
            continue;
        }
        if (!$user->canEdit()) {
            $error_canedit++;
            continue;
        }
        if (elgg_get_user_validation_status($user->guid)) {
            $validated++;
        } else {
            if (elgg_set_user_validation_status($user->guid, true, 'manual')) {
                create_annotation($user->guid, 'validate', true, '', elgg_get_logged_in_user_guid(), ACCESS_PUBLIC);
                $success++;
            } else {
                $error++;
            }
        }
    }
    $msg[] = elgg_echo('db_explorer:success:validate', array((int) $success, $count));
    if ($validated > 0) {
        $msg[] = elgg_echo('db_explorer:error:already_validated', array($validated));
    }
    if ($error_nouser > 0) {
示例#4
0
文件: content.php 项目: smellems/wet4
 /*
  * echo '<div class="panel panel-custom elgg-module-aside"><div class="panel-heading"><h2 class="">'.elgg_echo('ps:profilestrength').'</h2></div><div class="panel-body clearfix">'.elgg_view('widgets/profile_completness/content').'</div></div>';
  * 
  * */
 if (intval($result->num_rows) > 0) {
     $count = 0;
     $htmloutput = '<div class="panel clearfix panel-custom elgg-module-aside">';
     $htmloutput = $htmloutput . '<div class="panel-heading">';
     $htmloutput = $htmloutput . '<h3 class="panel-title">' . elgg_echo('sf:suggcolleagues') . '</h3>';
     $htmloutput = $htmloutput . '</div><div class="panel-body clearfix">';
     while ($row = $result->fetch_assoc()) {
         if ($count == 0 || $count == 2) {
             $htmloutput = $htmloutput . '<div class="row mrgn-tp-sm">';
         }
         $userGUID = $row['guid_two'];
         if (elgg_get_user_validation_status($userGUID)) {
             $job = get_user($userGUID)->job;
             $htmloutput = $htmloutput . '<div class="col-xs-6 text-center">';
             $htmloutput .= '<a href="' . $site_url . 'profile/' . get_user($row['guid_two'])->username . '" class="">';
             $htmloutput = $htmloutput . '<img src="' . get_user($row['guid_two'])->getIcon('small') . '" class="avatar-profile-page img-responsive center-block img-circle " alt="' . elgg_echo('sf:alttext') . ' ' . get_user($row['guid_two'])->getDisplayName() . '">';
             $htmloutput = $htmloutput . '<h4 class="h4 mrgn-tp-sm mrgn-bttm-0"><span class="text-primary">' . get_user($row['guid_two'])->getDisplayName() . '</span></h4></a>';
             $htmloutput = $htmloutput . '<p class="small mrgn-tp-0">' . $job . '</p>';
             $htmloutput = $htmloutput . '<a href="' . elgg_add_action_tokens_to_url("action/friends/add?friend={$userGUID}") . '" class="btn btn-primary btn-sm mrgn-tp-sm">' . elgg_echo('friend:add') . '</a>';
             $htmloutput = $htmloutput . '</div>';
             if ($count == 1 || $count == 3) {
                 $htmloutput = $htmloutput . '</div>';
             }
             $count++;
             // $htmloutput=$htmloutput. $row['guid_two'].'-';
         }
     }
示例#5
0
$q = sanitise_string($q);
$form_body = elgg_view("input/text", array("name" => "q", "title" => elgg_echo("search"), "value" => $q));
echo elgg_view("input/form", array("body" => $form_body, "class" => "widget-user-search-form"));
$result = array();
if (!empty($q)) {
    $dbprefix = elgg_get_config("dbprefix");
    $hidden = access_get_show_hidden_status();
    access_show_hidden_entities(true);
    $options = array("type" => "user", "relationship" => "member_of_site", "relationship_guid" => elgg_get_site_entity()->getGUID(), "inverse_relationship" => true, "joins" => array("JOIN " . $dbprefix . "users_entity ue ON e.guid = ue.guid"), "wheres" => array("((ue.username LIKE '%" . $q . "%') OR (ue.email LIKE '%" . $q . "%') OR (ue.name LIKE '%" . $q . "%'))"));
    if ($entities = elgg_get_entities_from_relationship($options)) {
        foreach ($entities as $entity) {
            $entity_data = array();
            $entity_data[] = elgg_view("output/url", array("text" => $entity->name, "href" => $entity->getURL()));
            $entity_data[] = $entity->username;
            $entity_data[] = $entity->email;
            if (elgg_get_user_validation_status($entity->getGUID()) !== false) {
                $entity_data[] = elgg_echo("option:yes");
            } else {
                $entity_data[] = elgg_echo("option:no");
            }
            $entity_data[] = elgg_echo("option:" . $entity->enabled);
            $entity_data[] = htmlspecialchars(date(elgg_echo('friendlytime:date_format'), $entity->time_created));
            $result[] = "<td>" . implode("</td><td>", $entity_data) . "</td>";
        }
    }
    access_show_hidden_entities($hidden);
}
if (empty($result)) {
    echo elgg_echo("notfound");
} else {
    echo "<table class='elgg-table mtm'><tr>";
示例#6
0
<?php

/**
 * Elgg welcome plugin change user email action
 *
 * @author Gerard Kanters
 * @author Wouter van Os
 * @author Juho Jaakkola
 *
 * @website https://www.centillien.com
 *
 * @copyright Centillien 2016
 */
if (elgg_get_user_validation_status($user->guid) == false) {
    register_error(elgg_echo('notallowed'));
    return;
}
action_gatekeeper('change_user_email');
// Set access status to perform needed operation
$access_status = access_get_show_hidden_status();
access_show_hidden_entities(true);
// Get user guid
$user_guid = (int) get_input('user_guid');
$new_email = get_input('new_email');
// Check if user guid is provided
if (!empty($user_guid) && !empty($new_email)) {
    $user = get_entity($user_guid);
    // Check if user exists
    if (elgg_instanceof($user, 'user')) {
        // Check if provided email address is valid
        if (validate_email_address($new_email)) {