Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 07/20/2017 in all areas

  1. Update: Menu Builder Version 0.1.9. Changelog Added support for multi-lingual menu items (both PW pages and custom ones)! Thanks @Michael van Laar for 'reminder'. Note Multilingual feature only applies to multi-lingual sites. You have to choose the languages you want for your menu items (in menu settings). Multi-lingual feature only applies to menu items. This means menu titles themselves remain as normal. The feature only applies to menu item title and URL If other language's item title or URL are left empty, in the frontend, these fallback to default language's title or URL respectively. This means, for other languages, you can have, for example, a German menu title but leave the German URL blank. In that case, assuming the default language is English, the German menu item will get the English URL. Currently available in dev branch only. Please test and let me know, thanks. Screenshots Backend Frontend
    3 points
  2. I thought about mediumtext but don't know what "unwanted" effect it may have on other PW functions. I went the even more simple way and import now to a single import page, and then move the imported pages with your great AdminActions to their destination parents. This way I don't have to configure all parent pages with my fieldpairings. BTW... thank you very much for AdminActions. Without Move and Search and Replace this project wouldn't be possible.
    3 points
  3. This is a simple enough use-case but was a good reminder (to me) of how PW can be used for simple stuff. A client rang me with a small but irritating problem. Every member of their staff have slightly different email signatures and it looks unprofessional. Even their clients had mentioned it. Initially I said I'd look into creating a few dreamweaver html templates or seeing what 3rd party signature solutions are available. The problem though is they're not a technical bunch and asking them to edit html etc is out of the question. The solution needs to be super simple for them. After a few hours looking at some solutions I realised I can do this very effectively with PW. It has such as nice UI and they'll be able to self manage most of it My plan is to set up a couple of fields: name (page title), email, telephone, Linkedin etc etc Give the client access to create new pages (staff) Allow client to create new pages (staff members) based on a simple HTML template Use PW's "add new" button to auto save pages into a parent folder called Sigs and we're done! I probably need to look at a way to produce inline css as this is eventually integrated into Outlook A foolproof way to display the actual HTML too (instead of view-source) would be great as I imagine they will need to copy and paste the actual html. I know it's hardly a technical masterclass but it's an interesting little job perfectly suited to PW.
    2 points
  4. Maybe this gives you ideas: http://foundation.zurb.com/emails/inliner-v2.html
    2 points
  5. Children are sorted by sidebar?! What kind of PW sorcery is this? Glad you got it sorted, and welcome to the forum @csaba
    2 points
  6. Hi @bernhard. Sorry been caught up in other stuff. I will implement your suggestion, albeit slightly differently. Thanks for the docs suggestions as well.
    2 points
  7. HELLO! I've been working on a user messaging module which I am nearly ready to release as version 1. Currently I have the below functionality and I'm looking for feedback to what other things may be useful for people looking to add user to user messaging on their sites. compose message to one or more users known to PW js to enable tag based UI display of user names input on compose message form display all message threads with reply forms reply to message thread displaying each user name by each message in the thread display "unread" when a thread has new content that hasnt been seen by current user delete or unpublish message thread (configurable) display total message thread count display total unread threads (threads that have new replies that the current user has not seen) delete all message threads and associated data (not meant for the users to have access to) road map send email to user on new message to a thread they are included in
    1 point
  8. Hi guys, I almost feel like a grown up, now that I'm messing with creating modules. I'm trying to do something that, when a page is saved in the admin, detects certain changes and reacts accordingly. Example: Say an orderState field for... an order's state. And when the admin changes that state to something else, I want to fire an alert email to the client. So I started from this example and I'm working my way up from there. It's working fine, but now I need to know how to add a hook that gives me the page as it was before saving. I tried `...addHookBefore("save"...` and `...addHookBefore("saveReady"...`, but both give me the page after the changes. I'm sure it's super simple and I'm going to say "of course" once someone points me to the obvious solution that's right in front of me, but for now all I can do is bang my head against the wall and thank you in advance for your much appreciated help.
    1 point
  9. @robinc, check out this module code in a Gist by @adrian: https://gist.github.com/adrianbj/2b3b6b40f64a816d397f
    1 point
  10. Interesting solution. On my local/dev setup I use Symlinks as I need to easily test my modules in different PW installs.
    1 point
  11. I had a thing with signatures as well. Outlook is really picky though, and so everything would need to be formatted properly. Image DPIs also need to be considered, as, in Outlook, 72ppi and 96ppi are two vastly different things. Outlook prefers 96ppi, otherwise the image is enlarged for some reason. I once wrote an app for this, where a template was created using Outlook, and signatures were created based on the template. The app then compiled the signature in HTML, RTF, and plain text (using a different template created in, well, plain text). The signature was then installed automatically, and the user simply had to select the signature for the account in Mail Options -- done! The app has since been destroyed, though, as it didn't work on around half of the enviros it needed to, and it was no longer a viable option. The generating signatures part was good though.
    1 point
  12. Valitron\Validator::addRule('notSubscribed', function($field, $value, array $params, array $fields) { return !isSubscribed($value, $params['listID'], wire('config')->mailchimp->apiKey) }, 'Everything you do is wrong. You fail.'); Like this somewhere before your validations?
    1 point
  13. @szabesz not what i intended, but probably not a long shot to create a mini module using the messaging but in the admin to be viewed by all users with the permissions. will look into it after I've published the main messaging module. Thanks
    1 point
  14. It was set to 'No', but I've changed it to 'Yes'. Now I get the error on login as well. Having said that, the site (it is an intranet so every user has to be logged in) uses LoginPersist, so I have to log out intentionally in order to need to log in.
    1 point
  15. Well, I'd better show an example, I guess. Something like this: http://www.theblog.ca/wordpress-post-notes On the WP dashboard there is a "collaboration notes made by others" and underneath there is an AXAJ form to add more notes. It is like a simple message board when used with this simple setup. This WP plugin has more to it than a "global" message board, but I've never tried those features. Most of the time a simple FB like flow of conversation is enough when only a few editors are using a site. Maybe your module is not about such a feature?
    1 point
  16. Thanks guys! I used Batcher before, but I really have to have a closer look at Adrian's module.
    1 point
  17. @szabesz Thanks, not sure I understand fully you requirements, like a "message the site admin" area?
    1 point
  18. thank you @szabesz i'll comment this there
    1 point
  19. Maybe related: https://github.com/processwire/processwire-issues/issues/319 There seems to be some mayor issue with setAndSave().
    1 point
  20. Hi @szabesz. Of course! I could have come up with it by myself. One little addition: I had to change the comparison operator from equal (==) to identical (===) because comparing an empty string to the value zero (for unchecked) gave back true. And that is finally the reason why i can set $limit to an empty string but not force...
    1 point
  21. thank you adrian, i can confirm this behaviour! it turned out that my problem was a combination of two 1) like you mentioned the hook does not get called when called from the tracy console - that's weird and i think that's somewhat critical as it could lead to problems (not doing things that you would expect, doing things that you would not expect; and hard to see sometimes!). 2) even in the init my language hook didn't work. turned out that this works: // set all languages active automatically $wire->addHookAfter('Pages::added', function($event) { $page = $event->arguments(0); foreach ($this->wire->languages as $lang) $page->set("status$lang", 1); $page->save(); }); while this does NOT: // set all languages active automatically $wire->addHookAfter('Pages::added', function($event) { $page = $event->arguments(0); foreach ($this->wire->languages as $lang) $page->setAndSave("status$lang", 1); }); no idea what could be the reason for this #2 is somewhat offtopic. but what do you think about the tracy hook problem? do you think this problem is more related to tracy? my init.php bd('init.php'); // test tracy $wire->addHookAfter('Pages::saveReady', function($event) { $page = $event->arguments(0); bd('saveReady in init.php'); bd($page->id); }); my ready.php bd('ready.php'); // test tracy $wire->addHookAfter('Pages::saveReady', function($event) { $page = $event->arguments(0); bd('saveReady in ready.php'); bd($page->id); }); after loading: after executing the code inside the console:
    1 point
  22. Or you modify your pagenames (eg john-doe-url) then you can use the URL segment and append the "-url" to your filter. In general it is often a good idea to have all persons under one parent and do the grouping via pagefields (or select options). But maybe it's better like you did in your case. This was just my experience
    1 point
  23. Hi Csaba and welcome to ProcessWire, Can you please provide more info about the issue you are having trouble with? We need to see your actual code you are trying to use to display those links/pages so that we can help you out. Also, maybe you are modifying some existing site profile? If so, which one?
    1 point
  24. Hi, I found this piece of api code from Adrian and have modified it a bit to my needs: $np = $pages->clone($page, $parent); $np->of(false); $np->parent = $pages->get('/zundapps/'); $np->title = 'Zundapps-opbouw9'; $np->name = 'zundapps-opbouw9'; $np->save(); It's doing exactly what I want. Thanks fly out to adrian.
    1 point
  25. I downgraded to 7.0.5 and that works without issues. Thanks for the help!
    1 point
  26. There is this: If you are looking at doing more specific searches with FieldtypeComments::find() be aware of this issue.
    1 point
  27. Hi @benbyf What is "Memebers"? Jokes aside, I would love to see "shared message boards", seen by defined group members (roles), so that site editors/administrators can send/discuss important messages in order to better collaborate, say on a dashboard which loads first when logging into admin. Does your module support something like that? I cannot seem to decipher this from your description above. Thanks in advance, BTW, sounds like a nice module anyway.
    1 point
  28. .With adrians great Admin Action module
    1 point
  29. One might also find it helpful for batch changing pages and more. @adrian's great helper tool, the Admin Actions module:
    1 point
  30. Hi, Written in the browser – so please excuse my possible mistakes – but one possible solution is not to include the 'limit=$limit' part when you do not need it. Something like this function findArticles($limit, $force) { $force_str = $force === "" ? "" : "force=$force, "; //inject nothing into the selector string if force is empty $selector = "template=article, sort=-published, limit=$limit, $force_str" . trim($selector, ", "); $articles = pages($selector); return $articles; } May the force be with you, BTW
    1 point
  31. Try this from ryan regarding tracking changes and notifications.
    1 point
  32. To follow up more - I just tried this in init.php: bd('test init'); $this->addHookAfter("Pages::saved", function($event) { bd('test init inside hook'); $this->log->save('debug', 'saved hook'); }); and this in ready.php: bd('test ready'); $this->addHookAfter("Pages::saved", function($event) { bd('test ready inside hook'); $this->log->save('debug', 'saved hook'); }); and got this response when running from the console panel: So, ready.php is being called, but hooks inside it are not - weird
    1 point
  33. Hi @bernhard - I am not really sure why at the moment, but if you move your hook to init.php (instead of ready.php), it works when the code is run from Tracy's console panel. So it looks like for some reason ready.php is not being called from the ajax call that the console panel makes when running code. Does that help?
    1 point
  34. Add a password field to the album template; On the page, create a password and save; Add the form to the template; Add this code, or something similar: if($input->post->album_password) { //save on session variable so if the user reloads the page, he/she can still be logged in $session->album_password = $input->post->album_password; } if($session->album_password == $page->password) { //show content here } elseif($input->post->album_password && $session->album_password != $page->password) { $error = "Incorrect password"; //echo error }
    1 point
  35. Hi @titanium - sorry for the delay - turns out this was a new problem with the multi-language title info that was added recently. Please test the latest version and let me know if you have any further problems.
    1 point
  36. We aren't using a load balancer for this processwire.com server (just a single Amazon instance). But for the sites where we are (and running PW), there is a shell script that syncs /site/assets/ and /site/templates/, across the instances. I don't know exactly how it works, but can find out more. I know it runs every 30 minutes (cron job) and whenever a change is detected. Note that it also specifically excludes /site/assets/cache/ and /site/assets/sessions/, as those vary between the instances. Also important, is that when it comes to using the PW admin, we setup a separate hostname for that purpose (admin.domain.com) that always hits the same instance (which we call the "A" instance). This is the instance that the shell script considers the master when it comes to syncing files. That way, any changes that occur to the synced files always originate on the A instance. There is a setting in AWS that lets you lock a hostname to a specific load balanced EC2 instance. Then we keep any editing locked to that hostname by adding this to /site/templates/admin.php: if($config->httpHost != 'admin.domain.com') { $session->redirect('https://admin.domain.com/processwire/'); } And we keep non-authenticated requests out of the admin hostname by having this in the /site/templates/_init.php file ($config->prependTemplatefile setting): if($config->httpHost == 'admin.domain.com' && !$user->isLoggedin()) { $session->redirect('https://www.domain.com' . $page->url); } This ensures search engines don't get in and start indexing another copy of the site on the admin hostname.
    1 point
  37. Sounds pretty similar to what someone else was asking. You can do something like this with Page Table or Page Table Extended:
    1 point
  38. My company is hiring two full time positions that might be of interest to members of this forum as we build out our UX team. Among other things, we will be migrating a number of sites over to ProcessWire, developing a UI pattern library, and establishing a continuous improvement process for them. Lots of front end work but also some API development, PDF generation, and other fun stuff. These are multilingual sites (currently English, German, and Chinese, more languages to come) for a global company, but these positions are on site in our Cincinnati, Ohio corporate HQ. For more information, or to apply, see the following links: Web Developer http://www.michelmancareers.com/Opportunities/Americas/?gnk=job&gni=8a7880665cc36d5a015cc69d9b170b1e Digital Designer http://www.michelmancareers.com/Opportunities/Americas/?gnk=job&gni=8a7880665cc36d5a015cc69aa93008dc Thanks, Jason
    1 point
  39. Take a look: best regards mr-fan
    1 point
  40. Hi folks, My department is planning to move up to five of our employer's websites in-house and onto ProcessWire from a CMS which has not seen much development in the last few years. They're B2B magazine websites and we feel that ProcessWire would be a great fit. But there are concerns over support. I'm the only server side programmer, so what would happen were I to leave or be hit by the proverbial bus? So we're looking for some kind of insurance. Thinking along the lines of a support contract, covering maybe 2 hours of support time per month. With a commitment to become more involved should the need arise, so providing more support if needed to someone who takes over my role, or in the 'bus' type emergency, be willing to take over full support duties for a limited period of time. The 2 or so hours would be used for providing advice if I were to really get stuck. But I'm happy using the forums for help, and I've built a prototype of one of the sites without huge difficulty (go ProcessWire!), so under normal circumstances they probably won't be used. The five sites are all quite large (the prototype site has 40 templates and 95 fields), consisting of news sections, a jobs section, a business directory, reader polls and social media integration. Some of the sites allow membership for the business directory, so companies can login and manage their listing and upload press releases, via a custom dashboard (implemented as a Process module). All code will be commented and held in a git repo. We're located in the UK. Email support would be sufficient I think. If you're interested, please PM me with a rough estimate of costs for: The ~ 2 hours per month standard support. Full 'emergency' support of all 5 websites. Any one-off setup costs. And/or suggest an alternative pricing structure / proposal. Again at this stage we're just looking for a rough idea of costs and who would be available, so ballpark figures would be fine If you could also provide a link to your website please. Please let me know if you would like any further information. Thanks
    1 point
  41. Hi @kongondo, I've been getting to know this module and it's really impressive the features you've worked in and all the settings that can be customised. Just wondering about the behaviour of the MM inputfield though - currently it reloads the whole of Page Edit with each addition to the field, which is not so good if the user has made some edits to other fields but not yet saved the page. They are faced with the option of accepting the reload which would lose the other field edits, or cancelling the reload in which case their media selection is not added. Maybe you could look at how the PageTable inputfield reloads itself via AJAX when a change is made, and do something similar with the MM inputfield?
    1 point
  42. Hello tpr, thanks for your help! I got it working with this code: <script> $("#mainlogin-form").on('submit', function(e){ e.preventDefault(); $.ajax({ type: "POST", url: "<?php echo $pages->get('template=login')->url;?>", data: $("#mainlogin-form").serialize(), success: function(data){ window.location.href = "<?php echo $pages->get("template=profile")->url;?>"; } }); return false; }); </script> For all others who are interested in: First step: I prevent the page reload with e.preventDefault() - this is necessary to prevent the reload, otherwise you will not get logged in Second step: I made a Ajax request to my login template, where the form will be processed (validation stuff, login process,...) url: the url to my login page data : serialize all the form inputs that should be sent with the Ajax request. success: if all is alright then force a redirect to the profile page Best regards
    1 point
  43. I did try this and it did not work, because getById returns a PageArray, not a Page object in spite of the get part in the method name. Using something like first() on the returned result seems to give you the cashed (changed) version of the page. But there is a getOne option that managed to do the trick. So I could only get it to work like this: $oldPage = $this->wire('pages')->getById($page->id, array( 'cache' => false, // don't let it write to cache 'getFromCache' => false, // don't let it read from cache 'getOne' => true, // return a Page instead of a PageArray ));
    1 point
  44. Hi folks, I know how to get ONLY the first image from an Image field, but how to you exclude the first image? <?php foreach ($page->project_images->not()->first() as $image) : ?> Any thoughts? Sorry... just noticed slice in the cheatsheet... <?php foreach ($page->project_images->slice(1) as $image) : ?>
    1 point
  45. Great, thanks. I used explode to get the individual words from the search query and then a foreach to build the selector. $selector = ''; if($input->get->general_search) { $value = $sanitizer->selectorValue($input->get->general_search); $terms = explode(" ", $value); foreach($terms as $term) { $selector .= "title|author|source|keywords|bibliography_type%=$term, "; } $input->whitelist('general_search', $value); }
    1 point
  46. I found this very useful when dealing with my dev and live configurations. Paste and configure in /site/config.php $base_url = $_SERVER['SERVER_NAME']; switch ($base_url) { case "samplewebsite.dev": // LOCAL CONFIG $config->dbHost = 'localhostdb'; $config->dbName = 'processwire'; $config->dbUser = 'root'; $config->dbPass = 'PaSsWoRd'; $config->dbPort = '3306'; $config->httpHosts = array('samplewebsite.dev', 'www.samplewebsite.dev'); $config->debug = true; break; case "samplewebsite.com": // LIVE CONFIG $config->dbHost = 'livedb'; $config->dbName = 'processwire'; $config->dbUser = 'username'; $config->dbPass = 'pAsSwOrD'; $config->dbPort = '3306'; $config->httpHosts = array('samplewebsite.com', 'www.samplewebsite.com'); $config->debug = false; break; }
    1 point
  47. For any PageArray, count($pageArray) returns the number if items present now, but $pageArray->getTotal() returns the number of items total without pagination. So if you specified a "limit=n" in your selector when loading the pages, you can always call upon that $pages->getTotal() to tell you how many matched in total. There is also a $pageArray->getStart() method, which tells you the index of the first item. So if you had specified "limit=10" and you were on page2 in the pagination, then getStart() would return 10. I use these two functions to output a summary of results that tells you were you are. So if you wanted a headline that said this: You'd do something like this: $firms = $pages->find('parent=/firms/, num_staff>100, limit=10'); $start = $firms->getStart() + 1; $end = $firms->getStart() + count($firms); $total = $firms->getTotal(); echo "<h1>Firms with more than 100 staff</h1>"; echo "<h2>Showing firms $start - $end of $total</h2>"; foreach($firms as $firm) { echo "<p>{$firm->title} has {$firm->num_staff} staff</p>"; } // output the pagination links echo $firms->renderPager();
    1 point
×
×
  • Create New...