-
Posts
1,070 -
Joined
-
Last visited
-
Days Won
16
Everything posted by dotnetic
-
I try to hide menu items in the Admin/Backend. Any suggestions, how to do this? The way I do it right now is this: public function init() { $this->addHookAfter('Page::viewable', $this, 'viewable'); } /** * Don't give users with custom-role access to Pages page */ public function viewable(HookEvent $event){ $page = $event->object; $user = $this->user; if($page->id == 3 && !$user->hasPermission('view-pagetree')){ $event->return = false; } if ($page->name == "admin-actions" && !$user->hasPermission('admin-actions')) { $event->return = false; } } But there are two problems with this approach: Because I return viewable = false for the "Page" menu my Lister Pro item also does not show up, because it resides in "Page". The second problem is, that viewable does revoke the right to view a page. I need for example the module "Admin Actions" to be viewable but the menuitem should be hidden. How can I accomplish this?
-
EDIT: Solved this by myself, see bottom of the post. Hi @adrian First of all, this is a really great and useful module. I want to submit the id of a page to my custom module, but I don´t want to show up the id as a field that is being shown. Right now I call the module via admin-actions/options?action=BewerbungsunterlagenAnfordern&id=1514 And this is my defineOptions function protected function defineOptions() { $missingFiles = array(); foreach ($this->pages->get("/unterlagentypen")->children as $unterlage) { $missingFiles[$unterlage->id] = $unterlage->title(); } return array( array( 'name' => 'missingFiles', 'label' => 'Fehlende Unterlagen', 'description' => 'Wählen Sie aus, welche Unterlagen noch benötigt werden.', // 'notes' => 'Only use one of "Pages" or "User Roles"', 'type' => 'AsmSelect', 'options' => $missingFiles, 'required' => true, // 'requiredIf' => 'pages=""' ), array( 'name' => 'id', 'label' => 'ID der Bewerbung', 'description' => 'Bitte den Inhalt dieses Feldes nicht ändern.', 'type' => 'Text', 'required' => true, ), ); } How can I hide the ID Field? Just set the type to "hidden" and Voilá
-
You were right, it was a permission problem. Logged in as admin and the bar showed up. Sorry for bothering you. Could have thought of this myself.
-
Hey @adrian and others, I need your help. How can I use the Tracy Debug Bar on an external site, which includes ProcessWire´s core? Tracy is already defined when I include the ProcessWire core (where Tracy Debugger is installed), so I don´t include the standalone version of Tracy anymore. But the debug bar does not show up nor the needed HTML code gets added to the page. Here is what I do. How can I show this beautiful debug thingy? This does not work: require(__DIR__ . '/../myprocesswire-installation/index.php'); TD::barDump('Show a dump'); // This does nothing // This works if I don´t include ProcessWire, but I need it //require 'lib/tracy/src/tracy.php'; // use Tracy\Debugger; // // Debugger::enable(); // Debugger::$logSeverity = E_NOTICE | E_WARNING; // Debugger::barDump('test');
-
Thank you for this great article. It should be in the official ProcessWire Docs.
-
Module FrontendUser: login, logout and register users / members
dotnetic replied to pwFoo's topic in Modules/Plugins
@modifiedcontent Did you see my PW 3 compatible module https://github.com/jmartsch/processwire-social-login? Maybe you want to use it instead? It has account validation/email confirmation and login via Facebook. -
Module FrontendUser: login, logout and register users / members
dotnetic replied to pwFoo's topic in Modules/Plugins
@Thachakrit @JasonS @pwFoo To get the password validation working you need to add styles and scripts from ProcessWire Admin. The following is untested with this module but should work if you add it to the page where you do the output of the module: <script type="text/javascript" src="/wire/modules/Inputfield/InputfieldPassword/complexify/jquery.complexify.min.js"></script> <script type="text/javascript" src="/wire/modules/Inputfield/InputfieldPassword/complexify/jquery.complexify.banlist.js"></script> <script type="text/javascript" src="/wire/modules/Jquery/JqueryCore/xregexp.js?v=1466417387"></script> <script src="/wire/modules/Inputfield/InputfieldPassword/InputfieldPassword.min.js?v=101-1466417387"></script> EDIT: Forgot to add the stylesheet. It resides under /wire/modules/Inputfield/InputfieldPassword/InputfieldPassword.css -
Can´t upload same file to images and files field
dotnetic replied to dotnetic's topic in General Support
Thank you for your suggestions. @adrian was right, I wanted to have the same file in the files and images field. Now I changed my download function so that it can also accept files from the images field. -
If I try to upload the same file (an image) to the "files" field AND to the "image" field (for thumbnail generation) on a page. But if I do that I get an error which says: How can I tackle this problem? Is it somehow possible? Because I need the image for a thumbnail and the file from the files field can be downloaded.
-
@gmclelland config.urls.root does not exist anymore. I also had this problem. Take a look at https://processwire.com/talk/topic/808-variable-for-domain-name/?p=93034
-
If you use Tracy (which is excellent) then you could just do {{ bd(myVar) }} to dump a variable into the Tracy debug bar right from your twig template.
-
I used a much simpler and faster method utilizing the pagefile class. My link looks like this: // Sorry for smarty language. but thats what I used {if $page->files|@count > 0} {foreach $page->files as $file} <p> {if $file->description} {$file->description} {else} {$file->name} {/if} <br> <a href="download/{$file->name}" class="link-icon">Download</a> | {$file->filesizeStr} </p> {*{/if}*} {/foreach} {/if} and then in my _init.php I used the following code if ($input->urlSegment1 == 'download') { $download_options = array( // boolean: halt program execution after file send 'exit' => true, // boolean|null: whether file should force download (null=let content-type header decide) 'forceDownload' => true, // string: filename you want the download to show on the user's computer, or blank to use existing. 'downloadFilename' => '', ); session_write_close(); if ($input->urlSegment2) { $pagefile = $page->files[$input->urlSegment2]; if($pagefile){ wireSendFile($pagefile->filename, $download_options); } } } EDIT: The downside when implementing this in the _init.php is, that you can´t send a Wire404Exception, because this file gets included (prepended) and PHP doesn´t like exeptions in included files. If you paste this code into one of your templates you could add trowing a Wire404Exception.
-
@DedMoroz Did you see my PW 3 compatible module https://github.com/jmartsch/processwire-social-login? Maybe you want to use it instead?
-
Various suggestions for the Comments field
dotnetic replied to GuruMeditation's topic in Wishlist & Roadmap
Thanks for these thoughts. They are almost the same, what I wish for the comments module. -
Maybe somebody can help me with this. I tried the following code for paginated comments: $commentLimit = 2; // comments to display per page $start = ($input->pageNum - 1) * $commentLimit; $desc = false; $selector = "page=$page, sort=-created, start=$start, limit=" . ($commentLimit + 1); // find the comments. replace "comments" with the name of your comments field // I also used the new find command and not the deprecated findComments $comments = FieldtypeComments::find("comments", $selector); in one of my template.php, but it throws an exeption: Class 'FieldtypeComments' not found What is wrong?
-
@bernhard Did you release Alfred to the public? The gitlab page does not exist anymore and I can´t find it.
-
Please update the download link on the website http://de.processwire.com as it points to an old ProcessWire 2.7 repository.
-
Hi guys I need an estimate for the following task: I developed a job candidate application in ProcessWire and need an extension to a Lister Pro Page. My customer wants to display a summary table of the filtered data like in the attached screenshot. When you filtered the view, that summary should show how many candidates have which status according to the actual filtered view. If you change the filter, the summary table has to be updated also. Who can accomplish this task and what would it cost? I first need an estimate to tell it to my customer. If he says the price is ok I will provide you with FTP Data to a dev server version of that tool. Thank you in advance.
- 1 reply
-
- 1
-
-
Hey guys, hey @baba_mmx I just released a new version of this module on github. I also got a question, as I am planning to take this project under my wing: Should I make a new thread for it and add it to the modules directory? @baba_mmx would that be ok with you? One problem is that if I put it in the ProcessWire Modules directory it does not install it dependencies, as they are installed via composer. How could I handle this? What has been done in the latest release? v0.9.1 made the register form public so you can alter the markup and classes added Foundation classes for the errors and notices. Have to make this configurable added new function showMessage to echo messages and errors login user after successful registration removed automatic redirect enabled autocompletion for the form show either displayName from OAuth or email address after login added the ability to save the last name, first name and gender from OAuth in the user profile. Just add the fields "lastName", "firstName" and "gender" to the user template in ProcessWire
-
urls Access to the website with Processwire in a subfolder
dotnetic replied to Elías Gómez's topic in General Support
You can do that with a .htacces and mod_rewrite. Don´t know exactly what you have to write, but google for "htaccess subfolder as root". Maybe here is a solution: http://stackoverflow.com/questions/990392/htaccess-rewrite-to-redirect-root-url-to-subdirectory -
Been there done that. I proudly present a ProcessWire 3 compatible version with the latest HybridAuth (only tested with Facebook). The code can be found on Github https://github.com/jmartsch/processwire-social-login with installation instructions. Please add your suggestions or create pull requests. The module and its dependencies are installed via composer. Have phun!
-
Module FrontendUser: login, logout and register users / members
dotnetic replied to pwFoo's topic in Modules/Plugins
@mr-fan Thank you. Maybe it is the way to go without the FrontendUser Module. I also saw your post and thought "That could be the solution I want to use, if there is no simple solution with the FrontendUser module". -
Module FrontendUser: login, logout and register users / members
dotnetic replied to pwFoo's topic in Modules/Plugins
@pwFoo Could you give me an example how to do this? I think this could be of help for others too. EDIT: pls note that I do not want to send the username with the form, because it can be manipulated. See my previous post. -
Module FrontendUser: login, logout and register users / members
dotnetic replied to pwFoo's topic in Modules/Plugins
@modifiedcontent Thank you for your suggestion. But relying on JavaScript is not good. I also think that a rewrite is not needed. I don´t want no username. I just don´t want the username in the form because it could be manipulated. The username should be the same as the email address, but sanitized as pageName. -
Module FrontendUser: login, logout and register users / members
dotnetic replied to pwFoo's topic in Modules/Plugins
Hi, I would like to do a register form with email pre-registration validation, but without the username field. Instead the username should be the email sanitzed as a pageName. I have the following code right now: <?php namespace ProcessWire; // prepare register form // Additional email pre-register validation plugin (built-in) $fu->register(array('email', 'emailValidation', 'password')); $fu->form->setMarkup($form_markup); $fu->form->setClasses = ($form_classes); $fu->addHookBefore('FrontendUser::save', function ($event) { $user = wire('fu')->userObj; $form = wire('fu')->form; if (!count($form->getErrors())) { // set the username to sanitized email value // $user->name = $form->fhValue('email', 'pageName'); $user->addRole('editor'); } }); // process register / form submit $fu->process($profile_url); $register_form = $fu->render(); $view->set('registerForm', $register_form); // this is for Twig But when I submit that form I get an error: Call to a member function getErrors() on null in line 94 of FrontendUserRegisterEmailValidation.module I think it is because in the function "hookRegisterFormAfterProcess" there is line 84: $user = $form->get('username'); As I send no username, this can not work. So how can I make it work without touching the FrontendUserRegisterEmailValidation.module? Thanks in advance.