Jump to content

Lars282

Members
  • Posts

    144
  • Joined

  • Last visited

Everything posted by Lars282

  1. Hey. Is there a way of requiring users to verify their email address when posting comments? Ie when someone posts a comment, it should go into a pre pending approval state, and send an email to the email address of the poster asking them to click a link to verify their email address. Only then, it should have pending status for moderators to approve. To do this, I would create an extra hidden page without template to hold all the posted comments in some fields, include when they were posted and where to plus some id/hash, which then get moved to the comments field on the correct pages once the user opens the correct url with the same hash as a get variable. Is there an obvious and easy way of doing this that I can't think of? Thanks, Lars
  2. Hey! How do I set the date field when adding pages through the API? It defaults to today's date when using the admin, and I want to achieve the same when uploading through the API. Thanks, Lars
  3. Thanks, apeisa. I've added a PW security field, let's see if it helps. If not, I'll try adding timestamping as I really dislike the idea of captchas. @yellowled: Akismet does not recognise about a third of the spam comments, I just felt that this percentage is quite high and should be lower ... ?
  4. Hey all, I am receiving a lot of spam comments that get not filtered as spam by the akismet filter - any idea why? Secondly, spam comments don't seem to get deleted after the specified amount of time - what is going wrong? Thanks, Lars
  5. Thanks Soma - very stupid of me!
  6. The url to login is something like /login/?id=1009. When a page requires a login, it redirects to this with the id being it's own id. After a login, this should redirect back to the previous page. @ryan: what do you mean with independently of a login?
  7. This is the very beginning of the login page template, header etc only comes after it, but assumed that what comes after is irrelevant for the redirect? After I login successfully, it only shows a blank page with no content on it, no errors.
  8. Thanks ryan, but still can't get it to work. My login file starts with this: <?php if ($user->isLoggedin()) { $out = 'You are already logged in.'; } else { if ($input->post->user && $input->post->pass) { $user = $sanitizer->username($input->post->user); $pass = $input->post->pass; if ($session->login($user, $pass)) { // login successful $i = (int) $input->get->id; $t = $pages->get($i)->path; $session->redirect($t); } else { $out = 'Login Failed. Please try again.'; } } $out = '<form action="./" method="post">'; $out .= '<input type="text" name="user" value="Username" />'; $out .= '<input type="password" name="pass" value="Password" />'; $out .= '<input type="submit" name="submit" />'; $out .= '</form>'; } ?> But the redirect after successful login still doesn't work. Any ideas? Thanks!
  9. Hey, I am trying to use renobird's code above, but can't get the redirect to work properly. I call e.g. /login/?id=1009 and after a successful login: if ($session->login($user, $pass)) { // login successful $session->id = $input->get('id'); $session->redirect($pages->get($session->id)->path); } I discovered that the problem is that my $input->get('id') is empty ... but don't understand why and can't seem to fix it. Already tried using something else than id in case that was a system reserved name, but didn't make any difference. Lars
  10. Thanks all, this helps a lot! @Soma, is there a preferred way of adding more content to a user? Ie adding child pages or changing the template?
  11. Thanks! Didn't even notice the template filter until now! Ok - I will have a look and decide which method to use, but seems both straight forward. Is there a brief example on how to use $page->save()? Does it work similar as for user, just using $page? <?php $u = new User(); $u->name = "gonzo"; $u->pass = "BamBam!"; $u->addRole("guest"); $u->save(); Thanks, Lars
  12. Hey! I am not sure, probably this has been discussed somewhere already, but I could not find anything. I have a website where users once registered and logged in should be able to view and post content (in the form of a PW page with a certain template, like adding a page in the admin). I have two questions concerning this. Firstly, how can I add a page using a form on a website to add pages to the page tree? Secondly, I am not sure whether I can use the PW users for this. I need visitors to be able to register themselves, maybe with approval needed from an admin before they can login (already found how to have a custom login page). I might need to store more information than possible in the current user page, i.e. more than the name/pw/email - would that work? If so, how? Many thanks, Lars
  13. What are the possibilities for the status of a comment? 0 for pending, 1 for approved ... -1 for spam?
  14. Found where it went wrong: the pages in question have an empty title field, due to their nature ... so the <a></a> were created properly but just invisible. Thanks so much diogo! I might try to extend this module to include more functionality, and upload here once I do. Thanks again for your help!
  15. Hm, this is how it appears in the admin/fields page: Is that the correct one to use?
  16. No, doesn't work either. The pages are definitely not hidden ... But somehow find("$field.status=0") does not get any pages ... ?
  17. Thanks diogo! It is the same problem as before: It displays the message for when there are pending comments, but then does not list any pages ... Again, if I replace find("$field.status=0") with something like find("template=xyz"), where xyz is a template I am using, then it displays some pages ...
  18. Thanks a million! I adjusted it slightly by finding pages with the comments field name as the one I am using instead of 'comments': find("article_comments.status=0") Unfortunately, it now only shows an empty page as if it is not finding anything - there are pending comments though. When I do something like find("template=xyz") it works fine ... ? Thanks, Lars
  19. Thanks, comments.status=0 helps! It would be really great to have it on the admin page - if you have time, it would be amazing. Or maybe you could give me brief outline on how to write this module and I can give it a try myself? The hello world module only shows how to add hooks ... but how to add an admin page? Thanks again, Lars
  20. Hey! I was wondering whether it is possible to display a list of all pending comments somewhere? I have hundreds of pages where visitors can comment and checking them all in the admin page is not really an option. ... of course there's the email notification, but would be great if that's not the only way ... Thanks, Lars
  21. The intended result is that above is displayed ordered by say Issue 7, then Issue 6 etc ... and not in apparently random order. Code: foreach ($pages->find("$page->topic_name=1") as $p) { //Check wether the parent title from last one was different. If so, display new heading. if ($i != $p->parents->get("template=issue")->title) { $i = $p->parents->get("template=issue")->title; echo '<div class="topic-issue">'.$i.' – '.$p->parents->get("template=issue")->issue_date.'</div>'; } echo '<div class="title"><a href="' . $p->path . '">' . $p->article_title; if ($p->article_subtitle) { echo ': ' . $p->article_subtitle . '</a></div>'; } else { echo '</a></div>'; } echo '<div class="author">' . $p->article_author_name . ', ' . $p->article_author_affiliation . '</div>'; } unset($p); How can I order this by template=issue as in admin and then children as in admin? Screenshot of my page tree
  22. Is there a way of using sort("property.subproperty")? If so, how? Don't really understand what it says on the cheatsheat! Thanks!
  23. Hey! I just tried this: Result: http://aglobalvillage.org/journal/global-health/ The grey bars are the titles of the parent pages (to be exact, the parents of parents) ... somehow this does not seem to be sorted as in the admin ... ?? If it was as in admin, surely they should be grouped by common parents? How can I group all the results by the parent pages? I.e. how can I make the find() return the pages as they appear in admin order? Thanks, Lars
×
×
  • Create New...