Posted on : 2023-10-02 20:51:00 View Type: public
Ali Jafri
I need a new section for Clients just like the users class - could you provide instructions or can I pay for some additional help
I need a new section for Clients just like the users class - could you provide instructions or can I pay for some additional help
function list_designers() {
global $db, $ACCOUNTS;
if ( $_SESSION['user_type'] != 'admin' ) {
return 'You do not have access to do this.';
}
$query = 'SELECT * from `users` WHERE `user_type`=? ORDER by `first_name` ASC';
$stmt = $db->prepare( $query );
$userType = 'Designer';
$stmt->bind_param( 's', $userType);
$stmt->execute();
$result = $stmt->get_result();
$content = '';
$count = 0;
while( $row = $result->fetch_assoc() ) {
extract($row);
$count++;
$class = ( $count%2 == 0 ) ? 'even' : 'odd';
$content .= '<tr class="'.$class.'">';
$content .= '<td>' . $first_name.' '.$last_name . '</td>';
$gender = ( ! empty( $gender ) ) ? ucfirst( $gender ) : '';
$content .= '<td>' . $gender . '</td>';
$location = ( ! empty( $zip_code ) ) ? $zip_code . ', ' . $country : $country;
$content .= '<td>' . $location . '</td>';
$content .= '<td>' . $email . '</td>';
$status = ( $status == 'suspend' ) ? 'Email Verified' : $status;
$content .= '<td>' . ucfirst($status) . '</td>';
$content .= '<td>';
if($this->get_user_meta($user_id, 'last_login_time') == '') {
$content .= _("Never");
} else {
$content .= time_elapsed_string($this->get_user_meta($user_id, 'last_login_time'));
}
$content .= '<br>';
$content .= $this->get_user_meta($user_id, 'last_login_ip');
$content .= '</td>';
//$content .= '<td>
//<i class="la la-dribbble"></i>
//<i class="la la-behance"></i>
//<i class="la la-facebook"></i>
//<i class="la la-twitter"></i>
//</td>';
$balance = $ACCOUNTS->get_designer_balance( $user_id );
$content .= '<td> $ ' . number_format( $balance, 2 ) . ' </td>';
$content .= '<td>';
$content .= '<button class="btn btn-default btn-sm pull-left" style="margin-right:5px;" data-toggle="modal" data-target="#modal_'.$user_id.'">'._("Message").'</button>';
$content .= '<!-- Modal -->
<script type="text/javascript">
$(function(){
$("#message_form_'.$user_id.'").on("submit", function(e){
e.preventDefault();
tinyMCE.triggerSave();
$.post("lib/includes/messageprocess.php",
$("#message_form_'.$user_id.'").serialize(),
function(data, status, xhr){
$("#success_message_'.$user_id.'").html("<div class=\'alert alert-success\'>"+data+"</div>");
});
});
});
</script><div class="modal fade" id="modal_'.$user_id.'" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"><div class="modal-dialog"><form id="message_form_'.$user_id.'" method="post" name="send_message"><div class="modal-content"><div class="modal-header"><h4 class="modal-title" id="myModalLabel">'._("Send Message").'</h4><button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button></div><div class="modal-body"><div id="success_message_'.$user_id.'"></div><div class="form-group"><label class="control-label">'._("To").'</label><input type="text" class="form-control" name="message_to" value="'._("Email").':('.$email.') '._("Username").': ('.$username.')" readonly="readonly" /></div><div class="form-group"><label class="control-label">'._("Subject").'</label><input type="text" class="form-control" name="subject" value="" /></div><div class="form-group"><label class="control-label">'._("Message").'</label><textarea class="tinyst form-control" name="message"></textarea></div></div><input type="hidden" name="from" value="'.$_SESSION['user_id'].'" /><input type="hidden" name="user_id" value="'.$user_id.'" /><input type="hidden" name="single_form" value="1" /><div class="modal-footer"><button type="button" class="btn btn-default" data-dismiss="modal">'._("Close").'</button><input type="submit" value="'._("Send Message").'" class="btn btn-primary" /></div></div><!-- /.modal-content --></form> </div><!-- /.modal-dialog --></div><!-- /.modal -->';
//$content .= '<a href="#" class="btn btn-primary btn-sm pull-left">Designer Board</a>';
$content .= '<form method="post" name="edit" action="manage_users.php">';
$content .= '<input type="hidden" name="edit_user" value="'.$user_id.'">';
$content .= '<input type="submit" style="margin-right:5px;" class="btn btn-default btn-sm pull-left" value="'._("Edit").'">';
$content .= '</form>';
$content .= '</td>';
$content .= '</tr>';
unset($class);
}
return $content;
}//list_levels ends here.
You can first create a function like this in users.php CLASS
but before doing that you have to add a new user level like in this example Designer
make required changes
then in main folder create a file with following code.
like designer.php in this example.
<div class="col-xl-12 col-md-12 col-sm-12">
<div class="widget widget-07 has-shadow">
<!-- Begin Widget Header -->
<div class="widget-header bordered d-flex align-items-center">
<h2><?php _e("Unread Messages"); ?></h2>
</div>
<!-- End Widget Header -->
<div class="widget-body">
<div class="table-responsive table-scroll padding-right-10" style="max-height: 520px; overflow: hidden; outline: none;" tabindex="2">
<table class="table table-hover mb-0">
<thead>
<tr>
<th>Order ID</th>
<th>Customer</th>
<th>Business Name</th>
<th>Package</th>
<th>Designer</th>
<th>Message By</th>
<th>View</th>
</tr>
</thead>
<tbody>
<?=$TICKET_MESSAGES->widget_for_messages();?>
</tbody>
</table>
</div>
</div>
</div><!-- widgte ends /-->
</div>
This type of code will list the users from Designer.
You can hire some PHP developer.
If you have custom work you can send to [email protected] to get quote we will see if there is any available developer we can take customization and provide you quote.
thanks.
Click one of our contacts below to chat on WhatsApp
Do you have any questions?
