We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4172
    • 5,888 Posts
    Have added a new Parameter &dobFormat to WebloginPE.
    In the snippet:
    $dateFormat = isset($dateFormat) ? $dateFormat : '%A %B %d, %Y at %I:%M %p';
    $dobFormat = isset($dobFormat) ? $dobFormat : '%m-%d-%Y';//add by Bruno

    and
    $wlpe->CustomTable($customTable, $customFields, $prefixTable, $tableCheck);
    $wlpe->dobFormat=$dobFormat;//add by Bruno


    In webloginpe.class.php:
    $age = substr($ageDecimal, 0, strpos($ageDecimal, "."));
    $modx->setPlaceholder('view.dob', strftime($this->dobFormat, $viewUser['dob']));//dobFormat by Bruno
    $modx->setPlaceholder('view.age', $age);

    and
    // CREDIT : Guillaume for not format an empty date
    $value==0?'':$modx->setPlaceholder('user.'.$key, strftime($this->dobFormat, $value));//dobFormat by Bruno
    $modx->setPlaceholder('user.age', strftime('%Y', time() - $value));

    and have rewritten function MakeDateForDb:
    function MakeDateForDb($date)//modified by Bruno for $dobFormat
    	{
    		$formatArray= split('[/.-]', $this->dobFormat);
    		$dateArray= split('[/.-]', $date);
    		// $date is a string like 01-22-1975.
    		if (count($dateArray) !== 3)
    			return $this->FormatMessage($this->LanguageArray[27]);
    		$daypos = array_search('%d', $formatArray);
    		$monthpos = array_search('%m', $formatArray);
    		$yearpos = array_search('%Y', $formatArray);
    
    		// $dateArray is somethink like [0]=01, [1]=22, [2]=1975
    		// make a unix timestamp out of the original date string.
    		$timestamp = mktime(0, 0, 0, $dateArray[$monthpos], $dateArray[$daypos], $dateArray[$yearpos]);
    		return $timestamp;
    	}	


    Now you can have &dobFormat=`%d.%m.%Y` or `%m-%d-%Y` or `%m/%d/%Y` or what else you want to have.

    Bruno



      -------------------------------

      you can buy me a beer, if you like MIGX

      http://webcmsolutions.de/migx.html

      Thanks!
      • 28033
      • 925 Posts
      Would you mind having this included in the SVN code? I’d think this could be very helpful. wink
        My Snippets
        -> PopUpChunk v1.0
        • 4172
        • 5,888 Posts
        I have included it in the code from svn, where or how can I post the modified code?
          -------------------------------

          you can buy me a beer, if you like MIGX

          http://webcmsolutions.de/migx.html

          Thanks!
          • 13428 ā˜† A M B ā˜†
          • 1,031 Posts
          Included the modification in the current trunc in the SVN.

          Regards
          Jako
            • 4172
            • 5,888 Posts
            Thanks for that Jako smiley
              -------------------------------

              you can buy me a beer, if you like MIGX

              http://webcmsolutions.de/migx.html

              Thanks!