Jump to content

rick

Members
  • Posts

    635
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by rick

  1. Don't worry about whether you are a coder or not. This community is full of people that are glad to help you with whatever issues you may have. We just need more information to do so. Post the code you have to work with and someone here will be along shortly to help you get it sorted.
  2. Hi @Roych, I'm not quite sure I understand. When you say you have a field for redirecting if necessary, what does necessary mean? And a non-clickable link is just text. Can you expand your requirements further so I understand exactly what you are trying to accomplish please? Maybe a screen shot of a similar interface?
  3. I have VSCode as well, but haven't used it since I purchased a license for storm. There are some UML plugins, such as this one available in the marketplace. I haven't used any of these, so I can't vouch for which is best.
  4. Hi @SamC, One thing I find that helps me understand and better structure any classes I attempt to create is a UML tool. Personally, I learn best when I am shown how to do something and a UML diagram is the next best thing to having someone standing over my shoulder. If you are using PhpStorm, you can read about the UML feature here.
  5. I wrote an ad sponsor plugin for wp many moons ago. I thought of porting it to PW as my first project, but quickly realized I didn't know squat about PW so it wound up on the shelf. If anyone is interested in taking on a project like this I'd be more than happy to send you the source to the original plugin and answer any questions about ad/sponsor management.
  6. To me it's a preference. For example, in user registration I use this structure: if( $input->post('register') == '1' ) { // is our form submitted if($session->CSRF->hasValidToken()) { // is it our form if( $input->post->text('g-recaptcha-response') == '' ) { // are they beast or human $regError = "Invalid Captcha response."; } else { $regEmail = $input->post->email( 'regEmail' ); if( $users->get( "email=$regEmail" )->id ) { $regError = "You cannot register more than one account with the same email address."; } else { ... } } } else { header("Status: 401", true, 401); } } Since php does a short circuit test, it stops evaluating conditionals as soon as a value is known. So it doesn't really matter, unless you get into nesting elseif or use switch statements. Whatever code style reads best for you and your team is how you should do it. Just my $.02
  7. Searching by, site:processwire.com/talk/ processwire ide yields a number of recent topics and various tips.
  8. Depending on the theme, it can a lot more work trying to remove all the wp junk from a theme than it would be to create a similar theme from scratch using whatever front-end style you want, such as bootstrap, etc. Personally, I have not found a wp theme worth that time. There are many good theme (templates) where you could put your time to better use. See this thread for some great options.
  9. Yes. Yes, it is. And the longer any organization is put off the mightier that task becomes.
  10. I am calling d($result) from the console panel. I have a saved snippet that I refer to often. The result is appended to the admin page and doesn't display in any panel I have found. I would keep the ajax panel functioning as you have overridden. Maybe the manual clear option is best. The ajax panel does increase vertically. It doesn't appear to stop at the view port top, though. The same with the console panel. I have to clear the result on the console panel for it to resize back down where i can close it. But I am not concerned about that. One pilot error at a time. Edit: We can take this offline to PM if you wish. I hate clogging up this thread with my stuff.
  11. In this particular case, I am testing various parameters of a method in the console and viewing the output in the dumps panel (currently the ajax panel as in the first image). There can be many separate testing results listed in the ajax panel. So I thought there was a means to clear the previous result set before executing another test. Two things. 1) I have to reload the page, or navigate away, to clear the ajax dumps panel, correct? When I do that, the content of the ajax panel is copied to the recorder panel where I can then clear the result sets. No, I'm not trying to prevent the results in the ajax panel from moving to the recorder panel. I was just looking to clear previous result sets from the ajax panel. The ajax panel is a small panel and not resizeable, and I can have quite a few result sets listed. 2) the d() command displays the raw data appended to the current page, below the footer. It does not display the dump result in any panel that I can find yet. Hence my use of bd(). I could write the results to a log file, but then I have the same problem clearing old data. I'm not requesting a change to Tracy. I am not sure about the proper procedure, or if I am missing some configuration option. Either way, it is pilot error and not equipment malfunction. Thanks for your help!
  12. Okay, I upgrade Tracy from 4.8.23 to 24. This is the result when executing bd($result); in the console: This is the result when I change pages from the admin menu:
  13. When I execute a portion of code in the terminal and output the result using BD() it is placed in the Dumps (Ajax) panel, which is fine. However, there is no Clear Dumps option. If I change pages (another admin menu option) and return, all results are now listed in the Dumps Recorder panel, which does have the Clear Dumps option. The Dumps (Ajax) panel is then empty. Is there a way to add the Clear Dumps option to the Dumps Ajax panel?
  14. I never really paid any attention to those access permissions before. Oh, the irony of being a tech writer and not RTFM! I'm just glad to have this toolbox available again. Kinda feel lost without it.
  15. Hi @adrian, Sorry for the delayed reply. I set superuser force dev and the bar shows up correctly. Didn't tracy look at config->debug before? I don't recall having to set this option. No matter, it works now so all is good. Thanks!
  16. Hi @adrian, I just created a subdomain (sep pw install) where I installed tracy, but the bar does not show up. In fact, it was running fine on the primary domain, but after installing it, neither site shows the debug bar. When I uninstall it still does not show up on the primary domain even though it is enabled there. Both sites are: pw 3.0.62 tracy 4.8.24 php 7.0 maria 10 Other modules (upgrade, profile export) all function on both sites. There are no errors in apache/pw logs. Any suggestions where I should look next?
  17. Does anyone know how to set the disabled attribute of a button? I found nothing in inputfieldbutton/submit which allows this setting.
  18. A user going directly to a page is either from a bookmark or typing (pasted) url. So you could check both the referrer and bookmarks on the desired target page(s). Otherwise you'd have to test and set a result (as @DaveP shows) on all non-target pages, then test for that result on all target pages.
  19. So basically a stack trace of hooks and their parameters and results. Correct? Personally, I think this would be great, especially for those of us who have not dove into the hook pool yet.
  20. When deleting a select options field (checkboxes multiple values) from the admin interface, the selectable option entries are not deleted from the fieldtype_options table. Is this a bug? PW 3.0.62 Note: I haven't marked this topic closed or solved because I want to keep all the questions and answers together.
  21. You are right. This is somewhat convoluted. However, I did manage to solve my problem using the information from the post you linked. I also remember now where that selectable options array error came from. With debug=true and advanced=true you normally hover over the collapse icon to view the field you use when defining your API fields. In this case the field shows as "_options". There is also a link to an article which describes the means by which you can manipulate this type of field. The article is incomplete, in that it does not describe checkboxes (multiple value). The selectable options error occurs when you try and use the article information with this type of field. The following is how you can create a multiple selection field via API utilizing checkboxes should anyone else come across this. if( !$f = $this->wire( 'fields' )->get( 'myOptionsField' ) ) { // check if field already exists $f = $this->wire( new Field ); $f->name = 'myOptionsField'; $f->label = __( 'My Options Field Label', __FILE__ ); $f->description = __( 'My Options Field Description.', __FILE__ ); $f->notes = __( "My Options Field Notes.\nCan be more than one line.", __FILE__ ); // We want this field to store our options $f->type = $this->wire( 'modules' )->get( "FieldtypeOptions" ); // You must save your field definition at this point, which is the same procedure through the admin interface. // You cannot modify other field parameters until the field is first saved. $f->save(); // assign a group tag to group like fields if you want. $f->tags = 'groupTag'; $f->required = 1; // required field = 1 // This is the same as selecting Checkboxes (Multiple values) on details tab. $f->inputfieldClass = 'InputfieldCheckboxes'; // Create a function (if needed) to retrieve your desired options from whatever source. $myOptions = $this->getMyOptions(); // return a sorted array of options // Set the number of columns based on the number of options. // Here I hardcoded 15 options as the break point for a new column. $f->optionColumns = ( count( $myOptions ) % 15 ) + 1; // Create a function (if needed) to convert your array of options to newline delimited string. $myOptions = $this->getOptionString( $myOptions ); // Fire up the option manager and add your option string to this field. $manager = new SelectableOptionManager(); $manager->setOptionsString( $f, $myOptions, false ); // Now you can save the modified field definition. $f->save(); } Now your process module can work with the available options. In your form process function, you will need the form ($f) and page ($p): private function processMyOptionsForm( $f, $p ) { $input = wire('input'); if ( !$input->post->submit ) { // Is form submitted return false; } $f->processInput( $input->post ); if ( $f->getErrors() ) { // Does form have errors $this->wire()->error( $f->getErrors() ); return false; } // turn off page formatting before changing values. $p->of(false); // remove any checkbox options previously selected. $p->myOptionsField->removeAll(); // loop through the page fields foreach( $p->fields as $fld ) { if( $fld->name == 'title' ) continue; // We don't want to change the page name // Is this our options field? if( $fld->name == 'myOptionsField' ) { // Here the array of user selected values is assigned to the selectable options of our field. $p->myOptionsField = $input->post('myOptionsField'); } else { // Set page fields to form field values $p->set( $fld->name, $input->post($fld->name) ); } } // Save the page with our new values $p->save(); } I hope this saves someone from a headache or three.
  22. Howdy all! In my process module I am creating a dynamic form which contains a variable number of checkboxes. The form displays correctly, and all but the selected checkboxes are saved. Tracy and the network show the array being passed in the post back to my process module. The target field was created as Select Options type, and the input is Checkboxes (Multiple values). I have tried the following without success: $p->of(false); $p->myOptionsField->removeAll(); // remove previous selected options foreach( $p->fields as $fld ) { // iterate page fields if( $fld->name == 'title' ) continue; // skip page title field if( $fld->name == 'myOptionsField' ) { bd( $input->post('myOptionsField') ); // Shows correct array of selected options $p->set( $fld->name, $input->post($fld->name) ); // No error produced //$p->myOptionsField = $input->post('myOptionsField'); // No error produced //$p->myOptionsField = $input->post($fld->name)->value; // Property of non object error } else { $p->set( $fld->name, $input->post($fld->name) ); // other fields are saved to database } } $p->save(); Note: I've also gotten an error about the sleepValue of the selectableOptionArray, but I don't remember what was wrong with the code to produce it. I left the tags in for this post to help others searching. Can someone please tell me how I should be doing this. I know it will be simple, as it always is, but my eyes are crossed.
  23. Sorry @bernhard, the forum won't let me like your reply more than once. I learned a couple of new things from your response. Kudos sir!
×
×
  • Create New...