Exemple #1
0
 public function profile($instance = array())
 {
     /** check access **/
     if (!wpl_users::check_access('profilewizard')) {
         /** import message tpl **/
         $this->message = __("You don't have access to this part!", WPL_TEXTDOMAIN);
         return parent::render($this->tpl_path, 'message');
     }
     _wpl_import('libraries.flex');
     $this->tpl = 'profile';
     $this->kind = wpl_flex::get_kind_id('user');
     $this->user_id = wpl_users::get_cur_user_id();
     if (wpl_users::is_administrator($this->user_id) and wpl_request::getVar('id', 0)) {
         $this->user_id = wpl_request::getVar('id');
     }
     $this->user_fields = wpl_flex::get_fields('', 1, $this->kind, 'pwizard', 1);
     $this->user_data = (array) wpl_users::get_wpl_data($this->user_id);
     /** import tpl **/
     parent::render($this->tpl_path, $this->tpl);
 }
Exemple #2
0
 /**
  * Check Access for a specific user
  * @author Howard R <*****@*****.**>
  * @static
  * @param string $access
  * @param int $owner_id
  * @param int $user_id
  * @return boolean
  */
 public static function check_access($access, $owner_id = 0, $user_id = '')
 {
     /** get current user id **/
     if (trim($user_id) == '') {
         $user_id = wpl_users::get_cur_user_id();
     }
     $user_data = wpl_users::get_wpl_data($user_id);
     /** user is registered in WordPress but not in WPL so we choose guest user for accesses **/
     if (!$user_data) {
         $user_data = wpl_users::get_wpl_data(0);
     }
     if ($access == 'edit') {
         if ($owner_id == $user_id or wpl_users::is_administrator($user_id)) {
             return true;
         }
     } elseif ($access == 'add') {
         $num_prop_limit = $user_data->maccess_num_prop;
         $num_prop = wpl_users::get_users_properties_count($user_id);
         if ($num_prop_limit == '-1') {
             return true;
         }
         # unlimited
         if ($num_prop_limit <= $num_prop and !wpl_users::is_administrator($user_id)) {
             return false;
         } else {
             return true;
         }
     } elseif ($access == 'delete') {
         if ($user_data->access_delete and ($owner_id == $user_id or wpl_users::is_administrator($user_id))) {
             return true;
         }
     } elseif ($access == 'confirm') {
         if ($user_data->access_confirm and ($owner_id == $user_id or wpl_users::is_administrator($user_id))) {
             return true;
         }
     } else {
         return isset($user_data->{'access_' . $access}) ? $user_data->{'access_' . $access} : 0;
     }
     return false;
 }
Exemple #3
0
?>
</th>
                    <th scope="col" class="manage-column"><?php 
echo wpl_global::order_table(__('Date Registered', WPL_TEXTDOMAIN), 'u.user_registered');
?>
</th>
                    <th scope="col" class="manage-column"><?php 
echo __('Actions', WPL_TEXTDOMAIN);
?>
</th>
                </tr>
            </tfoot>
            <tbody>
                <?php 
foreach ($this->wp_users as $wp_user) {
    $wpl_data = wpl_users::get_wpl_data($wp_user->ID);
    ?>
                <tr id="item_row<?php 
    echo $wp_user->ID;
    ?>
">
                    <td class="size-1"><?php 
    echo $wp_user->ID;
    ?>
</td>
                    <td>
                        <?php 
    if ($wp_user->id) {
        ?>
                        <a href="<?php 
        echo wpl_global::add_qs_var('id', $wp_user->ID, wpl_global::get_wpl_admin_menu('wpl_admin_profile'));