Jump to content

Manaus

Members
  • Posts

    212
  • Joined

  • Last visited

Posts posted by Manaus

  1. I vastly prefer Textile over Markdown: the *thing* appears as _this_ and **this** is different from *this*...

    What's more, on Italian keyboards you don't have the ` sign. I'm wondering what about French, Spanish etc.

    Pros in textile are bold, italic, links notation, and so many other things.

    Cons is titles, I agree, and popularity.

  2. Hello,

    I'm trying to ckech whether a user is allowed to see a specific page. The page has a Page field, holding the assigned users. I tried $page->allowedusers = $user, $page->has($user) and so on, but it's not working...

    Thanks for any help.

  3. Hello,

    I'm trying to create a new user from the API, this is my code:

    $u = $users->add($csvnome);
    $u->save();
    
    $u->of(false);
    // $u->save();
    $u->azienda = $csvazienda;
    $u->pass = $csvpass;
    $u->email = $csvemail;
    $u->nome = $csvnome;
    $u->save();
    
    $u->addRole("utente");
    $u->save();  
    $u->of(true);
    
    


    I get this error: Error:     Exception: Can't save page 0: : Pages of type NullPage are not
    saveable (in /Users/utente/Sites/gammapw/wire/core/Pages.php line 514)

    I suppose this is not the right way to create a new user?

    Thanks!!

  4. Thanks so much Matthew for publishing the code

    Thanks Dragan

    Well I have a Project $page which is, say "Project Bluemoon". I need to add users to this project, and since they might be dozens, the client asked me to make a form. Upon uploading the csv rows, this is the logic:

    if (user exists) {

      add user to Project

    } else {

      add user to $users;

      add user to Project;

    }

    Each Csv row contains username, email, password, project_code

    That's it... !

    Thanks!!

  5. Hello, 

    I added a crop image field in the user template, and set the field to accepting 1 file only. I upload the image via the front end using these values:

         $a->setMaxFiles(1);
         $a->setOverwrite(true); 

    Now, if I upload an image via the back end or the front end, the image field keeps many images. 

    This resolves in a code trouble: if I try to print $page->createdUser->image->getThumb('micro') I get a string: the first image, but I need the last one. Btw printing $user->image I get an array, but it’s not what I need. Tried of course $page->createdUser->image->last()->getThumb('micro'), but returns an error "Pageimage::last does not exist or is not callable in this context"

    Thanks for any suggestion...!

  6. Hello,

    I need to delete children and subchildren of a page, this is the code I'm using: 

    $ch = $tobedeleted->children();
    foreach ($ch as $c) {
    	echo $c->title; // works
    	if ($c->id) $c->delete();
    }
    
    

    Still I get an alert telling that the page cannot deleted because it has children.

    Thanks for any suggestion.

  7. Hello,

    I need to import a list of users, it can be like this:

    User1, Project1

    User2, Project1

    And so on.

    In the future the client might give me a list like this:

    User1, Project1

    User2, Project2

    User3, Project2

    I need to make sure the second import doesn't change User2 values (i.e., remove Project1), but just add a new Project to his relations.

    Can this be done with the ImportCsv plugin?

    Thank you very much

  8. Hello,

    my user (41) logs in, I need to know if he has permission to see that page. To enforce granularity, each page has a 'user' field, for example (41|1010). 

    How do I check whether the user can see that page? I'm evaluating the strpos php function, but I fear it might lead to error. Note it's not about roles, each user can see one or more pages.

    Thank you very much

  9. Hello,

    I'd like to add the user who wrote the post to the page data (either guest, or the logged in user), this is the code I'm currently using

    $form = $modules->get('FormTemplateProcessor');
    $form->template = $templates->get('annuncio'); // required
    $form->requiredFields = array('title', 'body');
    $form->parent = $page->parent; // optional, saves form as page
    echo $form->render(); // draw form or process submitted form
    

    Btw, using this code I get all the fields I put in the template, so rendering the user field generates a dropdown selectable list of users...

    Thanks for any advice!

×
×
  • Create New...