Jump to content

Lars282

Members
  • Posts

    144
  • Joined

  • Last visited

Everything posted by Lars282

  1. Hey, How do you upload images using the API? I have a feeling my way is not the shortest ... Since $_FILES['img']['tmp_name'] is without an extension, I aways use move_uploaded_file() to put back the original name incl extension (and unfortunately move the file) $somepage->image->add("new/path/image.jpg") then I have to delete the image from step 1 I am sure there is an easier way? Thanks, Lars
  2. Is there a way of forcing trailing slashes when using URL segments? Thanks, Lars
  3. It sees to be some strange mod_sec and safe_mode settings that have recently been changed by my hosting provider. Hopefully, they will resolve this soon. On another note, what should the chmod settings be for the assets folder and subfolder? And files? In the config it has $config->chmodDir = "0777"; $config->chmodFile = "0666"; Do folders really need 777? And files 666?
  4. It's a self-built script, but it was certainly working fine. Also, since it is a page, independently of whether that is working correctly, it should be possible to upload through the admin? I have already uninstalled all self-built modules.
  5. Hey! I am not sure since when, but it seems that the image upload on my site is broken. I can no longer upload image through the admin. Everything appears to be fine, but in the end the image has not been added. I have checked for the images that are already online: it seems they are all missing the file ending, ie they are called .../site/assets/files/1096/phpvwmbuw. Also, wenn I try to use image->width(500)->url, it results in an error that I am trying to use width on a non object. I have an image upload form on my website. When uploading through this form, the images are successfully uploaded, but without the file ending. When I then try to access the page for the first time in the admin, it shows this error: phphitkhd.0x100. is an unsupported image type Subsequent views of the admin page are fine, and it shows all fields and no error. The 'show thumbnail in admin' box is ticked for the image field. What is wrong? How can I fix it? Everything else seems to be working fine. Thanks for the help, Lars //edit: I have already replaced the wire folder with the latest, but this did not fix the issue. I had thought that this should at least fix the issues I have on the admin side, but it didn't.
  6. Thanks! The only reason I don't want the stylesheet as PW page is that it makes things 'messier' for whoever uses the admin to add/edit pages. Is there a way of this only being visible in the admin to users with a certain role, even when it is viewable as a guest?
  7. Soma, this is exactly what i tried to do and what I wish would work, but unfortunately, this does not work. The result is simply an unformatted page, as if the stylesheet never was included. I assumed that this was due to the fact the PW prohibits access to the styles.php? Does this work for you? If so, I will check again and see, but I couldn't get this to work like this for me before.
  8. Thanks for your extensive reply! Not sure I understand what you mean. Currently, I have <link rel="stylesheet" media="all" href="<?=$pages->get("template=style")->path?>" type="text/css" /> Do you suggest something like <style><?=include($config->urls->templates/styles/style.php)?></style>?
  9. teppo: I mean the fact that I cannot simply put the .php file in the styles folder and include it in my templates as PW prohibits execution of php files accessed directly. The style.php needs to be added as a page having the style.php template in PW admin, and only then can be included as include($page->get(template=style)->path). What I find would prefer is not having my stylesheet as a page in the page overview. Is there a way?
  10. Hey, I want to use PHP in my CSS file. The only way I could make it work is to add my style.php including header("Content-type: text/css") as a template, and then include this page as the stylesheet in my other templates. While this does offer advantages (style can be easily customised from the PW admin), is there a nicer way of doing this? Thanks, Lars
  11. Hey, Is there an easy way of simply using the forgot password module on my own login page? Thanks, Lars
  12. If I want to use the form builder for a registration form that saves to an unpublished 'user' page: Is there a way of defaulting the role to guest? Can I check whether a chosen username already exists, ie checking whether a page with template user has name=username? Thanks!
  13. Hey! First, and off topic, I am really impressed by the form builder module. I am have a website coming up that will require a lot of advanced forms and I will certainly give it a try! Now ... I was wondering whether there are some modules out there that allow more user interaction? I need user profiles, private messaging, email notification settings, etc ... is there anything? Also, I would need users to be able to 'subscribe' to comments threads ... ie if they have posted a comment on a page, they should receive notifications for future comments but be able to unsubscribe? Thanks, Lars
  14. I think I prefer option 1 but am not sure whether I understand what the if statements are checking for. if($page->id && $page->isChanged('status') && !$page->is(Page::statusUnpublished)) Why is the $page->id needed? $page->isChanged('status') simply checks if the status has changed? !$page->is(Page::statusUnpublished) checks for whether the page is published now, after saving? Having checked this, it is known that the page is published now and had a different status. So now we need to check that the previous status was Unpublished? So why is the query to the DB needed and why isn't if(Page::statusUnpublished) enough? Also, how do I hook to Pages::saveReady? And where am I hooking to? Before the new values have been written into the DB but after the $page holds the new values? Sorry for so many question, this is the first time I am actually trying to use hooks myself.
  15. Hey. I have got a question on how to get a module to do the following: Registered users can use a form to add pages to my website, but they are added as unpublished until a moderator can review them and then publish them through the admin. What I want to add now is that the user who originally added the page receives a notification email once the page has been published. How can I hook in after 'publishing' the page? Thanks, Lars
  16. I had previously built a page displaying links to all the pages with pending comments, but this is much nicer to use. Thanks!
  17. Thanks, guys! I am confused about using id= though. I would have thought that this makes sure that the found page has this id? I have a page field on those pages holding the categories (multiple possible), call it cats. So wouldn't I have to do something like $selector = 'cats='.implode(array_map('intval', $input->post->categorylist),'|'); $pages->find($selector); Also, if I now select two categories, it will return pages that are in either of the two or in both. What I want is to return pages that match all the categories (they are more like tags). Is this the way to go or is there something nicer like slkwrm's post above? $selector = ''; foreach($input->post->categorylist as $value) { $selector .= 'cats=' . ((int) $value) . ', '; } [...] // append limit etc to the selector, so last comma above ok. $pages->find($selector);
  18. Hey. I have a number of pages and a number of categories (children of the search page) assigned to them via a page field. Multiple categories can be selected. Now I have a search page, where a list of all categories with checkboxes is displayed: foreach ($page->children() as $category) { echo '<input type="checkbox" name="' . $category->name . '" value="1"> ' . $category->title; } How can I now find all the pages that have at least all the selected categories? I found this: $david = $pages->get("/architects/david-childs/"); $renzo = $pages->get("/architects/renzo-piano/"); $pages->find("architect=$david|$renzo"); But as the number of selected categories is unknown, I would start by making an array? But how do I then use the array in find()? Thanks for the help! Lars
  19. I will give it a try, but if that works, it should all be working fine. Thanks for your help ryan. If anyone needs something similar, I am happy to share the files.
  20. Thanks ryan. I have added the line below to the processInput() function as you suggested: $this->sendVerificationEmail($comment); Outside the processInput() function I have added below: /** * Send email to user to verify email address * */ protected function sendVerificationEmail(Comment $comment) { $subject = "Comment on A Global Village: Email Verification"; $from = "A Global Village <processwire@" . $this->config->httpHost . ">"; //CHANGE! $body = "Dear {$comment->cite},\n\n" . "Thank you for commenting on the article {$page->article_title}.\n\n" . "Please verify your email address by clicking the link below. If this does not work, you can also copy and paste the link into the address bar of your browser and press enter. Once you have verified your email address, your comment will be published once approved by the editorial team.\n\n" . wire('pages')->get("template=home")->httpUrl . "?id=" . [b]$comment->id[/b] . "&key=" . hash('sha256', $comment->email . $comment->text . "AGV") . "\n\n" . "Best regards,\n\n" . "The Team at A Global Village"; return mail($comment->email, $subject, $body, "From: $from"); } This seems to be working, but the $comment->id only returns '0'. How can I get the comment's id? Thanks!
  21. I've started with this but can't seem to find the place from where to call my sendVerificationEmail() function ... it needs to be after the new comment/page has been saved since I need the new $comment->id ... but so far I only seem to get a 0 as id. Also, how can I select a comment by its id later on some template? From the database it seems the id is unique for all comments across all pages, but how can i select a specific comment by its id?
  22. How would I best modify the comments module to still allow its updates?
  23. Thanks a lot ryan! I will give it a try myself ... and probably end up here again asking for some help.
  24. Thanks for your extensive reply, ryan! The reason why I would like to do this has nothing to do with spam - since using the security field option and askimet, it is not a problem anymore. It is for a website of a semi academic journal and it would be great if there could be some identity verification for when people comment on articles. The easiest way to do this would be for them to use their official email address and verify that it is actually theirs. It would improve credibility a lot. As of now, we cannot tell whether it is real or someone pretending! Of course, this could be done via registration/login, but I believe this would hinder many people from quickly commenting. I see your concerns with sending emails - I had not thought of that. Maybe it would be possible to protect against this by only allowing comments every x seconds, independent of email/IP/etc, plus using some additional captcha?
  25. What I just thought ... is it maybe possible to simply add an extra status to comments via a module? Or would that require editing the comments module?
×
×
  • Create New...