Jump to content

nghi

Members
  • Posts

    57
  • Joined

  • Last visited

Posts posted by nghi

  1. Wao! thank you so much statestreet. You were the last piece to the puzzle. I just did a fresh install and read this entire thread.

    For those who are wondering 

    Follow arjen Instructions here: https://processwire.com/talk/topic/1025-multisite/#entry20399

    For dev or localhost you'll need to edit your host file for your second domain name so it points to the same directory

    EG.

     127.0.0.1   madbox.com

    You may need to edit your virtual host when it goes live so it points to the right directory. Doesn't really matter for dev.

    <VirtualHost 127.0.0.1>
    ServerName sandbox.com
    ServerAlias madbox.com
    DocumentRoot "C:/wamp/sandbox.com"
    <Directory "C:/wamp/sandbox.com">
    allow from all
    order allow,deny
    AllowOverride All
    </Directory>
    </VirtualHost> 
    

    Then in the site/config.php you'll need to edit the httpHosts variable (last one)

    EG.

    $config->httpHosts = array('sandbox.com', 'www.sandbox.com','www.madbox.com','madbox.com');
    • Like 2
  2. Oh figure it out =D!

    I added the permission in the installer and uninstaller function. Then on my client role I gave it the shop_orders permission. (You can also do it manually in the back end)

    public function install() {
    
    $permission = $this->permissions->get('shop_orders');
     if (!$permission->id) {
      $p = new Permission();
      $p->name = 'shop_orders';
      $p->title = $this->_('view Order mangement');
      $p->save();
     }
    }
    
    public function uninstall() {
     $permission = $this->permissions->get('shop_orders');
     if ($permission->id) {
      $permission->delete();
     }
    }
    
    //Also needed to modified this line and added check_access
    $orders = $this->pages->find('template=sc-order,limit=20,sort=-created, check_access=0');
    
    

    I didn't realize that you can set permission in modules in the getModuleInfo()

    public static function getModuleInfo() { return array(
      'title' => 'Orders Management',
      'summary' => 'Manage Shop orders',
      'version' => 002,
      'permanent' => false,
      'singular' => true,
      'permission' => 'shop_orders', <-------
      'requires' => array(
       "ShoppingCart",
       "ShoppingCheckout"
      )
     );} 
    • Like 1
  3. Not sure how to do this but I change the quality option for the size function but it doesn't seem to process it again when the page is load

    $image->size(500,0,array('quality'=>100))->url

    $image->size(500,0,array('quality'=>50))->url

    Also how would I regenerate all images on a site?

    I'm thinking about just using winhttrack to crawl through it unless there is some PW way to do it?

  4. I have used 000webhost in the past when i was a poor student.

    There servers get attack very often mostly hosted wordpress. Random Downtime happens often and IP throttle if there system thinks your an attacker when you make too many request E.G Uploading files, working live. etc. 

    Other then that it's pretty decent but it's not reliable if you need a site up and running all the time.

    *I was once hacked and their bot uploaded random stuff to the root it was not fun. =(

  5. You know you can now (PW 2.4) use font awesome icons with PW? E.g. "fa-search, title" in the "List of fields to display in the admin Page List" would, in the page tree, display the title and the search icon next to the pages that use that template. Is that what you are asking?

    Yes kind of, I can get the font awesome icons to appear but I only want icons to appear within certain conditions.

    So at first glance a user can tell if a page is being feature base on a date range. 

  6. Figure it out, Not sure if it's ideal...

    I commented out the session part of the following if statements but still keep the token to be check still. I also modified the time from an hour to a day.

    public function ___execute() {
    
    if($this->session->userResetStep >= 2 && $this->session->userResetID === (int) $this->input->get->user_id) {
                                    return $this->step3_processEmailClick();
    protected function step3_processEmailClick() {
    
    if($result->num_rows && $id == $this->session->userResetID) {
    if($row['token'] && ($row['token'] === $token) && $row['name'] === $this->session->userResetName) {
    
    $query->bindValue(":ts", time()-3600, PDO::PARAM_INT); 
    
  7. Currently, I'm trying to send automatic email with a forgot password link after a user is created. so that user can create their own password within 24 hours

    But I keep getting the error telling me the session isn't the same.

    What i got so far...

    public function addUser($event){
        $u = new User();  
        $u->name = $new_user_name; 
        $u->email = $email; 
        $u->addRole("guest"); 
        $u->addRole("client"); 
        $u->save();
    
        $pfp = wire("modules")->get("ProcessForgotPassword");
    
        $user = wire("users")->get("name=$new_user_name"); 
        $pfp->sendemail($user);
    }
    
    
    public function sendemail($user) {
        $this->step2_sendEmail($user);}            
     
     

    The Module I'm looking at is ProcessforgotPassword and the function i think i should be looking at is step2_sendemail but I honestly do not know what to do at the moment. I tried commenting out the databinds but ya im drawing blanks.

    https://github.com/ryancramerdesign/ProcessWire/blob/master/wire/modules/Process/ProcessForgotPassword.module

  8. Hello all,

    I would like to add a standard Gmaps info window (the white balloon type with shadow) to my marker.

    I have a single marker on the map and use standard $map->render function.

    From the Gmaps API documentation about info windows I see that I somehow have to add something like

      var infowindow = new google.maps.InfoWindow({
          content: contentString
      });
    
    

    How would I go about that, can I create something like a hook event to extend the standard render function from the module or can I just add a piece of JS to the page?

    Any enlightenment would be much appreciated.

    Cheers

    gerhard

    In the MarkupGoogleMap.js you need to add the some code from the example you link @ https://developers.google.com/maps/documentation/javascript/examples/infowindow-simple

    You also might want to display different data from a page and wil need to modify the MarkupGoogleMap.module foreach loop and add custom fields to your template page.

    I've created a 2 fields called map_location_name and phone_number

    //Edit the MarkupGoogleMap.module  $out variable
    
    foreach($pageArray as $page) {
    $marker = $page->get($fieldName); 
    if(!$marker instanceof MapMarker) continue; 
    if(!$marker->lat) continue; 
    $url = $options['markerLinkField'] ? $page->get($options['markerLinkField']) : '';
    $title = $options['markerTitleField'] ? $page->get($options['markerTitleField']) : ''; 
    $map_location_name = $page->map_location_name ? $page->map_location_name  : '';
    $phone_number = $page->phone_number ? $page->phone_number  : '';
    $out .= "$id.addMarker($marker->lat, $marker->lng, '$url', '$title', '','$map_location_name','$phone_number'); ";
    }
    if(this.hoverBox){ //right above this line add the code below in MarkupGoogleMap.js
    var contentString = '<div class=\"chapter-bubble\">' + 
                        '<div class=\"chapter-bubble-title\">' + title + '</div>' +
                        '<div class=\"chapter-bubble-name\">' + map_name + '</div>' +
                        '<div class=\"chapter-bubble-number\">' + map_number + "</div>" +
                        '<div class=\"chapter-bubble-url\">' + '<a href=\"' + url + '\">Visit Chapter Site</a></div>';
          var infowindow = new google.maps.InfoWindow({ content: contentString });
          google.maps.event.addListener(marker, 'click', function() { infowindow.open(this.map,marker); }); 
    this.addMarker = function(lat, lng, url, title, icon, map_name, map_number) { //you'll need to add addition arguments to this line as well.
     
    • Like 3
  9. Figured it out.

        public function init() 
        {
            $this->pages->addHookAfter('save', $this, 'generateRegionSubPages');
        }
    
        public function generateRegionSubPages(HookEvent $event) 
        {
    	$page = $event->arguments[0]; 
        	if (!$page->isTrash && $page->template->name ==  'portal')
        	{
        		$templates = array(
        			array('name' => 'blog', 'title' => 'News'),
        			array('name' => 'volunteers', 'title' => 'Volunteers'),
        			array('name' => 'gallery', 'title' => 'Gallery'),
        			array('name' => 'events', 'title' => 'Events'),
        			array('name' => 'calendar', 'title' => 'Calendar')
        		);
    
        		foreach($templates as $template)
        		{
    	    		if ($page->children('template=' . $template['name'])->count()==0)
                            {
    		    		$sub_page = new Page();
                                    $sub_page->template = $template['name'];
    		    		$sub_page->parent = $page;
    		    		$sub_page->name = $template['title'];
    		    		$sub_page->save();
    	    		}
        		}
        	}
        }
    

    What I need:

    To be able to auto generate a page from a form that will also create multiple child pages using different templates

    I'm not really sure how I can accomplish this or how to get started.

    Can someone give me some advice?

  10. How would I go about customizing urls? I'm trying remove the portal parent from my url

    E.G

    /portal/catering/decorator

    /portal/catering

    /portal/restaurants/north

    /portal/restaurants/south

    to

    /catering/decorator

    /catering

    /restaurants/north

    /restaurants/south

    5xxWvAT.png

×
×
  • Create New...