Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jul 07 2021 13:24
    dereuromark commented #46
  • Nov 09 2020 14:36
    jeffersonsimaogoncalves synchronize #46
  • Nov 09 2020 14:23
    jeffersonsimaogoncalves synchronize #46
  • Nov 09 2020 03:22
    jeffersonsimaogoncalves opened #46
  • Jul 05 2020 17:18
    Casmo commented #40
  • Jun 22 2020 14:04

    bobmulder on master

    Use 'fields' from CreatedBy or … (compare)

  • Jun 22 2020 14:04
    bobmulder closed #44
  • Jun 22 2020 12:59

    martonmiklos on master

    Fix null pointer exception in W… (compare)

  • Jun 22 2020 12:59
    martonmiklos closed #45
  • Jun 22 2020 09:18
    coveralls commented #44
  • Jun 22 2020 09:16
    bancer synchronize #44
  • Jun 22 2020 09:13
    coveralls commented #45
  • Jun 22 2020 09:11
    bancer opened #45
  • Jan 28 2020 15:32
    bobmulder commented #44
  • Jan 28 2020 10:14
    coveralls commented #44
  • Jan 28 2020 10:12
    bancer opened #44
  • Sep 19 2019 14:33
    martonmiklos closed #38
  • Sep 19 2019 14:33
    martonmiklos commented #38
  • Sep 19 2019 14:25
    martonmiklos closed #42
  • Sep 19 2019 14:25
    martonmiklos commented #42
tuankiet2605
@tuankiet2605
I'm not know using this plugin
Please, help me via gmail: tuankiet2605@gmail.com
or skype: tuankiet2605
Thank you very much
Bob Mulder
@bobmulder
@tuankiet2605 hi, This chat is used to get he
Help or report problems. Please drop your issue here or chat me privately.
tuankiet2605
@tuankiet2605
Hello
Are you there?
Bob Mulder
@bobmulder
I am
MatthiasBusch
@MatthiasBusch
Hi guys
I am having trouble with the form forcing me to reupload my file everytime I update my model. Is there anything to prevent this?
Bob Mulder
@bobmulder
Hi @MatthiasBusch, can you give me some more details/error logs?
If you don't select a new file, it shouldn't be uploaded...
MatthiasBusch
@MatthiasBusch
I get the error, that the field image can't be left blank
so, the validation already fails, but if I disable the validation, the image path string will be overwritten
Bob Mulder
@bobmulder
That sounds very strange... Please drop me some info how to reproduce this so I can try it myself...
MatthiasBusch
@MatthiasBusch
sure, let me set something up
termlimit
@termlimit
once a user logs in, i am using GlobalAuth to get access to the id in a model. My question is how can i make my CakePHP models similar to this Laravel 4 call: $query = Auth::user()->accounts()->orderBy('accounts.name', 'ASC')
so i dont have to continuously get the user_id from the session, etc for each instance I need to check ownership
anybody getting up and getting out the of the house this weekend?
Bob Mulder
@bobmulder
hi @termlimit! just woke up, ill respond asap
Bob Mulder
@bobmulder
@termlimit you need to do something like $query = $this->Accounts()->find()->where(['Accounts.name' => Configure::read('GlobalAuth')['id']])
termlimit
@termlimit
@bobmulder thanks for the reply! I guess my question sucked. The goal I am aiming for is to use the User model class to perform ownership checks on specific calls. So something like $this->Users->Accounts->find('all') would only return the accounts specific to the logged in user. I could use a beforeFilter or before query call, but that can become restrictive if I don't want it.
I also thought about putting a custom finder method in the User model, that would add the user_id => Configure::read('GlobalAuth')['id'] to specific queries. I was going to try this later today. I think this may be the easiest way to reduce repeating the same call over and over again. Thanks for spurring my thoughts! Also, how do I mark code blocks here?
Bob Mulder
@bobmulder

