Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/10/2015 in all areas

  1. page-edit-created is an optional permission that you can choose to create yourself in Access > Permissions. You would use this permission if you wanted a user to only be able to edit specific pages that they had created, or that you assigned to them.* For instance, lets say you had a blog with multiple contributors. All the blog posts use the same blog-post template. Then lets say you had a role named contributor. That role has page-edit permission. Your blog-post template (Setup > templates > blog-post > Access) has that contributor role assigned for "can edit pages" and "can create pages". The template used by the parent of the blog /posts/ (template blog-posts) would have "can add pages" assigned as the only permission on the access tab. If you've got the setup above, then users with the contributor role can edit any of the blog-post pages. But if you then add page-edit-created permission to the contributor role, suddenly those users can only edit blog-post pages that they created (or that you assigned them as the created user*). They can't edit blog post pages that other users created. To take the example one step further, add another new permission called page-publish (in Access > Permissions), but don't assign it to the contributor role. Now those contributor users can create blog-post pages, but not publish them. At this point, you've got a nice workflow setup where you as the administrator (or someone else you assign) has to approve those blog posts before they are published. *To adjust the "created user" on specific pages, see the setting under Setup > Templates > [your-template] > Advanced > Template Toggles > Allow created user to be changed on pages? Once that box is checked, you can change the "created user" on any page from the Settings tab. Not positive I understand the questions, but if i did then what I wrote above answers these as well. They are different permissions that do different things, so there's isn't crossover. But page-publish requires page-edit, so page-publish does nothing without a user first having page-edit on the same role. If your system has a page-publish permission, and a user doesn't have it in their role(s), then they can only edit unpublished pages (or create them if you assigned that ability somewhere).
    8 points
  2. The main difference is this: When creating, editing or deleting elements in a PageTable field, you are creating, editing and deleting independent pages, which appear in your page structure. Each element can be viewed, edited and deleted separately in the Page List. Since each element is a page, it can also appear as a result from a $pages->find() query. As the name implies, the PageTable field is simply a table of links to pages, and in this sense, it is very similar to a simple multi-page field. When creating, editing or deleting elements in a Profields Table, you are creating, editing and deleting rows in a table in the database. The elements can't be viewed, edited or deleted except through the owning page, and when querying, you get the owning page rather than the table row. In terms of efficiency, the Profield Table is better, since it allows for less queries/joins to get the different values. Generally speaking, Processwire stores the value of each field in a separate table, so you have a fields_question table, a fields_answer table, a fields_display table, etc. If you want to show all three fields for a page, the system will have to query three different tables to get the values. That's how things work for the PageTable field, since it creates normal pages. The Profields Table field on the other hand stores values for the different columns in a single table. So if you have a Profield Table field called questions with columns called "question", "answer" and "display", you will have a single table called fields_questions with columns called "question", "answer" and "display". When accessing the values of a row, it is more efficient, since you get all three values in the same query to the database. The Profield Table has however some drawbacks: The list of types you can use for the different columns is limited: you don't have a page field, or a file field for example. Since elements in a PageTable field are normal pages, you have access to all field types. The options on those fields (dependencies, visibility, etc.) are also limited. The queries that you can do are also more limited, since you can't query directly for table rows. As an example for the last point, let's say that you have a questionnaire with several questions. If you use a PageTable field called questions that references a question template (with topic, question, answer, display and include_in_email fields), you can count how many people answered that they had children like this: $pages->find("template=question, topic=children, answer=yes"); If you use a Profield Table, that won't work, since you can't search by question (@field.subfield selectors as presented here also don't work). In your case, I think that the best approach is to use PageTable fields as explained in my previous post.
    6 points
  3. This is my first site I made for a client with PW: http://www.springbeestjes.be It is a simple online shop used (for the moment) PayPal. It is expandable for the future. Modules: - Maintenance module http://modules.processwire.com/modules/maintenance-mode/ I want to thank all the PW-people who helped me learning and understanding PW, also for the fast and good support. I like this CMS!!! Now I preparing the next project Regards, Christophe
    5 points
  4. Get the last version: from PW modules directory: http://modules.processwire.com/modules/fieldtype-select-ext-option/ from Github: Github: https://github.com/kixe/FieldtypeSelectExtOption From the first view a simple select dropdown Fieldtype. But what is different? Rather than the option field in the modul settings you will find some setting fields to define a source (datatable or field) from where you can pull the options (value and label). I found this very useful when I had to put 250 options in a select field (which I provide in frontend too) and needed this connected and congruent to another more complex table. So now I can make changes in the main table and the select field will take over these changes. You can define the following in the settings: datatable tablecolumn for (value) should be integer tablecolumn for (label) dependance (value or label) order ascending or descending Here we go: https://github.com/k...electExtOption/ (updated 10.03.15 Version 1.0.2 with Multiselect Option) (updated 11.03.15 Version 1.0.3 with Select Inputfields in Settings)
    4 points
  5. Well the easiest way seems to simply use an else if: if ($item->price1) { echo "From euros {$item->price1}"; } else if ($item->price2) { echo "From euros {$item->price2}"; } else { echo 'please ask'; }
    2 points
  6. You can also use the following hook (inside a module): public function ready() { if (!$this->user->isSuperUser()) $this->addHookAfter('ProcessPageEdit::buildFormSettings', function($event) { $wrapper = $event->return; $pageName = $wrapper->get('_pw_page_name'); $event->return = $wrapper->remove($pageName); }); } As written, the module allows only a superuser to change the name, but using a custom permission would probably make more sense, e.g., if (!$user->hasPermission('page-edit-name')) { ... }
    2 points
  7. I think PageRenameOptions should be able to help you out - just use the "Prevent Manual Changes" option. Or, you could make use of Martijn's AdminCustomFiles to insert this JS (which is what PageRenameOptions uses): $(document).ready(function() { $('.InputfieldPageName input').attr("readonly", "readonly"); }); You would attach it to: ProcessPageEdit
    2 points
  8. Did you try OR groups? (project=1024), (project="") Also your error suggests, that it's doesn't have to be a problem with the selector itself. Does it work with just the id?
    2 points
  9. Very cool - definitely has some similarities with: https://processwire.com/talk/topic/8803-module-fieldtypeselectrelation/ but the ability to draw from any type of DB table is super cool and really flexible - I love it and can see several uses for it already Any thoughts of making it support ASM multiselect? This could then replace http://modules.processwire.com/modules/fieldtype-templates/ and https://processwire.com/talk/topic/9167-create-a-field-for-selecting-fields/?p=88679
    2 points
  10. Just checked in a first beta version of a new module I'm working on. Feel free to test out and see what's up with it. Pollino (beta) A simple poll module for ProcessWire This module makes it simple to setup polls for your website. It is based on a simple page setup to create the polls. So each poll is a page, and its children are the answers. Pollino will create the templates and a PollinoPolls page in the root to start with. You can add fields to the templates as you wish and later use hooks to modify the output of the poll. This can be useful, for example, to use images as options or just some custom markup etc. It provides some API to render the poll form and the result. These methods are hookable and it's easy to customize the output if needed. It can be rendered on any page and even multiple on the same page. Pollino takes care of saving the votes and preventing multiple votes. It comes with some configuration settings to choose what method to use to prevent from multiple votings: using cookie and an expire time or by IP and optionally also the UserAgent with and expire time or by logged in User Pollino isn't 100% plug'n'play but it provides a solid foundation and comes with some premade theme and output for you to start. It takes care of the boring stuff and lets you concentrate on the front-end stuff and styling. That's what matters after all. It does support multilanguage, as all strings are translatable in the module. Also since it's using simple pages and templates you're free to add or change fields to make its output multilanguage without much hassle. ----- Read more and download https://github.com/somatonic/Pollino Online Demo I setup a little demo here to see using https://lightning.pw http://titanium-x77.lightningpw.com/ Have fun.
    1 point
  11. I'd like to resize some images on demand, that are not page images, so they are not attached to a page. How to use the ImageSizer class? I could browse through the code but perhaps someone who used this, could provide some lines of example code. I basically want to pass the image path and cropping options. Are the cropped images saved somewhere if they are not page images, or will the cropping be executed every time? Thanks!
    1 point
  12. Hi, Thx for the feedback. It's a first version. For now it is a very basic solution. If you buy a product, then it's go to the external PayPal cart-option and there you can select the quantity. It's not the best solution, but it works Yes, its very simple making a shopping-cart only with PayPal. In PayPal you can generate a button and then customizing the html. Its very easy. Here you see the customized PayPal-button code: <?php foreach($products as $product) { ... echo "<form class='buy-button' target='paypal' action='https://www.paypal.com/cgi-bin/webscr' method='post'>"; echo "<input type='hidden' name='cmd' value='_cart'>"; echo "<input type='hidden' name='business' value='your@mail.com'>"; echo "<input type='hidden' name='lc' value='BE'>"; echo "<input type='hidden' name='item_name' value='{$product->title}'>"; echo "<input type='hidden' name='item_number' value='{$product->art_nr}'>"; echo "<input type='hidden' name='amount' value='{$product->art_price}'>"; echo "<input type='hidden' name='currency_code' value='EUR'>"; echo "<input type='hidden' name='button_subtype' value='products'>"; echo "<input type='hidden' name='add' value='1'>"; echo "<input type='hidden' name='bn' value='PP-ShopCartBF:btn_cart_LG.gif:NonHosted'>"; echo "<button type='submit' class='btn btn-primary' name='submit'><i class='fa fa-shopping-cart'></i> Nu kopen!</button>"; ... }; I know some pages are not completed, this is work for the client, also the 'hidden' product in the 'Andere' catagory. I sayed him, but for the moment he have no time in the next days for complete the contents on the pages. Next weekend I go to the client and gives him some support, and help him a little how to add, edit or remove pages/products. In a next version I developing a internal cart solution. I want to try this with the shop-module, but this have now mail support In the next weeks I try developing a mail-function that send a mail to the administrator and the customer if the cart submitted. I hope you understand my bad english Regards, Christophe
    1 point
  13. hey quickjeff - maybe you could post your final code, to see how it was adjust for the use case? cheers!
    1 point
  14. Oooooh, I love this moment when you first think about the possible structure of a website, and all the great things you can do with it, it's awesome My take on a possible structure could be: Home -- My Program (only accessible to logged in users) ---- Video 1 (video template with a video_file field to store the video) ---- Video 2 ---- Video 3 ---- ... -- About -- Contact You can create a page field called selected_videos, that links to the video template, and that you add to the user template (Setup>Templates>Filters>Show system templates) so that the coach can select the videos he suggests for each user. Then at the beginning of the video template, you can have some code like this to make sure that a user can only see the selected videos: (Edit: I made a typo, so I corrected from $user->has to $user->is) if (!$user->is("selected_videos=$page")) $session->redirect($page->parent->url); To embed your video, here are some resources: https://processwire.com/talk/topic/4580-video-fieldtype/ https://processwire.com/talk/topic/7380-whats-your-favourite-video-embedder-and-why/ https://processwire.com/talk/topic/4956-addinguploading-audiovideo-files-to-pages-media-manager/?p=48085 https://processwire.com/talk/topic/4956-addinguploading-audiovideo-files-to-pages-media-manager/?p=48126 You might also be able to use the Comments Fieldtype and the Comments Manager (with recent updates here, here and here) so that clients can add some comments to the video and encourage each other. Anyway, take these suggestions as you wish. I just love thinking about how to structure a site
    1 point
  15. You can always just store the values to variable and see if it's filled. Also, note that PW provides a native way (shortcut, really) for getting the first non-empty field value: $item->get("field1|field2|field3") etc. // like this: $price = $item->get("price1|price2"); if ($price) echo "From: € " . $price; else echo "please ask"; // this works too: $price = $item->get("price1|price2"); echo $price ? "From: € " . $price : "please ask";
    1 point
  16. Hi tuxy, Nice site! I really like the fun design, and I visited it both on my phone and my computer, and the experience is very smooth on both devices, well done! Initially, my reaction to the purchasing process was that it would be better to have a cart functionality, so that a client can add several items before buying. Then I noticed that you use PayPal as a cart solution, which makes purchasing both simple and fast. I didn't know that you could do that, it's a really useful tip, so thanks! I just wanted to mention that the "hier" link on this page doesn't lead anywhere, and that the "Privacy en Disclaimer" page is basically empty. Also, you have an "Andere" product category with a badge showing one item, but no items are visible in the category.
    1 point
  17. You should also check out Bea's new module - it is much more powerful and stable than the one I mentioned above and I think would be a great fit for your needs: https://github.com/justonestep/processwire-imageextra
    1 point
  18. @owzim: best way to understand how it works is to look into Pageimage. There you see that ImageSizer only gets a filename of an image variation and the manipulation params ($options) and that it saves the result right into that given filename. All other, (caching, renewing, etc) isn't handled by ImageSizer (but by Pageimage).
    1 point
  19. Well you could create a new Pageimage from the image path: $image = new Pageimage($page->images, "/path/to/image.jpg"); Then you could run sizer on the page image. Then delete the pageimage if you want. I think something like that should work. Either that, or just use standard GD commands.
    1 point
  20. Assuming BitPoet is correct and that is your problem, then it should work after that. Nothing wrong with doing it manually obviously, but just an FYI - there is a module for grabbing video images from YouTube/Vimeo and populating an images field, along with descriptions: https://processwire.com/talk/topic/4614-youtube-and-vimeo-thumbnail-grabber/
    1 point
  21. Looks like allow_url_fopen is disabled in your server's php settings, preventing file functions like copy or file_get_contents from working on URLs. If you can't change that setting, you could download the file manually into a temporary folder using curl and then assign the local path to the temp file (making sure the directory in $config->paths->tmp actually exists beforehand). A quick&dirty take: // ... $localPath = download_file($content->pt_embed_youtube, $config->paths->tmp); $content->pt_embed_youtube_pixel = $localPath; // ... function download_file($url, $tempdir) { $fp = $tempdir . basename(parse_url($url, PHP_URL_PATH)); $fh = fopen($fp, 'wb'); $curl = curl_init($url); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_BINARYTRANSFER, 1); curl_setopt($curl, CURLOPT_FILE, $fh); curl_exec($curl); curl_close($curl); fclose($fh); return $fp; }
    1 point
  22. 1 point
  23. Hi, Thanks for this... Do you have the project somewhere on Github? Just an observation: In your $db query, Although you are properly escaping and sanitizing values, maybe you should consider using prepared statements too?
    1 point
  24. Wow - sorry about that - very old instructions when the module had a different name - I'll update those in a minute Glad it's working for you now!
    1 point
  25. Thanks so much, DaveP and adrian! I had originally tried the instruction to "Download and place the module folder named "ProcessPageTreeMigrator" in: /site/modules/." I removed the files and installed both using "Add Module From URL..." and both installed fine. Thanks again!
    1 point
  26. Thanks! I'm trying to make the site as fun as possible (it's a non-income-generating pet project), to make it emotionally rewarding for the authors that have volunteered to provide content. I'm attaching a screen shot of the post-login home page for an author (non-superuser). Fair warning, the color scheme may hurt the eyes. I'm going for quirky here. The challenge area is the 'ticket' system I was referring to.
    1 point
  27. Looks like it should be - https://github.com/adrianbj/ProcessMigrator/blob/master/MigratorAbstract.php Have you installed the modules on a different path somehow?
    1 point
  28. It's not often I have to deal with “external” customers, but my experience is that text is a big bottleneck that is both approval and delivery. ProcessWire is the perfect CONTENT MANAGEMENT system, so I provide them all the tools to edit their content. While developing I use lorem ipsum and for images I use http://lorempixel.com/400/300/. (for example) Waiting for the customer is frustrating for you as developer and customers will blame you when their product take long to develop. I would rather finish their website quick then upload it to a 'private' place. Then the customer can content manage their own website. They are the ones who know best their product.
    1 point
  29. Normally using $this is for modules only. Inside templates you should use wire() methods you can also get the object via the $event var. wire()->addHookBefore('Session::logout', null, 'logoutNoCookie'); function logoutNoCookie(HookEvent $event) { $hookObject = $event->object; } See also http://processwire.com/apigen/class-HookEvent.html https://processwire.com/talk/topic/4701-add-hook-in-a-template/ https://processwire.com/api/hooks/#all_or_one http://www.flamingruby.com/blog/using-hooks-to-alter-default-behavior-of-processwire/ Cheers
    1 point
  30. Just committed some new features: New checkbox "Send welcome message" added to the bottom of each user page - uncheck to NOT send the email to a new user. You can use this checkobox to re-send a user's welcome email if needed. You can edit the welcome message template for each user as you create and save the user. Also some better error reporting, and detection of PasswordForceChange. Please let me know if you have any problems with this new version.
    1 point
  31. It's exactly whats written there: You've supplied credentials for your mysql database which don't let processwire authenticate. Therefore access to the database is denied. Check your username, password and databasename in site/config.php. If that doesn't help you can try using 127.0.0.1 instead of localhost.
    1 point
  32. I don´t know well how PW handles cookies and sessions. maybe this link should do the trick http://stackoverflow.com/questions/1773386/how-to-suppress-remove-php-session-cookie or this http://php.net/manual/es/function.header-remove.php
    1 point
  33. About handling the display of images from a twitter feed, I did this today by adding code inside MarkupTwitterFeed.module. I post it here in case it could help other pw users having the same needs. // To be added in public function renderItem, before: $out = $options['listItemOpen']; if (isset($item['entities']['media'])) { $mediaUrlField = wire('config')->https ? 'media_url_https' : 'media_url'; foreach($item['entities']['media'] as $m) { if($options['listItemPhoto']) { $photoHtml = str_replace(array('{src}', '{title}'), array(wire('sanitizer')->entities($m[$mediaUrlField]), wire('sanitizer')->entities($m['display_url'])), $options['listItemPhoto']); $text = preg_replace('!' . preg_quote($m['url'], '!') . '(\b|$)!i', $photoHtml, $text); } else { // Hide the media reference in the text $text = preg_replace('!' . preg_quote($m['url'], '!') . '(\b|$)!i', '', $text); } } } where $options['listItemPhoto'] contains the html for a Twitter photo. For example, if you simply want to display the image, you can set it to: $options['listItemPhoto'] = "<img src='{src}' title='{title}'>"; This will be rendered like in this screenshot:
    1 point
  34. Assuming that the structure of the fields is always the same (Question, Checkbox 1, Checkbox 2), I think that the approach depends on who defines the questions: the user (like a "create your own form" type of page) You (with a fixed set of questions that the user must answer on the page) In the first case, you could use the Profield Table, as suggested by nickie, or even simpler, a PageTable (which is not a Profield): You create a template called question, with the fields question_text (text field), question_answer (text field), display (checkbox field), include_in_email (checkbox field). Then you create a PageTable field questions, that uses this question template. Finally you add this questions field to the target template. This way, the user can add as many questions as he wishes on a page. The second case is more difficult. The "pure" way of doing it would be to create a field for each question's subquestion, i.e children_answer, children_display, children_email, pets_answer, pets_display, pets_email, etc. The problem is that this would create an enormous amount of fields, which becomes inefficient (see this post from Ryan). You could create your own compound Fieldtype to group the three subquestions in one field (see the Events Fieldtype/Inputfield as an example), but this would still require 50-80 different fields, which is a lot. I think that the approach that I would attempt is the following: Create a question template with fields question_text (text field, with visibility set to visible but not editable), answer_text (text field), display (checkbox field) and include_in_email (checkbox field). Create a questions PageTable field that uses this question template. Add the questions field to the target template (let's call it questionnaire). Write a module to hook after Pages::added, so that each time a questionnaire page is created, it adds the question pages under it. Here is an example of what I mean: // Inside a module public function init() { $this->addHookAfter("Pages::added", function($event) { // Activate the hook only if the added page is a questionnaire if ((string)$event->arguments(0)->template == "questionnaire" $this->hookAdded($event); }); } public function hookAdded($event) { $questionnaire = $event->arguments(0); // List of all your questions $questions = array( "Do you have children?", "Do you have pets?", "Do you have rabies?", // etc. ); foreach($questions as $q) { // Create a question page under the new questionnaire $p = new Page(); $p->template = "question"; $p->parent = $questionnaire; $p->question_text = $q; $p->save(); // Add the question page to the questions field of the questionnaire $questionnaire->questions->append($p); } // Save the questions field of the questionnaire $questionnaire->save("questions"); } You should also adjust the permissions for the question template so that a user can't delete them. Yet other approaches would be to create a custom Process module (see the Hello Process Module for an example), or to set up a custom front-end template to answer the questions instead of using the admin back-end.
    1 point
  35. I think that you should use addHookAfter instead of addHook to be more explicit (the hook needs to run at the end, since it needs to modify the return value). Also, while the code is correct, the logic seems inverted to me: When I give a "permission", it means that I allow more than if I had not given it. In your code, it seems that receiving the 'page-edit-created-onlyassigned' permission restricts what you can do (i.e. you can only edit your own content). It would seem more intuitive to me to have a 'page-edit-all' permission, which would allow a role to edit all content, with the default behavior being more limiting. In this case, your code would look like this: public function init() { if(!$this->user->hasRole("superuser")) $this->addHookAfter("Page::editable", $this, "checkEditable"); } public function checkEditable($event) { $page = $event->object; if (!$this->user->hasPermission('page-edit-all') && $type->created_users_id != $this->user->id) { $event->return = false; } }
    1 point
  36. Hi everybody, I'm very glad I found this topic, thank you Soma for your answer. It worked like a charm. I did run into the issue myself (while using version 2.5.3), my actions where the following: I've cloned a page (including it's children), the page itself was found in it's parent but it's children weren't. Example: 1001 = Products ----- 1002 = T-shirts ----- ------ 1003 = Small ----- ------ 1004 = Medium ----- ------ 1005 = Large Duplicate *T-shirts* and rename it *Sweaters* Tree looks like this: 1001 = Products ----- 1002 = T-shirts ----- ------ 1003 = Small ----- ------ 1004 = Medium ----- ------ 1005 = Large ----- 1006 = Sweaters ----- ------ 1007 = Small ----- ------ 1008 = Medium ----- ------ 1009 = Large find(has_parent=1001) returns: 1001,1002, 1003, 1004, 1005, 1006 The children of 1006 are missing. I hope Ryan can reproduce the issue this way.
    1 point
  37. I camped out all week in front of his store to get Form Builder. Can't wait to use it.
    1 point
  38. Check the entry $config->userAuthSalt in your site/config.php file. This hash must be identical with the one on your live site.
    1 point
  39. Pete, you have valid arguments, and I see your reasoning. However, in my opinion PW in its current state is only usable for devs and aspiring devs (people who like to put real time and effort into learning the system, AND who have the capabilities for it). Let's take myself as an example. I have been commercially building websites since 2002, and have used and tried MANY platforms, as well as hand coded HTML/CSS, etc. I do have a very basic grasp of PHP code, but only to edit simple stuff, and doing things by trial and error, and with lots of help from forum users. But I am not a coder. I regret that, I would love to have better coding skills. But I just don't have the mind for it, it's too abstract. I can try and try, but my level won't ever improve. I have tried PW for a week, spending about 30 hours with it in total. I was excited (and still am), but got frustrated in the end, because of the mismatch between my skills and capabilities, and the way current PW works. I don't want to build my own CMS, I want all basic stuff more or less ready to use, and an easy way of working with (let's call it) custom fields. PW doesn't offer what I want and what I can handle right now. So I'm working with Joomla+K2 right now. It does everything I need fairly simply, although Joomla has its fair share of user unfriendlisness too, as most of us know. But it's very powerful and flexible, and there are many addons and themes. And for me those aspects are more important right now than the promises of PW. I can imagine there are many more people like me. All people who could be potential PW users if the system would evolve a bit more into a ready to use system, besides the power it has for devs.
    1 point
  40. I am not sure about different installation profiles, as they are limiting. And PW's strength is supposed to be "unlimitedness". Most websites are general sites, that need regular pages, and news/blog, and photo galleries, contact forms, etc. So I think the PW core should offer built-in modules like that. Or they should be available as ready to use plugins. The only way a CMS will be seen as a usable system for both individuals and small businesses, is when it is a complete system. You should be able to install it, and create regular pages, news, blogs, forms, and photo pages right away. You should not have to build basic stuff like that yourself. This is the absolute basis. The added value of PW will be all the custom stuff that's possible for the more technically inclined users, and devs. Corporate use will probably need more power than that. But if you want to cater for individuals and small biz besides corporations, you will have to get the basis more user friendly and ready-to-use than the current state. However, I think PW is a very exciting product, and I have high hopes for continued development to make it more accessible, more allround ready-to-use, and more user friendly.
    1 point
  41. Imagine what would happen if PW should change into an out of the box cms with shiny templates, plug and play, 1 click add-on's, etc. etc. Everything would start to degrade right away even the forum. The inner architecture of pw is one of the clear reasons why this forum is filled with talented coders, people who know what they are doing and people who want to learn. A great side effect of working with pw and being on this forum is that it pushes less talented coders to upgrade their coding skills. This is many times the preferred way. If people need shiny templates, banners, slideshows or other things then tutorials on how to do this with pw would be the best way I think.
    1 point
  42. If you don't need the page to be saved when the button is clicked, then I think the route you are taking is fine. If you did need the page to be saved, then you'd want your button to be a submit button, and a second (save) hook to be called after the ProcessPageEdit::processInput and to silently do its thing (no redirect). Another route you could take is to setup a separate page with a template that does what you want, and then have your button link to that instead. But the way you've done it is already more compartmentalized (less parts to consider) so I wouldn't change it unless it creates issues with other modules hooking into ProcessPageEdit at some point down the road (which is possible). One issue you probably want to fix here though is the potential for XSS: $href = $this->config->urls->admin.'page/edit/?id='.$this->input->get->id.'&e=1'; Taking a variable directly from $_GET or $input->get and putting it in output (unsanitized) is always dangerous. You'd want to do this: $id = (int) $this->input->get->id; $href = $this->config->urls->admin."page/edit/?id=$id&e=1"; or better, yet this: $id = (int) $event->object->getPage()->id; $href = $this->config->urls->admin."page/edit/?id=$id&e=1";
    1 point
×
×
  • Create New...