Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by modifiedcontent

  1. @Rudy, thanks for the idea. I tried this, but it didn't make any difference, even after clearing caches etc. Edit: I figured it out. In the script I "called" the API with this: $initAuth = new ApiAuth(); When I should have used: $initAuth = new Mautic\Auth\ApiAuth(); To "declare" (?) the namespace.
  2. I am trying to connect with an external API, from marketing automation application Mautic on the same server, from a template in Processwire, with something like this: require '/serverpath/vendor/autoload.php'; use Mautic\Auth\ApiAuth; use Mautic\MauticApi; $initAuth = new ApiAuth(); This works in an empty test page outside of Processwire. Trying to use it from a template within Processwire I get this error: How can I make sure the script looks for Mautic's ApiAuth in the correct place? Mautic's autoload.php is included in the page successfully; I have checked that.
  3. I don't think my template code has anything to do with it. Here is a minimal version of the template that still has the same problem: Not only ""/>" is inserted in the html output. When I add a link to my $page->summary field, all the text after the <a href=...> opening tag is copied (?) and inserted after the body tag with most of the head including <title>. I say copied, because the block of text with URL also appears in the correct place. When I remove the link from 'summary', everything looks as it should, no crap inserted after the body tag. Edit: I found it. I had the following in head: <meta name="description" content="<?php echo $page->summary; ?>" /> That works fine with plain text, but breaks when you add html like a URL to the summary field. Or is there a proper way to filter it for meta content?
  4. Adding a URL in a textarea field leaves a random ""/>" in my html output, like: "" /> " Has anyone else seen something like that? What could cause this? Turning off experimental HTML OPTIONS did not fix it.
  5. Uninstall of this module doesn't work: I only installed it, because module refresh gave a warning about a missing file from NewsletterSubscription - probably left-over from another install/uninstall attempt long time ago. Is there another safe way to remove/uninstall modules?
  6. Thanks @ukyo, but what is that supposed to do? I plan to have my custom files in templates/forms. What difference would putting them in templates/extend or site/src make? Why site/src - is adding folders outside templates a good idea? Those classLoader lines apply to the entire folder, not a specific file? Are the general principles how to work with classes and customize modules in Processwire explained anywhere? I haven't been able to find it. This produces a result: CommentListCustom.php copied from the wire module into my templates/inc folder. The custom file is now used to display the comments. I can now make edits in that file to somehow change {cite} to the commenter's full name. Wtf is {cite} anyway? It's not a PHP variable. How is it defined? How can I redefine it? I can't do something like {cite} = $users->get({cite})->fullname; What syntax should I use? What rules apply to these {something} "thingies"? Why does this produce Fatal Error Uncaught Error: Call to a member function get() on null? This seems to work though: For the form it works the same of course: Then make edits in CommentFormCustom.php as required. In my case I added 'hidden' to the cite and email input fields, so logged-in users only get a text field, don't have to enter any other info - the module enters logged-in user name and email in the hidden fields if you remove/turn off all the cookie stuff. Two next issues to solve: 1. Is the upvote/downvote system cookie-based? What would it take to turn that into logged-in user ID-based? Or is that the default if I turn off cookies/remove cookie javascript? 2. Users will expect a way to delete and edit their comments. Has anyone done that? Suggestions welcome.
  7. I can't figure this out. I have added a comment.php file in my templates/forms folder with the following: With this in the page's template: This doesn't do anything - the echo from comment.php doesn't show up anywhere. I am not an experienced/full-time PHP programmer. It is not obvious to me what is going on in these scripts. @ukyo, what does '// do your customizations ' look like? Could you or anyone else give a basic example? Should I copy entire functions from CommentForm.php or CommentFormCustom.php (?), change a few things within those functions and then those customizations will replace the functions in /wire? Should I rename the functions? Or does whatever I put in '// do your customizations ' run after CommentForm.php in /wire - adding not replacing? I also tried to follow the instructions in CommentFormCustom.php, but did not understand any of it. I've copy/pasted different parts and functions from that file into my custom comment.php, but could not get a result with anything. Continuing with this tomorrow... Any hints very much appreciated.
  8. Thanks @ukyo. I'll try this in my next steps. In the meantime I have found out why my threaded comments - 'Reply Depth' etc. - didn't work. Threaded comments relies on jQuery in comments.min.js in wire/modules/Fieldtype/FieldtypeComments/ I load jQuery in my head with these lines: I think Processwire has jQuery "built in", but have always been confused how to use it. When I just remove my lines from head, all my jQuery breaks. If I already have jQuery in my site, why doesn't the jQuery in the module work? Does Processwire require a specific version of jQuery? The module's jQuery works fine when I copy it from comments.js to my template and replace jQuery with another var: I have also removed all the cookie stuff from the module's javascript. I think without it the comment form name+email fields are prefilled with data from the logged-in user, which is what I needed. Is there a way to add the Reply link with the foreach($page->comments as $comment) method? If not, I'll figure something out with @netcarver, @flydev 👊🏻 or @ukyo's suggestions - thanks!
  9. Thanks @netcarver. So 'presets' is an array somewhere that contains 'cite' and other things? Username is OK for the comment form, because comments will only be open to logged-in members. The module enters the logged-in users name and email address, so I can just hide those fields - or is there a way not to require them at all? The updated second method in my original post also produces the result I want, minus the Reply link. That Reply link doesn't seem to do anything special anyway; comments are all created on the same level, Comment1, Comment2, Comment3. I am now mostly puzzled by how to make threaded comments work - 'Reply Depth', reply-to-comment. Edit: Another problem; where does the module get the name + email address that are prefilled in the comment form? They are not consistently the name + email from the logged-in user as I assumed. When I test logged-in with different accounts, only the name + email of the first account I tested with show up in the comment form. Is there a way to just let the comment form take the name + email, or just ID, of the logged-in user? Edit 2: Javascript sets a persistant cookie for whoever posts a comment? I guess I should replace that with Javascript that enters the logged-in user's name+email then. Or is there any way via PHP without editing the module core files?
  10. Render Comments with options is this: {cite} inserts the username. I want to display the commenter's Firstname Lastname instead - I have a field for that called 'fullname'. Where is {cite} defined? How can I change it? This should be functionally the same (?) and would give me control to define and change lots of stuff, including "cite" and adding profile picture etc.: But with this, the 'Reply' link is missing from the comment. How can I add that 'Reply' link and make sure those replies-to-comments or replies-to-replies-to-comments are stored in the proper way? Or will that get me into a hopeless mess and should I just stick to the render method with a simple way to make {cite} render the full name instead of a username? edit: I see the comments just end up on the same level anyway, with either method - Comment1 Comment2 Comment3. 'Reply Depth' is set to '2' in the Comments field settings. Does threaded comments not work?
  11. Thanks @kongondo . I redefined the $user variable in my login script, causing the error further down. Dumb mistake, easily fixed by changing to $username or something like that.
  12. Another very dumb basic question; what could this error mean? Followed by a whole bunch of file addresses. Can someone translate this error; what should I check? I am troubleshooting a custom login/register system. I get this error when I enter gibberish in the username login field to produce a nice 'wrong username or password' message. A 'forgot password' form on the same page, not displayed while logging in, gets the 500 Internal Server Error.
  13. Thanks @netcarver. I could not figure out how to use that ProcessForgotPasswords module. There were no instructions anywhere. It looks like it depends on other modules or assumes your login/register process is structured a certain way. Thanks for the other suggestions. Replacing md5() was going to be next.
  14. The modules don't really work for me. I have a custom login and registration process directly in template files and just want to add password reset. I don't need admin etc. The following works: My PHP knowledge is very limited - I don't understand namespace, hooks, etc. etc. I have to start from a basic proof-of-concept and then improve on that as needed. Are there obvious mistakes in the code above? Obvious security risks? The process is really slow; it takes forever after clicking submit to find the user in the database. Could the code be more efficient? Any comments / suggestions much appreciated.
  15. You can upload and generate webfonts here, but if you use copyrighted/premium fonts it could get you into trouble of course.
  16. I have to come up with a 'forgot password' feature for my custom login/register process. I hoped I could just use the core module ProcessForgotPassword, but see it hasn't been updated since 2012 and it is not clear to me how to use it. How do I add ProcessForgotPassword to my login form/template? The module is installed in the backend, but then what? Are there instructions anywhere? Is @Pierre-Luc's module safe to use for the latest Processwire versions? What/where is the latest version? Is anyone else using it with improvements? Are there other solutions/modules? I'll probably work on this next weekend and post more findings.
  17. Is there a way to do $users->get( superuser )? Or can there be more than one superuser? Get the first superuser? Without having to use a name like 'admin'.
  18. How do I use this module on the front-end, in a template? My field 'summary' is configured to use CKEditor and it works fine in the admin area. It tried getting something to show up on the front-end by adding this to a template: <?php $modules->get('InputfieldCKEditor'); echo $page->edit('summary'); ?> <edit summary></edit> <div edit="summary"></div> Nothing shows up. I guess I need to add something to head, but could only find very ambiguous info. This info only applies to back-end? @gebeer tried to explain here, but I don't use 'delayed output strategy' and could not get his instructions to work. Is there a dumbed down version anywhere? Where is the js file I should link to? And a css file? I have been using my own CKEditor, with the files in a js folder in templates. I just want to replace it with the "native" Processwire version.
  19. Thanks gebeer. I have also found the instructions here. Did you find solutions for your original question from 2016, CKEditor settings per template and/or role? I'll have to figure that out next and will post here what I find out.
  20. Is CKeditor now part of Processwire? I use CKeditor in a template, but using a version I downloaded in a template js folder. What is the correct way to use CKeditor in a template, on the front-end?
  21. What is in 2020 the best way to provide an image upload feature for members/registered users, for a profile picture etc.? Is there now a built-in option? Or a module? I only found this old non-stable module here and forum threads from 2012-16. I have a cobbled together solution from about 2017 that kinda works. I can post details later if necessary. I want to replace or improve it.
  22. How would I even use Tracy Debugger console for this? I want to test what happens in a Member account, where I don't have access to Tracy Debugger. I don't want to risk messing up my SuperUser admin account by running random code in that Debugger console. What is Process Tracy Adminer that is suddenly also installed in my site? Tracy Debugger installs way more stuff than I am comfortable with and I have no clue how to use it to troubleshoot my particular problem. The variables are fine. This used to work fine in my site. I was just looking for basics of how to edit a field via a simple form on the front-end. Is there an example anywhere? Has anything changed about that in the last few years? This "works": if($input->post->bio) { $user->of(false); $user->body = $sanitizer->text($input->post->bio); $user->save(); } This doesn't: if($input->post->updateprofile) { $user->of(false); $user->body = $sanitizer->text($input->post->bio); $user->save(); } Both with a form like this: <form method=post id=updateprofile> <textarea placeholder='biography or description' id=bio name=bio><?php echo $user->body; ?></textarea> <button type=submit name=updateprofile>Update Profile</button> </form> So I guess using <button> instead of <input> broke it? Apparently yes, changing it back to <input type=submit ... fixed it.
  23. body and fullname are both set to user-editable in their own profile; the code I have used to work, just no longer doesn't for some reason. I set Access control for the User template to No*, but that didn't fix the edit forms. * bad idea? Should my general approach work or does anyone see obvious problems? This just doesn't seem to do anything: if($input->post->updateprofile) { $user->of(false); // turn off output formatting $user->fullname = $sanitizer->text($input->post->fullname); $user->body = 'Just enter something when I click the updateprofile button'; $user->save(); } I have ProcessWire 3.0.161 dev, with as few modules as possible. This page should be all plain code. No hooks used. Code already simplified to bare essentials.
  24. Thanks @dragan. I actually have a super basic password update somewhere that works. I'll update that with some of your suggestions. I stripped down my Member Account management script to bare essentials and it still doesn't work: <?php if($input->post->updateprofile) { $user->of(false); // turn off output formatting $user->fullname = $sanitizer->text($input->post->fullname); $user->body = $sanitizer->text($input->post->bio); $user->save(); } ?> <form method=post id=updateprofile> <div class=field> <label for=fullname>Full Name</label> <input placeholder='Firstname Lastname' type=text name=fullname value='<?php echo $user->fullname; ?>' /> </div> <div class=field> <p>Please introduce yourself</p> <label for=bio></label> <textarea placeholder='biography or description' id=bio name=bio><?php echo $user->body; ?></textarea> </div> <div class=buttonrow> <button type=submit name=updateprofile>Update Profile</button> </div> </form> What am I missing?
  • Create New...