Can't browse user or change user image profile
Hello Tony,
Thanks for this release. You are making me love programming.
I have this issue while browsing user on admin panel. And also when i try to change user image profil :
" htmlspecialchars() expects parameter 1 to be string, array given (View: C:\wamp641\www\wave\resources\views\vendor\voyager\users\browse.blade.php)
"
Thanks for your support.
https://drive.google.com/open?id=1V_NxOYLBZ6ozxIkxjXU6rrePAa_b6cPR
I wanted to share a screenshot. I guest i had it the wrong way. Please tell me if there is a better way to contribute
Thanks ismael-joseph,
This is making me love programming as well :) Thanks for the screenshot as well. Hope you're enjoying Wave so far.
Have you migrated any code or made any modifications to Wave since you are getting this error?
Let me know and we'll get to the bottom of it. We may even need to do a screenshare and I can help you debug this issue.
Thanks!
Talk to you soon.
Helo Tony,
I have found what make the issue,
On a fresh wave install if you go to {rootpath}//admin/users/1/edit and click save The save buton will inject {"locale":"en"} in users table on the database this will prevent you from access {rootpath}//admin/users and give you the error
to access {rootpath}//admin/users again you need to delete {"locale":"en"} in users table ( settings colum).
You need to check the save buton.
My knowledge don't allow me to go further.
Hope that help.
Hi ismael-joseph,
Yeah, that's really strange. I think there may have been an issue with a version of Voyager. Have you done a composer update
by chance? If not, can you do a composer update
and let me know if that changes anything.
Additionally, can you make sure that you have this file located here: resources/views/vendor/voyager/users/edit-add.blade.php
with the following contents:
@extends('voyager::master')
@section('page_title', __('voyager::generic.'.(isset($dataTypeContent->id) ? 'edit' : 'add')).' '.$dataType->display_name_singular)
@section('css')
<meta name="csrf-token" content="{{ csrf_token() }}">
@stop
@section('page_header')
<h1 class="page-title">
<i class="{{ $dataType->icon }}"></i>
{{ __('voyager::generic.'.(isset($dataTypeContent->id) ? 'edit' : 'add')).' '.$dataType->display_name_singular }}
</h1>
@stop
@section('content')
<div class="page-content container-fluid">
<form class="form-edit-add" role="form"
action="{{ (isset($dataTypeContent->id)) ? route('voyager.'.$dataType->slug.'.update', $dataTypeContent->id) : route('voyager.'.$dataType->slug.'.store') }}"
method="POST" enctype="multipart/form-data" autocomplete="off">
<!-- PUT Method if we are editing -->
@if(isset($dataTypeContent->id))
{{ method_field("PUT") }}
@endif
{{ csrf_field() }}
<div class="row">
<div class="col-md-8">
<div class="panel panel-bordered">
{{-- <div class="panel"> --}}
@if (count($errors) > 0)
<div class="alert alert-danger">
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
<div class="panel-body">
<div class="form-group">
<label for="name">{{ __('voyager::generic.name') }}</label>
<input type="text" class="form-control" id="name" name="name" placeholder="{{ __('voyager::generic.name') }}"
value="@if(isset($dataTypeContent->name)){{ $dataTypeContent->name }}@endif">
</div>
<div class="form-group">
<label for="email">{{ __('voyager::generic.email') }}</label>
<input type="email" class="form-control" id="email" name="email" placeholder="{{ __('voyager::generic.email') }}"
value="@if(isset($dataTypeContent->email)){{ $dataTypeContent->email }}@endif">
</div>
<div class="form-group">
<label for="username">Username</label>
<input type="username" class="form-control" id="username" name="username" placeholder="Username"
value="@if(isset($dataTypeContent->username)){{ $dataTypeContent->username }}@endif">
</div>
<div class="form-group">
<label for="password">{{ __('voyager::generic.password') }}</label>
@if(isset($dataTypeContent->password))
<br>
<small>{{ __('voyager::profile.password_hint') }}</small>
@endif
<input type="password" class="form-control" id="password" name="password" value="" autocomplete="new-password">
</div>
@can('editRoles', $dataTypeContent)
@php
$dataTypeRows = $dataType->{(isset($dataTypeContent->id) ? 'editRows' : 'addRows' )};
$row = $dataTypeRows->where('field', 'user_belongsto_role_relationship')->first();
$options = json_decode($row->details);
@endphp
<div class="form-group">
<label for="role_id">Primary Role</label>
@php $roles = TCG\Voyager\Models\Role::all(); @endphp
<select name="role_id" id="role_id" class="select2" placeholder="">
@foreach($roles as $role)
<option value="{{ $role->id }}">{{ $role->name }}</option>
@endforeach
</select>
</div>
<div class="form-group">
<label for="additional_roles">{{ __('voyager::profile.roles_additional') }}</label>
@php
$row = $dataTypeRows->where('field', 'user_belongstomany_role_relationship')->first();
$options = json_decode($row->details);
@endphp
@include('voyager::formfields.relationship')
</div>
@endcan
</div>
</div>
</div>
<div class="col-md-4">
<div class="panel panel panel-bordered panel-warning">
<div class="panel-body">
<div class="form-group">
@if(isset($dataTypeContent->avatar))
<img src="{{ filter_var($dataTypeContent->avatar, FILTER_VALIDATE_URL) ? $dataTypeContent->avatar : Voyager::image( $dataTypeContent->avatar ) }}" style="width:200px; height:auto; clear:both; display:block; padding:2px; border:1px solid #ddd; margin-bottom:10px;" />
@endif
<input type="file" data-name="avatar" name="avatar">
</div>
</div>
</div>
</div>
</div>
<button type="submit" class="btn btn-primary pull-right save">
{{ __('voyager::generic.save') }}
</button>
</form>
<iframe id="form_target" name="form_target" style="display:none"></iframe>
<form id="my_form" action="{{ route('voyager.upload') }}" target="form_target" method="post" enctype="multipart/form-data" style="width:0px;height:0;overflow:hidden">
{{ csrf_field() }}
<input name="image" id="upload_file" type="file" onchange="$('#my_form').submit();this.value='';">
<input type="hidden" name="type_slug" id="type_slug" value="{{ $dataType->slug }}">
</form>
</div>
@stop
@section('javascript')
<script>
$('document').ready(function () {
$('.toggleswitch').bootstrapToggle();
});
</script>
@stop
If not, could you add that file and try adding a new user again.
Let me know if any of those solutions seem to help and we'll get to the bottom of this :)
Thanks again.
Thank you Tony, I did not have to do a composer update. The file solve the problem. Thank you.
Ok, great.
You may experience an issue with the latest version of voyager when you do a composer update. I might recommend downloading the latest version and replacing the following 2 files:
/resources/veiws/vendor/voyager/users/browse.blade.php
/resources/veiws/vendor/voyager/users/edit-add.blade.php
We have also updated the tcg/voyager
package to version 1.1.10
, so you may want to update that in your composer.json file, do a composer update
and everything should be working fine.
but if you do experience any other issues please feel free to let me know.
Thanks again!
OK, please give me the content of browse.blade.php