Jump to content

Juergen

Members
  • Posts

    1,306
  • Joined

  • Last visited

  • Days Won

    13

Everything posted by Juergen

  1. Unfortunately the code above works only if you are logged in and click the email approval link Mabe someone knows a possible solution for this.
  2. Maybe you are right @ LostKobraKai. I have created an "Amazon-like" rating to the product pages and for this special case it would be nice to have this feature. The Idea to highlight the owner is a less complex solution that will also work.
  3. Mhhh. My thought was to add a new textarea field to the comments array. In the backend the site ower can fill out this field and it will be displayed directly under the comment.
  4. You can make it with nested comments, but I dont want to use them. Nested comments are also separate comments. What I prefer is not creating an extra comment and to add the statement to the same comment. But maybe I will think over
  5. It would be great if there will be a possibility to add an answere or a additional comment of the site owner to each comment that was taken. Fe. a person gives a bad rating for a product on a page. You have 2 possibilities: dont make this rating public or make it public. It is not always realistic that there are only good ratings. Otherwise bad rating can influence your selling success. So it would be great if the site owner can post a statement directly under the bad rating (not a new comment) where he can write his own opinion or apology. This makes bad ratings more acceptable for other users. This is for good ratings too. Fe to thank the person for the comment.
  6. I have found a working solution. Here is the code for others who are interested in. //check for email approval GET variables $cpageid = isset($_GET['page_id']) ? $_GET['page_id'] : ''; $ccode = isset($_GET['code']) ? $_GET['code'] : ''; $capprove = isset($_GET['comment_success']) ? $_GET['comment_success'] : ''; foreach($page->comments as $c) { if((($page->id) == $cpageid) AND (($c->code) == $ccode) AND ($capprove == "approve")){ $page->setOutputFormatting(false); $c->status = 1; $page->save('comments'); } } Best regards
  7. No one an idea? I have the code to check for the email approval so far. //check for email approval GET variables $cpageid = isset($_GET['page_id']) ? $_GET['page_id'] : ''; $ccode = isset($_GET['code']) ? $_GET['code'] : ''; $capprove = isset($_GET['comment_success']) ? $_GET['comment_success'] : ''; foreach($page->comments as $c) { if((($page->id) == $cpageid) AND (($c->code) == $ccode) AND ($capprove == "approve")){ //$c->setOutputFormatting(false); //$c->status = 1; //$c->save(); echo "approved"; } else { echo "not approved"; } } The checking works and it shows me "approved" if anything is ok, but I am not able to store the new status value in the db. As far as I know comments are pages. Therefore I have tried to save it as a page, but this code doesnt work. $c->setOutputFormatting(false); $c->status = 1; $c->save(); Has anyone an idea how to save a specific comment to update the status? Best regards
  8. Strange behaviour. The copy function works if the page the should be copied is unpublished. If the page is published the duplication fails. Maybe it has something to do with the publish from date field. My setting is that the current date will be filled in if nothing is entered in the publish from field. If I copy this page maybe the publish date will also be copied and then it will be in the past. Could this be a reason?
  9. Quite good idea! Unfortunately always the loading spinner is beside the title and I get no errors from Tracy. I have tried it with the parent page and I get an error form the Page rename module. But the parent page copy function works. Maybe it has something to do with this module. I use the latest devs (3.0.12)
  10. Hello @ all, I want to copy a childpage in the page tree and I always get this error message: Can't save field from a new page - please save the entire page first Saving the entire page doesnt solve the problem. Has anyone an idea why this message appear on the screen. Copying the parent page works quite well. The problem is only at the children. Best regards Jürgen
  11. Quite good idea, but in this case it prevents the storage of the changed value because the reload enters before the new value will be stored. $(document).on("click", ".ui-button", function(){ location.reload(true); }); ui-button is the button class of the save button in the modal window. A timeout would be a possible solution, but I dont know how long it will take to store the value. For the moment I have added a timeout for 1 second $(document).on("click", ".ui-button", function(){ setTimeout(function() { location.reload(true); }, 1000); }); During the test it seems ok. Maybe there is a better solution.
  12. The new frontend editing feature in PW 3 is great, but if a value of field will be changed only the changed value will be visible on the frontend. All other texts will be the same. It is often that other values depending on such a field should also change depending on the value of that field. Example: You have a select field where you can change the status of a product (available, sold out). If you change the status a hint text depending on the status should be displayed on the page or not. F.e. Select sold out ->This product is sold out at the moment. Select available -> dont show a text For now you have to refresh the page manually to show or hide the depending text on the page. This is often disturbing for customers. It would be great if I have the possiblity to refresh the page automatically if something was edited on the frontend and the save button was clicked.
  13. I have tried to figure out how to change the status (spam, approved,...) via api from the email link. I have created a custom comment form and custom comment list with my markup. Both work as expected. The only thing I could not figure out was how to change the status from pending to approved or another status via the email link if it will be clicked. In the email link there are several GET variables which can be used to create an if statement. F.e if(GET->[success] == "approve"){ ..... ..... set new comment status to 1 } There are several GET variables so this makes it a little bit tricky. Has anyone tried to make the email activation of comments via the api. Best regards
  14. No I dont want to mix up - adding the slash is the most consistent method in this case.
  15. Problem solved: The slash was on the wrong place. Now the url looks like this: http://www........at/registrierung-abgeschlossen/?user=tester&hash=57498c2ab30a29a2ea66ef153158ed1c The slash is before the question symbol and now it works. Thanks Kobrakai.
  16. Unfortunately the slash at the end doesnt work. I can remember that there is a module which (I dont know the name) which is responsible for redirects if a url has changed. Could be this the reason?
  17. Correction: The GET parameters will be sent - I can see it for a short moment in the url, than they will be removed - for me it looks like a redirect. Maybe from a module. After that the page is visible. ?? Maybe this could be the reason @ LostKobraKai. I will add the slash and try it once more.
  18. Hello @ all, I have used for a long time the code from the first entry: https://processwire.com/talk/topic/4066-activate-user-account-via-email/?p=39846 I have the latest PW devs installed an today I have discovered that this code doesnt work anymore. The registration works well and the user get the email to verify his account by clicking the activation link. The link looks like this: : www........../registrierung-abgeschlossen?user=tester1&hash=47eeaa6d0363b323d48730fce39039bf The strange behavior starts when the user click this link in the email. If the links was clicked the landing page is not the same url as above. It is www........../registrierung-abgeschlossen/ ->without the GET parameter. So it seems that there will be a redirect. If I want to echo the values of the GET parameter all will be empty. Here is the code of the activation page: <?php /*************************/ /** Activation template **/ /*************************/ include("./inc/head.inc"); echo '<div class="maincontent registration-complete row">'; echo '<main class="col-md-12">'; $activate_username = $_GET['user']; $activate_hash = $_GET['hash']; echo wire("users")->get($activate_username)->id;//this only for testing and shows always 41 for the admin $mister = _t('Mister', 'Generic'); $miss = _t('Miss', 'Generic'); if (wire("users")->get($activate_username)->id) { if (strcmp(wire("users")->get($activate_username)->user_activation, $activate_hash) == 0 || wire("users")->get($activate_username)->user_activation == 0) { $mainheadline = $page->get("headline|title"); $useractivehead = _t('Your registration was successfull', 'Generic'); $useractivetext = _t('Your account has just been successfully activated. You can register now with your access data at our website.', 'Generic'); $useractive = '<div class="alert alert-success" role="alert"><h4><i class="fa fa-info-circle"></i> ' . $useractivehead . '</h4><p>' . $useractivetext . '</p></div>'; echo '<div class="page-header"><h1>' . $mainheadline . '</h1></div>'; $activate_user = wire("users")->get($activate_username); $activate_user->of(false); $activate_user->addRole("guest"); $activate_user->user_activation = "0"; $activate_user->save(); //$activate_user->of(true); echo $useractive; //show success message $gender = $activate_user->usergender; if ($gender == "1") { $gendertext = $mister; } else { $gendertext = $miss; } $first_name = $activate_user->user_first_name; $last_name = $activate_user->user_real_name; $useremail = $activate_user->email; $currentuserlanguage = $activate_user->language; } else { $mainheadline = _t('Errors occur during the activation', 'Generic'); $usererrorhead = _t('An error occured', 'Generic'); $usererrortext = _t('We are sorry but an error occured during the activation. Please contact the owner of the website.', 'Generic'); $usererror = '<div class="alert alert-danger" role="alert"><h4><i class="fa fa-warning"></i> ' . $usererrorhead . '</h4><p>' . $usererrortext . '</p></div>'; echo '<h1 itemprop="name">' . $mainheadline . '</h1>'; echo $usererror; //show error message } } else { $mainheadline = _t('Errors occur during the activation', 'Generic'); $usernotfoundhead = _t('Account not found.', 'Generic'); $usernotfoundtext = _t('Sorry, but your account was not found in our database.', 'Generic'); $usernotfound = '<div class="alert alert-danger" role="alert"><h4><i class="fa fa-warning"></i> ' . $usernotfoundhead . '</h4><p>' . $usernotfoundtext . '</p></div>'; echo '<h1 itemprop="name">' . $mainheadline . '</h1>'; echo $usernotfound; //show error message } echo '</main>'; echo '</div>'; include("./inc/foot.inc"); ?> Has anyone an idea, why the GET parameter arent there? Best regards
  19. Hello @ all, I have a general question about how PW deals with db queries. If I query the same db field multiple times on a page, fe the title field, will this field be queried only once or for every appearence on the page. $page->title ...... $page->title ...... ...... $page->title Thanks for you answeres
  20. Thanks for your hints. I will leave the page uncached so I can use CSRF. The page loads quite fast so its not really necessary to use a cache.
  21. Ok, this causes the problem. I use a redirect to the same page after there are no errors to prevent double form submission. After the redirect only the success message will be shown, but this only works if the cache is disabled. In my case I see the (empty) contact form again without the success message, because the page will be reloaded from the cache. This is the problem.
  22. Anyway it doesnt work at all. I leave the page uncached. Thanks for your efforts.
×
×
  • Create New...