Leaderboard
Popular Content
Showing content with the highest reputation on 09/18/2016 in all areas
-
@modifiedcontent Imagine we have 3 pages : Home, Register, Member Area and 3 templates : home, register, member-area. In the template home, if the user is not logged in, the login form appear on the homepage - there is also a link to our register page, another for the member area page and the logout link. Code of home.php : In the register template, we show the registration form. First step, once the form is filled, a validation email is sent to the user. Then if the user go to his mailbox and click to the validation link, he return to our register page and submit the form with the validation token. If everything went smooth, we use a hook before the form is saved to add a role "member" to the user. Then we use a hook after the form is saved to send a confirmation email with the details (username, email, passowrd, welcome message, etc.). Code of register.php : And then in the member-area template, just show welcome message and a logout link. Nothing special here. Code of member-area.php : To test it, just create and copy paste the code of each template. FAQ: Check the hook in the register.php template above. Check the hook in the register.php template above. Read this post and ask for example/help if needed. You could do something like that : $markup = $fu->render(); $markup = str_replace('<ul', '<div', $markup); $markup = str_replace('<li', '<div', $markup); $markup = str_replace('</li>', '</div>', $markup); $markup = str_replace('</ul>', '</div>', $markup); $out .= $markup; (I am sure there is a better way to do it) You can modify the file emailValidation.php or use your own in /site/modules/FrontendUser/templates. Hope it help5 points
-
here.u go echo $pages("parent=/")->implode('<a href={url}>{title}</a> ');4 points
-
The button with the eye on the right, labelled3 points
-
I read that docs "properly", too and find out that the main magic with PW is something strange like $page and $pages and of course "selectors" hmm foreach a category...let me see where i as noob could find such things...;) https://processwire.com/api/variables/pages/ (with some foreach examples) So ok pages are something like "WireArrays" what is that im curious maybe i should read this one... https://processwire.com/api/arrays/ (even there is a foreach example) Don't get me wrong but my heart is fighting a little for every newbies....and with your posts the other newbies get a wrong view... Take a breath - take the time to experiement yourself with the API in combination with YOUR HTML of choice at start with AdminCustomPage you don't have to use MarkupModules or Core UI Elements...you are free to build what ever you want and pull the data with the PW API in your Output....and ask question nice and calm. There is no way to do things right so there is no doc that say "step 1 - step 2 - step 3 - finished" Your only get many many many options to get to your goal - you have to choose yourself All that options are not documentated only the API and the whole core codebase is there....plus tutorials....plus a real great forum with posts from 2012 thats code is today working good!!! ->plus helpfull and friendly people here that offers everyone help! If you had read throw my links and studied the code from the MarkupAdminTables you have had found things like this one: https://github.com/ryancramerdesign/ProcessWire/blob/master/wire/modules/Markup/MarkupAdminDataTable/MarkupAdminDataTable.module#L171 //for the lazy people i cp all important here... if(count($this->actions)) { $out .= "\n<p>"; foreach($this->actions as $label => $url) { $button = $this->modules->get("InputfieldButton"); $button->href = $url; $button->value = $label; $out .= $button->render(); } $out .= "\n</p>"; } Ohh i learnd that i can add action buttons to the rendering of the MarkupAdminTable module...nice and second i learnd how to create UI buttons with the Core Inputfield...from reading simple the code and don't search some documentation and the great thing in PW is i can use that Markup everywhere frontend, backend.... Documentation "teach" you nothing - documentation only describes what and how you can to do with software....like i wrote in PW you only need to learn and use the API and you can do all how you want it be done.....this is the point of the matter. There is no and i hope will never be a documentation that teach me how i have to build up my system or programm my websites and applications - this task is on my own. Since this is a forum of a free opensource software, no one has to aswer carp and claiming questions in his sparetime...there are no noobish questions in this forum - al things get sorted well with this community but always with a friendly and dedicated attitude on both sides. Sorry for my harsh words but all your post seems to be impatient and reproachful - exept i'm mislead your words. Best regards mr-fan3 points
-
Trekkerweb Supply & Demand https://markt.trekkerweb.nl/ Trekkerweb.nl brings agricultural mechanization news and supply & demand together in a single online platform for all the tractor and machine enthusiasts and others interested in the mechanization sector. The site is multi-language with English as default. None Dutch browsers will get the English version of the site, currently we are finetuning the German version which will be available somewhere in the near future. The search page in English and Dutch language - https://markt.trekkerweb.nl/search/ - https://markt.trekkerweb.nl/nl/zoeken/ Used modules Profields Table Profields Textareas MarkupLoadRSS (fetches brand related new from the main website) PageImageManipulator 2 (PIM2) (for placing watermark image) ProCache ProcessGetVideoThumbs TextformatterVideoEmbed WireMailSmtp LanguageSupport (Site is multi language: Dutch, German and Default English) Couple of custom made modules for user profiles and cross page linkage of the datamodel (Bower) components awesome-bootstrap-checkbox bootstrap-dropdowns-enhancement-sass bootstrap-sass bootstrap-select font-awesome formvalidation.io hashids jquery jquery-file-upload jquery-throttle-debounce jquery.mmenu js-cookie lifestampjs moment semantic-ui-sass verge Front-end user profiles (custom module) Account registration Customizable fields (in module settings) Per field privacy configurable (private, public, on a per user basis). Front-end login/ logout Reset password Email activation for account Request activation mail View profile Public profile Edit profile Set profile picture (cover image and avatar) Modify password Language choice Profile dashboard Front-end Ads management Create new ad Edit existing ad Manage media (images / video) Preview and approve ad Remove ad Data model Categories Subcategories Brands Input fields Options An intuitive data model drives the whole site. A couple custom made modules take care of the cross page assigning of categories to subcategories and brands. Per subcategory we are able to assign the related input fields and options which will be rendered on the 'Create new ad/ Edit ad' form page and combined with the given values rendered on the ad detail page. Database caching + Pro caching One of the challenges was to keep the whole project as low weight as possible. Since the data model with categories, subcategories, brands, inputfields and options is the backbone of the site we came up with the solution to have the names, titles, ids, and relations between them cached. Completely as json/javascript with pro cache and separated with database caching. With the Wire Fuel we made the $dm object available for accessing anywhere in PHP and globalJS.dm from within javascript. This means the whole data model is called only once per request, and while it exists in the database cache and pro-cache it is incredibly fast. Subcategory page The first image shown below represent one of the subcategories (Tractors) with assigned categories, brands, input fields and options. The image there after is a screenshot of the add ad page, where the input fields, options and brands are dynamicly rendered after being loaded via Ajax. Other features cookie based favourites cookie based last-viewed list advanced filter search related ads Thanks to the whole team (Ferdi, Bastiaan, Alex, John, Hessel) and last but not least Ryan for creating ProcessWire and all module developers out there2 points
-
Don't really know, but if your above code doesn't work, you also may try with a $p->save(); after add() and before getting the $lastimage.1 point
-
1 point
-
Thanks for the access. The field pairings option is mentioned in the first post of the BCE support thread. What is probably not clear is that because different pages / templates on your site may require different field pairings, this setting is only available from the Settings tab of pages that are set to be separately configurable from the main module settings. I have done this for you and everything is now working as expected in Update mode even without a title set in the CSV file. Now for some caveats. If you try to import a CSV file that doesn't have a title column (even in update mode) that also has more rows than there are already existing child pages, then it will throw an error because each page in PW needs a name/title. But so long as you already have a child page for each tire size, you should be fine. Otherwise, make sure the CSV has the tire size as the title for each row and that will work fine. The other thing I noticed is that the CSV file you sent me was encoded UTF16 LE with BOM and it was failing to be read. I changed it to UTF8 and it was fine. Perhaps this is something that BCE could handle better, but for now, you'll want to be aware of that. I also played around with the labels to make this more specific to your client's needs, but of course you can edit further: Please let me know how you go. PS Is there any reason you've gone with the generic "Tire" title/name for each page, rather than maybe using the size code or something else unique?1 point
-
https://processwire.com/api/ref/pagefile/description/1 point
-
Hi, with this foreach($languages as $language) { if(!$page->viewable($language)) continue; // check if page not published for this language $url = wire('page')->localUrl($language); echo "<li$class><a href='$url'>$language->title</a></li>"; } can we have switch menu not "fully" translated? Not Italian English French but Italiano English Français for all languages.. Thanks, Marco Sorry for the formatting, but seems forum has some problems with Safari and preview..1 point
-
Only the name for the default language does need to stay. The title can be freely changed to the title of the language which actually is your default.1 point
-
Vue 2.0 does have server side rendering, but it's only for node not php. One could however use processwire only as data provider and node only for rendering. One could probably implement the ssr part in php as well, but it would be a lot of duplication work. And everything, which does not share templates directly is just not maintainable for anything bigger. I'm personally using vue only for html/interface bits, which are useless without js anyways, therefore there's no need to generate it's html on the server.1 point
-
@adrian: that's why there's a Page::getLanguageValue method as well, and since $language is an descendant of Page, you can say: $langtitle = $language->getLanguageValue($language, "title");1 point
-
@jacmaes: many thanks for your feedback! I have updated the script in my post with your suggestion to work only with the image->name and not image->filename within str_replace(). Also I added a line at the end of the pages loop to uncache each no longer needed page, to save some memory.1 point
-
You can use examples from the forum or just modify to fit your needs. There is a mail example inside FrontendUserRegisterEmailValidation. PW hooks: https://processwire.com/api/hooks/ FrontendUser Wiki: https://bitbucket.org/pwFoo/frontenduser/wiki/Register extensions and plugins https://bitbucket.org/pwFoo/frontenduser/wiki/Login extensions and plugins https://bitbucket.org/pwFoo/frontenduser/wiki/Code snippets / Examples https://bitbucket.org/pwFoo/frontenduser/wiki/Documentation#markdown-header-styles-scripts-templates You can hook the FrontendUser methods auth (=login) and save (=register / save user). Just hook after FrontendUser save() and check the event return value if user was saved sucessful... Captain Hook -> search login -> /wire/core/session __login($name, $pass) I love the PW API and hooks1 point
-
I do, as processwire doesn't have this functionality out of the box. I need a way to review reported links or pages in the admin panel, when someone clicks to report a link, a new report is created for me to review. I have to review these links or pages in the admin panel. The only way for me to have a page in the admin panel where I review all the reported pages (or links), is to create a module. Believe me, you don't. If you'd followed my link, you would have realized that too. Ranting without reading the help given won't get you closer to a solution. As for the time issues you mention: there's always the choice between doing things quick&dirty and doing things right, especially in programming. Why do people build regular pages on Wordpress? Because they know it and get a quick solution to an immediate problem, but in the long run, they fight against the software they are using because it wasn't meant for this kind of thing. When I estimated that the time would, initially, be roughly the same for using PW and another framework, I was taking into account starting at zero with both, since there's yet no clickading thingy that plucks ideas from a brain and automagically adds it to a web page. ProcessWire is a framework too, and it also has its concepts and best practices. They aren't that many, but they need to be understood. The docs do give a good introduction to them, and there's plenty of information in the forum if you search for the keywords if you need more explanation. Here's a short step-by-step approach to solving your task without a custom module and just one non-core module: Preparations Download and Install the AdminCustomPages module from the module repository The template with the fields used to store reports Create a new field "reported_page" and set the field type as Page, in the settings select "single page or null page" Create a new field "report_message" and set the field type to Text Create a new field "report_read" and set the field type to Checkbox Create a new template "pagereport" in the backend and add the three fields you just created, ignore the message that there isn't a template file present The backend interface Create a file named "_pagereport_backend.php" in site/templates Go to "Page" and expand the tree to "Admin" -> "Pages", then click "New" next to that Set the title of the new page "Manage Reported Pages" and save. The template will automatically be set to "admin". Now, as the process for this template, select "ProcessAdminCustomPages". You can now select the "_pagereport_backend.php" file you created earlier. Click "Publish" The frontend page with the reporting form Create a file named "enterreport.php" in site/templates Create a new template and check "enterreport" Save Create a new page under "home", title it "Report Page" and select the template "enterreport" On the "Settings" tab, check "hidden" so it won't appear in searches and lists Publish You're all set up now, all you need is the PHP code and markup now. Edit "_pagereport_backend.php" and enter the following code, which will render a table with all reports, has links to the reported page and lets you directly mark them as read. It uses the core module MarkupAdminDataTable so you don't have to build the table manually. <?php if($input->get->mark_id_read) { $report = $pages->get($input->get->mark_id_read); $report->of(false); $report->report_read = 1; $report->save(); } $children = $page->children("sort=report_read, sort=-created"); $table = $modules->get("MarkupAdminDataTable"); $table->setEncodeEntities(false); $table->headerRow(array( "Reported", "Page", "Message", "Read" )); foreach($children as $report) { $table->row(array( strftime("%Y-%m-%d %H:%M", $report->created), "<a href='{$report->reported_page->url}' target='_blank'>{$report->reported_page->title}</a>", $report->report_message, $report->report_read ? "Yes" : "<a href='$page->url?mark_id_read={$report->id}'>No</a>" )); } echo "<h1>Reports to manage:</h1>\n" . $table->render(); Now, edit the "enterreport.php" file and add the code to enter a report: <?php if($input->get->page_id) { $pg = $pages->get($input->get->page_id); ?> <h1>Report page <?= $pg->title ?> (<?= $pg->url ?>)</h1> <form method="POST" action="<?= $page->url ?>"> <input type="hidden" name="page_id" value="<?= $input->get->page_id ?>"> Please leave a short reason why you are reporting this page (e.g. SPAM or offensive):<br /> <input type="text" name="report_message" size="80"><br /> <input type="submit" name="submit_report" value="Report this page"> </form> <?php } else if($input->post->submit_report) { $pg = $pages->get($input->post->page_id); $prnt = $pages->get("name=manage-reported-pages"); $report = new Page(); $report->template = "pagereport"; $report->parent = $prnt; $report->name = (new DateTime)->format("Ymd-Hisu"); $report->reported_page = $input->post->page_id; $report->report_message = $input->post->report_message; $report->save(); echo "<h1>Page '{$pg->title}' has been reported. Thank you!</h1><a href='#' onclick='window.close();'>Close this window</a>"; } else { echo "<p>No page given. If this problem persists when you try to report a page, please contant the administrator.</p>"; } All that's left to do is add the link to the report page somewhere in your template file, e.g. in a basic profile in _foot.php: <a href="<?= $pages->get("name=report-page")->url ?>?page_id=<?= $page->id ?>" target="_blank">Report this page</a> Creating a module would just mean wrapping most of the things I described here into an install routine and adding some shortcut routines (e.g. for rendering the markup that links to the report page form). You can now easily tweak the interface, e.g. by filtering the children in _pagereport_backend.php by "report_read!=1" to only show unread reports. You can add a field (e.g. the client IP) to the reportpage template and need only two lines in enterreport.php to render and save it and two in _pagereport_backend.php to display it (column header and value). Each report is actually a page underneath Manage Reported Pages, and you can even use PW's regular page tree to view or delete reports.1 point
-
@horst, I've tried running your bootstrapped script to copy the variations (on PW 2.7.3), but it stops short: It collects the field and displays the crop settings correctly, but then does not iterate over all pages. Looks like it stops running after echo "<hr />"; Edit: tried a test run on another site, and it almost works. Problem is with str_replace that also replaces the domain name (see what I've marked in bold): 'Sorolla and America' sorolla-and-america-optimized.jpg pequeno /var/www/domain.com/site/assets/files/1228/pequeno_sorolla-and-america-optimized.jpg /var/www/domain.-pequeno.com/site/assets/files/1228/sorolla-and-america-optimized.-pequeno.jpg grande /var/www/domain.com/site/assets/files/1228/grande_sorolla-and-america-optimized.jpg /var/www/domain.-grande.com/site/assets/files/1228/sorolla-and-america-optimized.-grande.jpg destacado /var/www/domain.com/site/assets/files/1228/destacado_sorolla-and-america-optimized.jpg /var/www/domain.-destacado.com/site/assets/files/1228/sorolla-and-america-optimized.-destacado.jpg Edit 2: I've managed to fix my problem with a few tweaks, and all files were successfully copied. // now iterate over all pages and rename or copy the crop variations echo "<ul>"; foreach($wire->pages->find("include=all") as $p) { set_time_limit($timelimit); // reset the timelimit for this page foreach($collection as $fName => $suffixes) { if(!$p->$fName instanceof Pageimages) continue; $images = $p->$fName; if(0 == $images->count()) continue; echo "<li>{$p->title}<ol>"; foreach($images as $image) { echo "{$image->name}<ul>"; foreach($suffixes as $suffix) { $old = dirname($image->filename) . "/{$suffix}_" . $image->name; $new = str_replace($suffix . '_', '', $old); // These two lines are my tweaks $new = str_replace('.', '.-' . $suffix . '.', $image->name); $newer = dirname($image->filename) . "/" . $new; // $newer is the new $new below: echo "<li>$suffix<ul><li>$old</li><li>$newer</li></ul>"; if($doFilecopy) { if(!file_exists($old)) { echo "ERROR: original variation is missing!"; } else { if(file_exists($newer)) { echo "file already exists"; } else { $res = @copy($old, $newer); echo "filecopy: " . ($res ? "Success!" : "!ERROR: $res"); } } } echo "</li>"; } echo "</ul>"; } echo "</ol></li>"; if($debugIteration) break; } } echo "</ul>"; exit();1 point
-
1 point
-
Hi douglas81, I'm not an expert on this, but i think what I might try in this case would be to: 1.) rebuild your config.php - maybe from a vanilla install, or another site; 2.) change the password of the superadmin from the API, which would then presumably use the new userAuthSalt; <?php $admin = $users->get('admin'); // username of superadmin $admin->of(false); $admin->pass = 'yo12345'; // put in your new password $admin->save();1 point
-
1 point
-
No problem, I just confused by terminology I guess. This should get you there: $language->getUnformatted('title')->getLanguagevalue($language->id)1 point
-
If the parent page is hidden you'd have to include "include=hidden" in the selector when doing a find(), but not if you get() the page explicitly. Also wanted to note that doing $pages->get("title=previous caption winners")->children; isn't a very reliable method to find a page by it's title, since the title isn't unique. In most cases it makes more sense to use id or page name, page path. $pages->get(1005)->children; Or maybe $pages->get("/some/path/")->children; To find if a parent has children there's also a method in PW numChildren(). if($pages->get(1004)->numChildren) { // has children } In PW 2.3 there's a new version of numChildren() to make it access aware if you pass true as the argmument if($pages->get(1004)->numChildren(true)) { // has children that are really visible to the user }1 point