@termlimit Gitter works with markdown. To create code-blocks you need to add 3 quotes who are above your Tab-button and before the 1-button. This quotes: ->`<- (haha, don't know how to explain :P). So add 3 quotes above your code, and after your code and your code will be shown in a block.

About your issue; I've always learned that Models should not handle ownership stuff. So in fact the model should not even know about roles and ownerships and stuff. And to be honest I agree with that. The GlobalAuth-behavior is just a thing to hack around it if you need it. So in your case you could create a custom finder as you mentioned. Your query-call would look like:

$this->Accounts()->find()->find('ownership', $userId);

I hope this will help you. Because this stuff isn't releated anymore to the utils-library I suggest you should contact me privately via Gitter if you have questions ;)

Have fun coding ;)

termlimit
@termlimit
@bobmulder thanks again for the awesome reply. I was worried it was out of the ballpark.
Mariano Paz
@mariano55555
Hi everyone...I need help with WhoDidIt behavior, I always get php Error: SQLSTATE[42000]: Syntax error or access violation: 1066 Not unique table/alias: 'CreatedBy'
Bob Mulder
@bobmulder
Anybody has this issue again? I've seens some more code, but couldn't find it...
mandeepkhaleriya08
@mandeepkhaleriya08
anybody can help me here ..How a user login with fb,gmail in cakephp 3.2?And how i do it
Bob Mulder
@bobmulder
I guess this is not a related question to this plugin, right @mandeepkhaleriya08 ?
Mateusz M
@micalmt_twitter
Hi. How would I correctly filter filenames before moving the uploaded file or saving its path in a DB?
For some reason I am cursed with having to remove \x09 from filenames, because users.
Bob Mulder
@bobmulder
Hi @micalmt_twitter, whats your issue exactly?
Mateusz M
@micalmt_twitter
Some of the files uploaded by my users somehow contain the tab character. I need to do something like str_replace("\x09", "\x20", $filename); on the uploaded file name, but I can't figure out how to do this properly (as in, without modyfing UploadableBehavior.php)
My guess is I need to look somewhere https://www.pastery.net/gxkqjg/ here
_shuffle() is just generating some random characters.
Bob Mulder
@bobmulder
Ah okay... And what would you do if you should modify the behavior? ;) Implementing an event would be useful I think? Are you familiar with that?
Mateusz M
@micalmt_twitter
Haven't done that in Cake, but I'm open to trying something new :)
Bob Mulder
@bobmulder
haha okay. My first thought was that you often would like to affect the progress... So take a look at http://book.cakephp.org/3.0/en/core-libraries/events.html. Maybe we can open a PR to implement some events to make it customizable for wishes like yours...
egadgetjnr
@egadgetjnr

Hi there,
I'm starting to wonder what I'm doing wrong and I think I'm starting to lose my hair (still fairly new to CakePHP)

I'm trying to implement the uploader and have followed all the documentation (at least I think I have) and it's failing to put the file where I tell it to but it IS updating the MYSQL Table with the required filename (although I would like it to put the full path. i.e. 'webroot/uploads/<username>/20160707.jpeg')

{{Code Follows}}

View Code (profile.ctp)
<?= $this->Form->create($user, array('role' => 'form')) ?> <div class="box-body"> <?php
//Profile Avatar Box echo $this->Html->image('avatar5.png', array('class' => 'img-thumbnail', 'alt' => 'User Image'));
//Upload new Avatar echo $this->Form->create($user, ['type' => 'file']);
echo $this->Form->input('avatar', ['type' => 'file']); echo $this->Form->input('username');
echo $this->Form->input('password'); echo $this->Form->input('name');
echo $this->Form->input('surname'); echo $this->Form->input('email');
echo $this->Form->input('mobile_number'); ?>
</div> <!-- /.box-body -->
<div class="box-footer"> <?= $this->Form->button(('Save')) ?>
</div> <?= $this->Form->end() ?>

Users Table
$this->addBehavior('Utils.Uploadable', [ 'avatar' => [
'field' => 'id', 'path' => '{ROOT}{DS}webroot{DS}uploads{DS}',
'fileName' => '{field}.{extension}' ],
` ]);

This message was deleted
egadgetjnr
@egadgetjnr
I think I may have found the issue. It's not creating the folder if it doesn't exist... Is there something I can do to fix that in terms of Validation?
Bob Mulder
@bobmulder
What OS are you working on @egadgetjnr?
egadgetjnr
@egadgetjnr
Windows ATM, but I've also tried it on Ubuntu
I ended up getting it to work by 'modifying' the Directory Checker (code following)
Bob Mulder
@bobmulder
Hm it sounds strange the folders aren't created automatically
egadgetjnr
@egadgetjnr
In UploadableBehavior:
//if (!is_dir($this->_getPath($entity, $field, ['root' => false, 'file' => false]))) {
        if(!file_exists($this->_getPath($entity, $field, ['root' => false, 'file' => false]))){
          $this->_mkdir($this->_getPath($entity, $field, ['root' => true, 'file' => false]), 0777, true);
       }
Sorry, I can't get the line breaks to work :(
Bob Mulder
@bobmulder
Google for markdown code block ;)
egadgetjnr
@egadgetjnr
MWHAHAH. I'm unstoppable now ;)