Leaderboard
Popular Content
Showing content with the highest reputation on 01/31/2015 in all areas
-
This week's dev branch updates include a new Fieldtype (FieldtypeOptions): https://processwire.com/blog/posts/new-options-fieldtype-processwire-2.5.17/ (blog post about it) and documentation https://processwire.com/api/modules/select-options-fieldtype/11 points
-
Here is very simple abstract class that I hope would get ideas and contribution from community, so that different PW projects could use same payments methods in generic way: https://github.com/apeisa/Payment Currently Payment modules just assume it's found from /site/modules/Payment/Payment.php, but I would love to get it autoloaded somehow (I went with PW module dependencies and transformed the base class into PW module also). Also I have tried to keep this as minimum as possible - hopefully I have not left anything too important out. I have also created one two payment modules, that use this base class: https://github.com/apeisa/PaymentStripe/ https://github.com/apeisa/PaymentPaypal/ Please visit their repos for examples.5 points
-
DownloadGuard for ProcessWire About DownloadGuard This simple module was developed to give clients or users a unique download link to access file downloads you offer them. Installation & Usage 1. Place the module files in /site/modules/DownloadGuard/ 2. In your admin, click Modules > Check for new modules 3. Click "install" for __DownloadGuard__ 4. In the module Settings you can edit the default count for max downloads and the time, the download should be active. 5. During the installation a Page „Downloads“ is created in your PageTree. You can create children under this Page to make Downloads. In the children page you get your unique hash and the ability to upload your file. Todo - Let the system create the download links, for easy copy and paste. BitBucket Repository: https://bitbucket.org/m_knorr/downloadguard/overview Direct Download: https://bitbucket.org/m_knorr/downloadguard/get/master.zip5 points
-
FieldtypeFontIconPicker Supported Icon Libraries FontAwesome 4.7.0 Uikit 3.0.34 IonicIcons 2.0.1 Cahangelog NOTE: Module store data without prefix, you need to add "prefix" when you want to show your icon on front-end, because some of front-end frameworks using font-awesome with different "prefix". Module will search site/modules/**/configs/IconPicker.*.php and site/templates/IconPicker.*.php paths for FieldtypeFontIconPicker config files. All config files need to return a PHP ARRAY like examples. Example config file : create your own icon set. File location is site/configs/IconPicker.example.php <?php namespace ProcessWire; /** * IconPicker : Custom Icons */ return [ "name" => "my-custom-icons", "title" => "My Custom Icon Set", "version" => "1.0.0", "styles" => array( wire("config")->urls->templates . "dist/css/my-custom-icons.css" ), "scripts" => array( wire("config")->urls->templates . "dist/js/my-custom-icons.js" ), "categorized" => true, "attributes" => array(), "icons" => array( "brand-icons" => array( "title" => "Brand Icons", "icons" => array( "google", "facebook", "twitter", "instagram" ) ), "flag-icons" => array( "title" => "Flag Icons", "icons" => array( "tr", "gb", "us", "it", "de", "nl", "fr" ) ) ) ]; Example config file : use existing and extend it. File location is site/configs/IconPicker.altivebir.php <?php namespace ProcessWire; /** * IconPicker : Existing & Extend */ $resource = include wire("config")->paths->siteModules . "FieldtypeFontIconPicker/configs/IconPicker.uikit.php"; $url = wire("config")->urls->templates . "dist"; $resource["scripts"] = array_merge($resource["scripts"], ["{$url}/js/Altivebir.Icon.min.js"]); $resource["icons"]["flag-icons"] = [ "title" => "Flag Icons", "icons" => array("tr", "en", "fr", "us", "it", "de") ]; $resource["icons"]["brand-icons"]["icons"] = array_merge($resource["icons"]["brand-icons"]["icons"], array( "altivebir" )); return $resource; After you add your custom config file, you will see your config file on library select box. Library Title (Location Folder Name). If your library categorized and if you have categorized icons set like uikit and fontawesome libraries, you will have category limitation options per icon field or leave it empty for allow all categories (default). Example : output if ($icon = $page->get("iconField")) { echo "<i class='prefix-{$icon}' />"; } MarkupFontIconPicker Usage // MarkupFontIconPicker::render(YourIconField=string, Options=array) echo MarkupFontIconPicker::render($page->YourIconField, [ 'prefix' => 'uk-icon-', // Icon class prefix, if you have different prefix, default is : "fa fa-" 'tag' => 'span', // Icon tag default is : "i" 'class' => 'fa-lg', // If you have extra cutom classes, for example : icons sizes, Array or Sting value 'style' => 'your custom styles if you have' // Array or String Value ]); Theme support Search support Category support4 points
-
InputfieldChosenSelect This topic (https://processwire.com/talk/topic/71-categorizingtagging-content/) showed the need for a Inputfield that would provide a real tagging UI to be useable with FieldtypePage. It uses the chosen library, which can be found here http://harvesthq.github.io/chosen/. It's meant for MultiPageFields and works kinda like asmSelect, but with a different skin. Features: Inline adding of new tags, which will then generate the corresponding pages. Sortable tags. Usage Install the Module Edit your pagefield and choose InputfieldChosenSelect as inputfield. Use Enter or Tab to create new Pages with the currently typed name. Enter will fill in the tab currently selected in the dropdown. http://modules.processwire.com/modules/inputfield-chosen-select/ https://github.com/LostKobrakai/InputfieldChosenSelect4 points
-
Ryan, you have a MySQL syntax error in SelectableOptionManager.php. This prevents values from being updated. You are missing a 'space' in the sql statement on line #548 the concatenation gets mangled up resulting in this: Option 14 'New York': SQLSTATE[HY093]: Invalid parameter number: parameter was not defined The fix is simple: Change: $sql .= "WHERE fields_id=:fields_id AND option_id=:option_id"; To: $sql .= " WHERE fields_id=:fields_id AND option_id=:option_id"; I see the 'space' on line #543 but I suppose that's only for multi-language environments? I guess I am getting the above error because I am testing on a single language environment. $sql .= ", $name=:$name "; Not sure how the suggested change will affect those in multi-language environments, but am sure you will sort it out Also filed a bug report in GitHub case you miss this.3 points
-
I personally use Horst module wireMailSMTP configured with Amazon SES and a simple code + cronjob. <?php // some config variables //these two variables should match the cronjob setting. $hour_interval = 9; // interval time in hours the cronjob is working, ex.: from 14:00 to 23:00 $cron_minute = 5; // cronjob execution every tot minute. $daily_sends = ($hour_interval * 60) / $cron_minute; $max_days = 5; // for how long I want to send the newsletter in a week ? max 7 days // this variable tells me how many times I have to send the newsletter based on the previous variables. $total_sends = $daily_sends * $max_days; $total_users = $users->find("privacy_newsletter=1,roles!=1016,limit=2")->getTotal(); // this limit tells me how many users I have to select per send to complete all the newsletter in the interval I configured previously ($max_days + cronjob settings) $limit = round( $total_users / $total_sends ); /******** INIT THE MAIL **********/ $mail = wireMail(); /******** IF ALL CICLES ARE COMPLETED RESET THE MAIL SENT LOG **********/ // 'cicles' field is an integer incremented every newsletter send if($page->cicles >= $total_sends){ $mail->sentLogReset(); // reset cicles variables $page->of(false); $page->cicles = 0; $page->save(); $page->of(true); } /******** SET THE START FOR USER SELECTION **********/ $start = $page->cicles * $limit; /******** USER SELECTION **********/ $members = $users->find("privacy_newsletter=1,roles!=1016,sort=created,start=$start,limit=$limit"); $to = $members->explode('email'); $mail->to($to); /******** SET THE NEWSLETTER CONTENT **********/ $mail->subject("LATEST NEWS"); $mail->bodyHTML($page->newsletter->last()->bodyhtml); // 'newsletter' field is s repeater with just a textarea field, the current newsletter is the latest item of the page. /******** SEND NEWSLETTER **********/ $numSent = $mail->sendBulk(true)->useSentLog(true)->send(); $page->of(false); $page->cicles++; $page->save(); $page->of(true); I just created a page with this template and call the url from cronjob. I'm still optimizing some steps but right now it's working well . Next step is create the cronjob directly from php using some libraries i'm studying so I don't have to check my variables and the cronjob. I send 2-3k mails per day and using Amazon is really cheap compared to other systems.3 points
-
A few weeks back, I had a little inspiration to design a new admin theme. The idea was to take several different themes, and merge them into one. Specifically, this little unfinished concept is a mix between the default admin theme (only in terms of layout), Reno, and a little bit of the theme that OroCRM/OroPlatform uses (called OroUi), where one would have a pin-bar at the top for frequently accessed pages. It's only an idea - no plans to create the theme at this point, considering I have no idea where to even begin (I'm sure it's not that difficult, though). What do you think?2 points
-
It would be nice to have those features and I would second your proposal of standardized language names. It's just consistent.2 points
-
2 points
-
Hi Martin, Thanks very much for this - looks very useful! Just having a look through it now. The first thing I noticed is the htaccess rules. You will need to add support for apache 2.4+ which means that: order allow,deny deny from all no longer works. Instead you need: Require all denied but of course you need to support older versions, so you will need to detect the apache version: http://php.net/manual/en/function.apache-get-version.php As for testing it, I am currently getting a 404 for this: http://pwtest.dev/downloads/hash/aa3033f10280fc120dbec5f3877dbcfa54ccd4d1ba5e7 I checked this link: http://pwtest.dev/downloads/test/aa3033f10280fc120dbec5f3877dbcfa54ccd4d1ba5e7 where "test" is the name of the child page under Downloads that I created. This wants to work, but first I needed to change this line: $max->save(); to: $max->save("dg_downloads"); because I was getting a "Call $page->setOutputFormatting(false) before getting/setting values that will be modified and saved" error, although not actually sure since you were already doing this. Anyway, saving just the field works fine!2 points
-
This is something that I am sure horst will follow up on, but as far as I know, the only thing you need to do (or can do), is to make sure the filename matches the conventions for variations: https://github.com/ryancramerdesign/ProcessWire/blob/7b9730d43e6eda8bd27841a4811a1b9737bfe903/wire/core/Pageimage.php#L484 If you need a different filename format that isn't automatically detected by the core isVariation() method that I pointed to above, you can hook it and modify like I have done here: https://github.com/adrianbj/ImageRasterizer/blob/master/ImageRasterizer.module#L243 Hope that helps until our image expert sees this!2 points
-
This rewrite should work for IIS <configuration> <system.webServer> <rewrite> <rules> <rule name="CLEAN URLS" stopProcessing="true"> <match url="^(.*)$" ignoreCase="false" /> <conditions logicalGrouping="MatchAll"> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/> </conditions> <action type="Rewrite" url="index.php?it={R:1}" appendQueryString="true" /> </rule> </rules> </rewrite> </system.webServer> </configuration>2 points
-
As for IIS, many larger companies do ask for it, especially with their IT teams being "Microsoft Certified". Thankfully, newer versions of IIS are a lot more friendly with websites not built on ASP.NET. Personally i'd prefer to use NGINX with HHVM (php engine created by Facebook), as performance is insane.2 points
-
Exactly. It would be nice to know a) how big the need really is, and b) how much work is needed to add and maintain this. I don't have anything against IIS, but it's also very unlikely that I'll ever need it either. We've already got native support for Apache, and personally I'd like to see native support for nginx too. On my list that's much higher than IIS. .. although I did specifically make the Changelog module IIS compatible, so who am I to speak2 points
-
owzim, I can't believe this exists, and that I missed it before now! I though, "Hmm, let me see if anyone has anything out there about using YAML with ProcessWire". ….and lo and behold, I find this awesomeness. Much appreciated.2 points
-
Jumplinks for ProcessWire Latest Release: 1.5.63 Composer: rockett/jumplinks ⚠️ NEW MAINTAINER NEEDED: Jumplinks is in need of a new maintainer, as I’m simply unable to commit to continued development. Jumplinks is an enhanced version of the original ProcessRedirects by Antti Peisa. The Process module manages your permanent and temporary redirects (we'll call these "jumplinks" from now on, unless in reference to redirects from another module), useful for when you're migrating over to ProcessWire from another system/platform. Each jumplink supports wildcards, shortening the time needed to create them. Unlike similar modules for other platforms, wildcards in Jumplinks are much easier to work with, as Regular Expressions are not fully exposed. Instead, parameters wrapped in curly braces are used - these are described in the documentation. As of version 1.5.0, Jumplinks requires at least ProcessWire 2.6.1 to run. Documentation View on GitLab Download via the Modules Directory Read the docs Features The most prominent features include: Basic jumplinks (from one fixed route to another) Parameter-based wildcards with "Smart" equivalents Mapping Collections (for converting ID-based routes to their named-equivalents without the need to create multiple jumplinks) Destination Selectors (for finding and redirecting to pages containing legacy location information) Timed Activation (activate and/or deactivate jumplinks at specific times) 404-Monitor (for creating jumplinks based on 404 hits) Additionally, the following features may come in handy: Stale jumplink management Legacy domain support for slow migrations An importer (from CSV or ProcessRedirects) Open Source Jumplinks is an open-source project, and is free to use. In fact, Jumplinks will always be open-source, and will always remain free to use. Forever. If you would like to support the development of Jumplinks, please consider making a small donation via PayPal.1 point
-
I wish there was support for progressive JPEG. To control it, set it in the imageSizerOptions array.1 point
-
I think both can be achieved: free-form language names and using language specific language packs for modules. There are certain benefits in not forcing only natural languages - I have used language support for client specific modifications for otherwise shared documentation for example. I think the flow should be something along these lines: When creating new language, UI recommends choosing real language from list (BCP47) or adding custom language name Modules could ship their translations in /lang/xx-xx/ format and if there is match with xx-xx and any languages already found, those languages would be automatically applied for module. There we would have both: convention (using standard languages) and flexibility (using languages for different use cases).1 point
-
I think it's a good idea too. ProcessWire currently has one of the best multi language support I've seen, but there is room for improvement that I'd like to see too. For example: I've submit a feature request/proposition to support UTF8MB4 in the database by default (would add support for emoticons). There is already some support for this, but by default the SQL loaded to create the basic pages needs to be changed manually. One other thing that might be nice, is instead of letting language name be free-form, we could stick to BCP47 (validator — registry). As an added bonus, we could package language packs for modules or else in a /lang/xx[-xx] format, instead of having to constantly install them manually. It would also make it possible for PW to set setlocale() by itself, without having to add it manually. Default could have a way to set an alias, so that at runtime the language functions would recognize "en" and "default" as the same, for example. This would also be necessary for the second proposition. What are your thoughts on this guys/gals? I think Ryan would probably be glad to receive a patch for this if it's of good enough quality, this could be a community effort. Should we open a new topic to discuss all that?1 point
-
When you put a page field inside a repeater, the $page variable that field gets is the page you’re editing. Not the repeater page the field actually belongs to. Put another way, the $page variable will be the same as $repeateritem->getForPage(). What you want, however, is $repeateritem itself. Honestly, I doubt this is possible out of the box. Like you said, if you used “real” pages in a PageTable field, you would edit those pages in a modal window. I. e. the $page variable supplied to the page field’s custom select code would be the current PageTable item. I don’t want to be the guy who misses the point and answers “why don’t you just do something else”, but PageTables are so much cooler than repeaters anyway. Any specific problems that stop you from using those?1 point
-
Well I think it's better to leave the file name visible. Otherwise you may not know which file you are working on currently... But I think I'll add this option (your second point)1 point
-
I did the template change. But I forgot to deinstall the php templates in the site/templates folder. So currently you have to update them manually or just delete them before you install the module. Because it checks if there are already these files. And if so, it wont copy them over. And you are right, I have to look into the naming of the downloaded files to make it a better UX for the enduser. Best regards.1 point
-
Google Analytics isn't real time AFAIK. However, there is a real time feature in there. Load up your site and check if your own session is showing on your RealTime dashboard. BTW, your site checks out fine on http://www.gachecker.com/1 point
-
Hey Guys, this is my first module and I hope, someone else has a use for it. It generates a .htaccess file at the assets/files/$id folder when a file is uploaded and generates a unique hash for each download. This is the content of the created htaccess with the changed filename. <Files "$yourfilename"> Order Allow,Deny Deny from all </Files> Some styling and changed etc. can be done in the installed dg_ template files. I changed the mechanics a bit, so i think that the dg_download.php could be deleted for the next release. You can access all Downloads you created through your unique file id. For example: http://example.com/downloads/hash/6ffbb022729a7e0f41cf74c28092731454c953655a884/ change the part behind the /hash/ to your unique file hash. If someone has some additions or somethings isn't working please reply. I'm looking forward to your feedback. I need it, because it's my first module! Best regard, Martin1 point
-
I finally solved using ->filter instead of ->slice like so $limit = 10; $start = ( $input->pageNum - 1 ) * $limit; $notys = $user->notifications->filter("start=$start,limit=$limit,sort=-created");1 point
-
More elegant way to fix this is simply remove wire document root assumption and expect real DOCUMENT_ROOT to be replaced with Minify_CSS_UriRewriter::rewrite() method. So simply: Line 590: $_css_src = (!empty($_css_src)) ? Minify_CSS_UriRewriter::rewrite($_css_src, dirname($stylesheet['absolute_path']),wire('config')->paths->root) : $_css_src; To: $_css_src = (!empty($_css_src)) ? Minify_CSS_UriRewriter::rewrite($_css_src, dirname($stylesheet['absolute_path'])) : $_css_src; Fixes this issue, and all URL rewrites are done from DOCUMENT_ROOT instead of wire root1 point
-
>> Inline adding of new tabs, which will then generate the corresponding pages. Should be "new tags" ?1 point
-
I see this approach is also loosely based on my GitHub Login "fork" of apeisas FB module Can you debug what is returned from... $ghUserData = json_decode(file_get_contents($access_url, false, $context)); ...and if $ghUserData contains the Google Mail address in the first place? That was the approach, to get a value (above its the GitHub Id) from the JSON and persist it on a certain user as a field value. Theoretically this should work as well with the email, which would then become $u->email. Also, this... // Add stream context $options = array('http' => array('user_agent'=> $_SERVER['HTTP_USER_AGENT'])); $context = stream_context_create($options); ...was somehow necessary for GH, but not in apeisas original module. It's quite interesting how often apeisas module appeared here lately. Screams for a generic OAuth2 module, doesn't it? // edit: It seems that the "grabs first user, changes their password, logs them in" phenomenon has its cause here: public function processLogin($ghUserData) { $id = $ghUserData->id; // (1) $u = $this->users->get("google_id=$id"); // (2) // First we create random pass to use in login $uniqid = uniqid(); $pass = sha1($uniqid . $id . $ghUserData->updated_at); // User has logged in earlier with Google id, great news let's login if ($u->id) { // (3) $u->of(false); $u->pass = $pass; // (4) $u->addRole(self::name); $u->save(); } Assumptions: (1) is empty/null (2) possibly translates as ->get() = ->first(), so returns first user (3) this is true, but the wrong user id (4) overwrite first users password // edit2: Your thread got me tweaking my GitHub Login module a little bit. I learned that I can only retrieve the (GitHub) user's email if its set to 'public'. Maybe thats similar in Google's API - either you aren't able to get the email at all, or it has to explicitly set as public. However, I think you have to solve said "phnomenon" first.1 point
-
Importing and exporting both appear to be working perfectly. Thank you for providing such a great module and excellent support for it. It still amazes me how helpful the staff, moderators and other forum members are around here.1 point
-
@KaMeKuN - today's dev commits from Ryan provide a new fieldtype that supports select options with multilanguage support without relying on pages - perhaps you would prefer this approach. Have a read about it here: https://processwire.com/api/modules/select-options-fieldtype/#multi-language-translating-options1 point
-
1 point
-
I understand your point, and I understand that you don't see a point to visual rules in frameworks. That doesn't mean that there isn't a point though. There are standard principles of color use, color combinations, contrast, typography, font matching, spacing, and composition that, when incorporated into frameworks, can save the discerning designer a lot of time and effort. It's ok that individuals may not value these things, but there are a lot of people who do. I do agree with you that frameworks are not plug-and-play in terms of 'look and feel' - but then they are not meant to be. It's fine with me if there is a visual style in place that I change for every site. *slaps forehead* Oh, I see! Yes, agreed. These tools are really better for people with good front end coding knowledge to start with.1 point
-
I'm using dev all the time it's stable most of the time. Nevertheless when I find bugs i feel responsible to report them.1 point
-
Hey - Glad you're getting there. No worries. The forums are full of helpful PW users. If you've any probs in the future, just shout.1 point
-
This is Joss' territory, so I am sure he will chime in with why Page fields are perfect for this, but until he does .... I'll say it - page fields are perfect for this Seriously though, they handle the multilanguage side of things and have so many other advantages. Remember that a page is just a row in a DB table which is how this would be set up in most other systems anyways - I think it is just the "page" tree structure in the admin that makes people think it is more resource intensive or something? If you are worried about your users see the page tree with 30 children, just make it a child of a hidden settings page or something else like that. If that is not sufficient, which it really should be, you can even hide the page (and its children) completely from your editor users using this draft module: https://processwire.com/talk/topic/1176-hiding-uneditable-pages-from-users/?p=849161 point
-
I’m in the process of rebuilding what I started almost 3 years ago, a social network using PW. Since 2012 many things are changed in PW core so I decided now to rewrite everything with different approach. Since I have a tight deadline I need help in developing some modules. Right now I need: Media uploader module, a front end image/video uploader and editing interface with these features: - Multiple upload via input file and drag and drop interface - Support for mobile devices (access to phone/tablet media library) - Option to store files into PW assets or external disk like Amazon S3 - Resize and watermark on the fly before save the final image - For Video, send file to encoding.com and manage all the workflow - General validation, both server and user side (jquery) Inside the social, a media content (image or video) is a PW page and not a direct file, with a series of specific fields. Therefore an image is a page with some fields, the most relevants are: - title - description - image, the file field composed of two files, the image and a copy of it, with mosaic effect, for guest users there are other fields not relevant for the module… The workflow is like so: Picture: - the user uploads one or more pictures - the interface shows the progress - the files are temporary uploaded in a secure directory - a page is created, each per picture, with a temporary name - the files, resized and watermarked are saved into the respective pages or into amazon s3 bucket (maybe can be a parameter the admin can choose inside the module option) - temp files are deleted - photo pages are saved with unpublished status because each photo needs at least a title. - the user is redirect to the “edit photos” page where he can sees the list of unpublished photos which need at least the title to be published. - the user can click a thumbnail and go into a page with a simple form, with a photo preview and some fields he can fill, only the title is mandatory for publication. - the other fields are saved normally into the picture page. In case files are uploaded into amazon there should be the possibility to access to the files, later inside any templates, with similar pw api and resize functions, (p$age->image->size / $page->image->url) creating the versions into pw assets and leave the original big image into amazon. Video: same as the picture with the only difference the video file is not saved into the PW assets directory but into amazon s3 bucket, not optional. only the thumbnails are saved into the pw assets. The encoding of the video (save in two different formats, for desktop and mobile, watermark and thumbnails creation) is processed by encoding.com via api and cUrl functions After files upload the user is redirect into the “edit video” page where he can sees a default thumbnail for each video is in the encoding process with a label (encoding in process). When the encoding is finished, encoding.com send a callback to a specific url, the module saves the thumbnails into the video page, links the amazon s3 video and the user can now publish the video adding at least the title into a form similar to the one for the photos. I also have a licence for http://fineuploader.com/ i think is very good for this and I already used it for the previous version, he supports upload into amazon buckets as well. I think this is pretty much everything, maybe something can be different and I’m open to suggestion for the workflow of course My budget for this module is 400 eur. If someone is interested please contact me via forum or via email at complementaryart [at] gmail.com Thanks1 point
-
Hi Nico, This looks great module and works perfectly. Some suggestions / ideas: 1) file name could be hidden by default 2) option to define ignore list for files / folders Even without those it's great, my 2 cents Cheers1 point
-
Hi there, @jacknails! This thread over here might be worth checking out. Same subject, different name. Currently ProcessWire roughly follows the URI spec (RFC 3986), while what you're describing would require support for the IRI spec (RFC 3987). +1 for this from me, though it doesn't seem to be very common need yet. This is probably the third time or so I've seen it asked for. Once there's enough need for it, I'm sure Ryan will take it into more serious consideration.1 point
-
Check for "Strip Tags" option on the Input tab in your field. upd: sorry, I'm wrong here, strip tags will remove BR completely. It is looks like you choose HTML Entity Encoder in Text Formatters and it replace <br> with <br>1 point
-
Ask and you shall receive! Check out today's dev commits https://github.com/ryancramerdesign/ProcessWire/commits/dev "Add Adrian's ProcessTemplateFieldCreator for quick access to create new fields in ProcessTemplate."1 point
-
Getting closer to the release: please all you that are interested, subscribe into PadLoper newsletter to get early access invite and discount: http://www.padloper.pw/1 point
-
Ryan, The new @ option in selectors saved me today. Just wanted to say thanks.1 point
-
Resurrecting this slightly, but I did something along these lines just now with help from this thread (actually approached it netcarver's suggested way from the first post). It's one where I wanted to skip the first page of adding a name (for events in a calendar) but didn't want to use a repeater - which would achieve the same, but I wanted separate pages. Code as follows: In init function: $this->pages->addHookBefore('ProcessPageAdd::execute', $this, 'generateName'); The function that does the work (specific to my case): public function generateName() { if ($this->input->get->parent_id == 1019) { // 1019 = some page where we want to auto-generate child page names $page = new Page(); $page->parent = $this->input->get->parent_id; $page->name = $this->pages->get($this->input->get->parent_id)->count()+1; $page->template = 'child-template-name'; $page->addStatus(Page::statusUnpublished); $page->save(); $this->session->redirect("../edit/?id=$page"); } } So it checks we're creating a page under a certain parent, sets the right template, creates a page using an integer as the name based on the count of pages under the parent page and then takes you to the edit form for that page. The beauty of it is that since there has been no title entered so far, the user has to fill out the page fields - well title at least - to continue. So why did I do something so convoluted here? Because for what I'm using the title field for I needed to allow duplicate titles, so different names is key to this. The individual pages themselves will never be visited - they're just being pulled into a table into the parent page. Of course I could have used repeaters, but on this occasion I didn't want to. I think that with a little work, and the addition of multiple config lines like in my ProcessEmailToPage module you could expand this to monitor certain parent pages, hook into new page creation and create the page with a specific child template nice and neatly instead of hardcoding it as above. When I get time I might just do that... which might not be any time soon For now the above code works though for anyone wanting to adapt it to do something similar.1 point
-
I use Mailchimp for newsletters. As Apeisa said, when using the API, confirmation mails are not necessary. I save the users in PW and sync them to Mailchimp. This is the piece of code I use: <?php /** This Example shows how to run a Batch Subscribe on a List using the MCAPI.php class and do some basic error checking or handle the return values. **/ require_once 'libs/mailchimp/MCAPI.class.php'; require_once 'libs/mailchimp/config.inc.php'; //contains apikey $api = new MCAPI($apikey); foreach ($page->children as $subscriber) { $name = $subscriber->title; $email = $subscriber->visitor_email; $batch[] = array('EMAIL'=>$email, 'NAME'=>$name); } $optin = false; //no, don't send optin emails $up_exist = true; // yes, update currently subscribed users $replace_int = false; // no, add interest, don't replace $vals = $api->listBatchSubscribe($listId,$batch,$optin, $up_exist, $replace_int); if ($api->errorCode){ echo "Batch Subscribe failed!\n"; echo "code:".$api->errorCode."\n"; echo "msg :".$api->errorMessage."\n"; } else { echo "added: ".$vals['add_count']."\n"; echo "updated: ".$vals['update_count']."\n"; echo "errors: ".$vals['error_count']."\n"; foreach($vals['errors'] as $val){ echo $val['email_address']. " failed\n"; echo "code:".$val['code']."\n"; echo "msg :".$val['message']."\n"; }} ?>1 point