Jump to content

benbyf

Members
  • Posts

    796
  • Joined

  • Last visited

  • Days Won

    6

Posts posted by benbyf

  1. To: hello@ethicalby.design
    X-Spam-Level: *
    Mime-Version: 1.0
    Content-Type: multipart/alternative; boundary="==Multipart_Boundary_x4f3b2ef58aaf86a1b8f42e135b6d876fx"
    X-Spam-Report: *  0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% *      [score: 0.5009] *  0.0 HTML_MESSAGE BODY: HTML included in message *  0.8 RDNS_NONE Delivered to internal network by a host with no rDNS
    X-Spam-Status: No, score=1.6 required=5.0 tests=BAYES_50,HTML_MESSAGE, RDNS_NONE autolearn=no autolearn_force=no version=3.4.2
    X-Spam-Score: 1.6
    X-Mailer: ProcessWire/WireMail
    X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail.nicegrp.com
    Return-Path: <site@bristoltechwork.nicegrp.com>
    Received: from mail.nicegrp.com ([127.0.0.1]) by mail.nicegrp.com (Dovecot) with LMTP id mfEsKtk/rmDfcQAAOdwwgg for <hello@ethicalby.design>; Wed, 26 May 2021 08:33:12 -0400
    Received: from PWbox1.default-fqdn.com (unknown [178.62.6.248]) by mail.nicegrp.com (Postfix) with ESMTP id 85EA91464DB for <hello@ethicalby.design>; Wed, 26 May 2021 08:33:12 -0400 (EDT)
    Received: by PWbox1 (Postfix, from userid 1000) id 4C15C14008C; Wed, 26 May 2021 08:33:12 -0400 (EDT)
    <20210526123312.4C15C14008C@PWbox1>
    Delivered-To: <hello@ethicalby.design>
    Authentication-Results: mail.nicegrp.com; dmarc=none header.from=bristoltechwork.nicegrp.com

    not clear to me..

  2. Module.

    class MembersMessaging extends WireData implements Module {
    
    	public static function getModuleInfo() {
    		return array(
    			'title' => "Members messaging" ...blah blah
    ...
    			'singular' => true,
    			'requires' => array("PHP>=5.4.0", "ProcessWire>=3.0.1, MembersMessagingProcess"),
    		);
    	}

     

  3. Trying to work out why my module is send two emails when it should be sending one. I have a log statement at the end, it only shows up once in the logs where as i'm still recieving two emails!!? Which is why I'm confused:

    $mail = wireMail();
    
    // set a default email address if none set
    $mail->to($u->email)->from($this->siteEmail); // all calls can be chained
    
    $mail->subject('New Unread message');
    $mail->bodyHTML($msg);
    $numSent = $mail->send();
    
    if($numSent) $this->wire('log')->save('mm_emails', 'New email sent to: ' . $u->email);

    I'm running PW 3.0.165

  4. 7 minutes ago, Klenkes said:

    aaand... not to forget, in the CKE field you can set: Update image alt attributes (Replace blank alt attribute with image description)

    If an image description is set, it will be used automatically.

    wheres this sorry? I looked in the module InputfieldCKEditor and the settings on the textarea field itself but couldnt see this.

  5. 7 hours ago, JeevanisM said:

    There is one computer pioneer often get backseat in foray, none other than Mr. Konrad Zuse . I dont think he gets the wider audience as he deserves. 

    Amazing, thank you! Zuse wasn't on the list and is now

    • Like 1
  6. ended up with this, but be nice to get a best practice of tutorial on this as still don't really understand.

    	public function ___uninstall() {
    		// for each installed page delete on uninstall
    		$pages = array('my_test_page');
    		foreach ($pages as $key => $value) {
    			$page = $this->pages->get("name=$value, include=all");
    			$this->wire('log')->save('mm_log', $page->id);
    			if($page->id){
    				
    				// delete page and any children
    				$page->delete(true);
    				$page->trash();
    			}
    		}
    
    		// delete field groups used on system templates
    		$f = $this->fields->get('my_repeater');
    		$userTemplate = $this->templates->get("user");
    		if($userTemplate->id) {
    
    			// $userTemplate = $this->templates->get("user");
    			
    			// $fg = $userTemplate->fieldgroup->remove($f);
    			// $fg->save();
    
    			$userTemplate->fields->remove($f);
                $userTemplate->fields->save();
    
    			$this->wire('log')->save('mm_log', 'delete user field');
    		}
    
    		// delete messages template
    		$templates = array('my_template');
    		foreach ($templates as $key => $value) {
    
    			$t = $this->templates->get($value);
    
    			if($t->id){
    				$t->flags = Template::flagSystemOverride; 
    				$t->flags = 0; 
    				$this->templates->delete($t);
    			}
    			$fieldgroup = $this->fieldgroups->get($value);
    			if($fieldgroup){
    				$this->fieldgroups->delete($fieldgroup);
    			}
    		}
    
    		// for each installed field delete on uninstall
    		$fields = array('my_field');
    
    		foreach ($fields as $value) {
    			$f = $this->fields->get($value);
    			if($f->id){
    				// if field exists, then delete
    				$this->fields->delete($f);
    			}
    		}
    	
    		$this->modules->uninstall($moduleName);
    	}

     

  7. Never really got my head around field groups and it shows, In my module uninstall I think I figured out how to delete a page, then a template and it's fieldgroup so that nothing gets upset. But for fields that belong to templates that need to stoick around I'm still abit stuck to how you would remove the field and when I try I still get:

    Unable to delete field '[field name]' because it is in use by these fieldgroups: 'user'

    is there a tutorial or best method for removing added fields, pages and templates?

  8. I have the messaging module ready to go if anyone is interested in Beta testing it (then please message me) and ill get the shop up and running to sell it from (unless the PW market place is willing to have it of course???).

    • Like 3
  9. Hi, just wondered if anyone had tackled a module to add a masonry effect to the image field in PW admin? I've got a front end effect by calculating all the hieghts of each new image and placing them in a column with the least current overal height (instead of doing the same in javascript), but be nice to see the same representation in the admin too.

     

  10. 3 minutes ago, David Lumm said:

    Hey all!

    I was wondering, is there any concept of "middleware" or hooks that I could attach to so I could run something on every request?

    At the moment I've got a couple of things I've added into every route function, but I can anticipate that list getting longer. Rather than copy and paste the same lines into each and potentially miss something, it would be great if I could run it before the route specific code runs. Is that possible @Sebi?

    Hi HI David, in PW any function in a module that has ___ at the start, like ___handleApiRequest() in the AppAPI module you can use as a hook in your own code. See https://processwire.com/docs/modules/hooks/

    • Like 3
  11. Hi @Sebi I added the log to app-api (will create a PR somepoint soon), I wondered if you wanted a log message on each request and maybe a setting in the modules settings to turn on or off, or maybe something more granular?

    My use case is going to require lots of log messages in the api files but having a generic log message on each request I though might be nice. Also wondered if it was worth making a second log for failed (exception) based log messages? so successful requests get logged to one and exceptions to the other..... any thoughts would be cool

    • Thanks 1
  12. Thanks both @Sebi and @thomasaull I appreciate your time.

    Will look into the log bug as thats paramount to us using the module so would be great to clear up.

    The non-apikey endpoints is more of a nice to have really as you can set up informational endpoints that act like website frontends but without the visual code obviously.

    In terms of users, applications and version, they seem loosely connected. There seems little reason to fill out the apikey version  when creating a new apikey if it doesnt actually relate to anything. But maybe i just havent seen how it does or could relate. Also the users are too loosely associated with the applications (slight tangent), but it would be nice to leverage the user and roles system byt associating a user/s with either key or applications, and then auth them against them on route. e.g. [..., [route_options_role_required = "delete-pages, update-pages, create uses" ]] as the folowing api might enable these things and you wanna be pretty damn sure that user is allowed to do it ?

×
×
  • Create New...