Jump to content

onjegolders

Members
  • Posts

    1,147
  • Joined

  • Last visited

  • Days Won

    4

Posts posted by onjegolders

  1. Hi Diogo,

    Each project has a due date but also other date fields. What I'm trying to achieve is a sort of "log" for that project where I can see a chronological list of all dates linked to this project.

    The problem is it would need to combine more than one date field before ultimately sorting them as one array (I guess).

    I've thought about creating a new array of all the dates but then they'd lose association with their respective fields.

    Ultimately it should look something like

    1st January - New Years Day

    5th January - Started project

    11th January - Started design phase

    18th January - Project due

    25th January - Sent final draft to client

  2. Thought I'd reuse this old thread as have an interesting quandry.

    I have a template where there is more than one date field assigned to it, what I'd like to do is to be able to combine these and order a list by date.

    At present, I can't think of a way of doing this natively with PW. Any bright ideas? Cheers.

  3. Hi Wanze,

    Have you ever seen it happen where another site's content ends up in the analytics content?

    It's very strange as I have a completely unrelated site with different UA codes. Not sure if you've ever come across that?

    Cheers.

  4. Hi Valan

    I'll preempt this by saying that I believe it may be possible to achieve in FormBuilder, though in Ryan's own words, Form Builder is a tool for making simple forms much much quicker to make rather than for coding more complex forms.

    I'd be tempted to make this myself to have more control let me know if you need any help.

    Perhaps Ryan or others may comment on this to confirm the possibility of using FB.

    • Like 1
  5. Hi Christoph, this sounds like a perfect fit.

    Relating helpers to helpees (excuse the made up word ;)) would be done using a page reference field so would be extremely straight forward.

    In your tree, you'd presumably have:

    Help Topics

    Helpees

    Helpers

    each topic would start with a helpee assigned to it (as they've created the need for help) and then based on their criteria, a helper or multiple helpers would be assigned to it.

    Would the system need to be "intelligent"? In other words, would the system need to look for keywords and try and match pairs together or is this solely the responsibility of the administrator? (This would be the only complex part of the job if so)

    Ryan has built incredibly complex multi-relational sites using PW (http://www.tripsite.com/) and I can't think of any better system for this kind of job.

    • Like 2
  6. Am thinking again at what Diogo said. Maybe an issue with creating your own users rather than using the default ones would be you would lose all the valuable session stuff?

    Knowing the user is logged in and obviously not having to log in each page.


    Am sure this can all be re-added to $session but not sure how much would be involved and whether it would be worth it?

  7. Hmmmm Diogo, giving me ideas and teasing me with the ultimate power of PW! I now have too many choices to make!

    For the moment I just added an updateUser function to my member profile where a password field gets transferred to the corresponding user.

    public function updateTheUser($event) {
    
            $page = $event->arguments[0]; 
    
            if($page->template == 'member' && $page->isChanged("password")){
              
              $the_user = $this->users->get("name=$page->name");
              $the_user->of(false);
              $the_user->pass = $page->password;
              $the_user->save();
              
              $this->message("User $the_user->name also updated."); 
            }
    
        }    
    

    Think I may leave it there, I'm not sure if somewhere down the line I'll end up being glad to have the $user functionality?

  8. Thanks for the hint, onjegolders!

    It seems, that it's only working correct when "none" is selected in the "date output format" on the details page.

    No problem, glad you got it working :) It probably means your code needs to receive the date value as a unix timestamp so it can make it's own output format.

  9. Glad you solved it :) I confess I don't understand enough of this to confirm if the code is right, but I'm sure someone will :)

    But since we are at it. Why do you want too have the users in two different places? Doesn't seem like a very dry solution to me...

    I think it's because when I was originally trying to set up member profiles, lots of the discussions I had with Ryan indicated that $users had some limitations (security measures) that would mean searching and displaying would be a bit more work (not sure how much). Basically if I was going to be extending a lot then it may be a better idea to use a page in the tree.

    Will have to find the thread but it would be great to actually just use $users, would solve a lot of headaches :)

  10. Hi Vin, I'm guessing you'll want to handle this in the front-end using the API. There are quite a few posts out there with this same scenario.

    In a nutshell you'll want to receive your form data and sanitize it, then create a new page and a new user with this data.

    <?php 
    
    // was form submitted
    if ($input->post->my_submit_button) {
    
    	// check for errors with form
    	// if no errors, add a page and a user
    
    	// first add the page
    	$p = new Page();
    	$p->of(false); // sets output formatting to false in order to change field values.
    	$p->parent = $pages->get("/members");
    	$p->template = "member";
    	$p->title = $sanitizer->text($input->post->name); // sanitized your value from form and sets to title
    	$p->other_field = $sanitizer->text($input->post->other_field);
    	$p->save(); // save the new page
    	
    
    	// now add the user
    	$u = new User();
        $u->of(false);
        $u->name = $sanitizer->username($input->post->username);
        $u->email = $sanitizer->email($input->post->email);
        $u->pass = $sanitizer->text($input->post->pass); 
        $u->save();
        $u->of(true);
    
    }
    
    ?>
    
    <form action="./" method="post">
    	<!-- form stuff here -->
    </form>
    
    • Thanks 1
  11. Seem to have it working and I think the key was to add in $page = $event->arguments[0]; though perhaps someone else could confirm?

    public function createTheUser($event) {
    
            $page = $event->arguments[0]; 
    
            if($page->template == 'member'){
              
              $newuser = new User(); // add a new user
              $newuser->of(false);
              $newuser->name = $page->name;
              $newuser->pass = "newpass123"; 
              $newuser->save();
              
              $this->message("New user also added $newuser->name."); 
            }
    
        }    
    
    

    Edit: Though I'm now getting a duplicate entry error for parent id on the page creation. But surely they don't share a parent.

    Solved: I realised this was hooking on page save, so that each time it was saved, it was trying to add a new user, the correct hood is "added".

  12. Thanks both of you!

    You're both sort of right though kogondo sums it up when he says I want to dynamically create a user in users when a members is added in the page tree under members.

    That snippet was actually just a glimpse, my code was fuller but I'll try k0rn's approach of $users->add();

    Will report back. Thanks.

  13. I defined Textadept as my default editor in the system. I wouldn't really try it if I would always have to choose it from the context menu...

    I like what I see very much. One thing that put me away in the beginning were the themes, but I found out that although there aren't many themes around, it's very easy to create one. So, that's what I did :)

    https://github.com/ocorreiododiogo/diogo-dark-theme

    Are there any areas in which Textadept has advantages over ST2 Diogo?

    I'm using chocolat.app

    I used Chocolat a while back when in Beta. It's very beautifully styled but not sure if there are any features there which makes it worth my while leaving ST2.

  14. Thanks buddy, I did look at the Hello World module but wasn't sure on which parts I'd need to start changing. Would this take the form of a module which I'd upload to site/modules?

    Also, could you create the page using the same API calls, eg:

    $p = new Page();

    $p->of(false);

    $p->save();

    Thanks Diogo, as always ;)

  15. I still use FW CS5 and am very happy with it. I couldn't imagine changing to Photoshop. I've looked at Sketch before but never really found it "serious" enough but will have another look as I've heard rave reviews.

    Thanks for the link Matthew.

    • Like 1
×
×
  • Create New...