Jump to content

Manaus

Members
  • Posts

    212
  • Joined

  • Last visited

Posts posted by Manaus

  1. Thanks Soma and Pierre-Luc,

    The query roles=utente, roles!=superuser|guest returns an empty array, I need to keep users having guest+utente, and exclude users who have utente+admin role (I don't think changing the password to a guest bears consequences, does it?)

  2. Hello,

    I have a list where users can have two or more roles: guest+utente, guest+utente+superuser, guest

    I need to find all users having 'utente' as role, but not admin, nor guest.

    Tried this

    $u = $users->find("roles*=utente");
    $u = $users->find("roles=utente")->not("roles=superuser")->not("roles=guest");
    $u = $users->find("roles!=superuser")->find("roles=utente");
    

    But without success..

    Thanks for any suggestion

  3. Hello, I'm trying to hack this thing, witout success...

    echo $page->documents; // selfie.jpg
    echo $page->documents->description; // no
    echo $page->documents->get("description"); // no
    $f = $fields->get("documents"); echo $f->description; // neither
    

    Thanks for any suggestion...

  4. Hello,

    I need to add the guest role to so many users I just added [using a csv] to $users pool, is there any way to make it from the backend?

    I'm also trying to code it, but I don't know how to make up the selector

    $usersWithoutRole = $users->find("roles*=gooduser,roles!*=guest, roles!=superuser")
    

    Thanks

  5. Hello, I have a page with this code

    if ($input->get->progetto && $input->get->item) {
    
    	$prg = (int) $input->get->progetto;
    	$itm = (int) $input->get->item;
    
    	$theitem = $pages->get($itm);
    	echo $theitem->createdUser == $user; // prints nothing
    
    	if ($user->isSuperuser() || $theitem->createdUser == $user) {
    		$theitem->delete();
    	}	
    	$projurl = $pages->get($prj)->url;
    	$session->redirect($projurl);
    }
    

    I get this error: "Error:     Exception: This page may not be deleted (in /Users/utente/Sites/gammapw/wire/core/Pages.php line 847)"

    Still, the removing action takes place.

    Any suggestion?

    Thanks!

  6. Hello,

    I have a form submitting some values, but I get a strange behaviour. Just after submitting, I cannot see the delete button. It's visibile when loading the page normally though (GET, !POST).

    echo $user." ".$l->createdUser; // always matches
    if ($user->isSuperuser() or $user === $l->createdUser) {
    	echo "<a href='{$_root}delete-item/?proj=$page->id&item=$l->id'>Delete</a>"; // sometimes visibile, sometimes not	
    }
    

    These are my attempts

    echo  (int) $user ==  $l->createdUser; // always true, even if values don't match
    echo  (int) $user == (int) $l->createdUser; // always true, even if values don't match
    echo  (int) $user === (int) $l->createdUser; // always true, even if values don't match
    echo  (int) $user->id === (int) $l->createdUser; // never true
    echo  $user == $l->createdUser; // usually works correctly, but not just after $user posted something
    echo $user === $l->createdUser; // same as previous
    

    Thanks for any suggestion

  7. Hello,

    I'm trying to display the just uploaded image on the page, but I can't make it work.

    This is the code

    <img src='<?= $user->avatar->last->getThumb('thumbnail') ?>' alt='' />
    

    I get a Call to a member function getThumb() on a non-object error.

    Still the image is uploaded correctly, as I can see from the admin...

    Instead if I load the page as a usual Get, I can see the image correctly.

    This is the code I use for uploading the image...

    	$user->of(false);
    	$user->avatar->deleteAll();
    
    	$a = new WireUpload('avatar');
    	$a->setMaxFiles(1);
    	$a->setOverwrite(true);
    	$a->setDestinationPath($user->avatar->path());
    	$a->setValidExtensions(array('jpg', 'jpeg', 'png', 'gif'));
    
    	foreach ($a->execute() as $files) {
    		$user->avatar->add($files); 
    	}
    
    	$user->save();
    	$user->of(true);
    

    Thanks for any suggestion

  8. Hello, I have a page with multiple checkboxes, each enables or disables (or should) a Page value in a template... the Page value represents $users linked to that specific page.

    I have this code:

    $d = $input->post->recipients;  // array of values, such as rec[1010]=>true, rec[1024]=>true
    $c->of(false);  // $c is the page
    foreach ($d as $dest) {
      $c->recipients->set($dest, true);  // recipients is the Page field in the template
    }
    $c->save();
    $c->of(true);
    
    

    Still I have it not working,

    Thanks for any suggestion..!

  9. Hello, I have this code

    	$a = new WireUpload('documents');
    	$a->setMaxFiles(10);
    	$a->setOverwrite(false);
    	$a->setDestinationPath($c->documents->path()); 
    	$a->setValidExtensions(array('jpg','jpeg','png','gif','doc','docx','xls','xlsx','pdf')); 
    	$c->of(false);
    	foreach ($a->execute() as $files) {
    		$c->documents->add($files);
    	}
    	$c->save();
    	$c->of(true);
    
    

    but I manage to save only one file...
    I put the multiple="multiple" attribute on the file input.

    Any suggestion?

    Thanks!...

  10. Hi,

    I'm having an error "Method Page::template does not exist or is not callable in this context" because I'm using {% if page.template == "project" %} in a template.

    I'm passing $twigvars = array("page" => $page) to the template.

    Is there any workaround for getting this conditional on a template? (started learning twig yesterday... :)

    Thanks!

×
×
  • Create New...