- 
                
Posts
7,529 - 
                
Joined
 - 
                
Last visited
 - 
                
Days Won
160 
Everything posted by kongondo
- 
	Excellent! Glad you got it sorted ?.
 - 
	Edit the field blog_images Go to its Details Tab Scroll down to the bottom to the Use Tags section. Enable tags using one of options 2 - 4. I normally use 2 (user enters tags by text input). Save
 - 
	Sorry about this. The documentation can be improved (even completed! ?). You need to add the tag to an image in your blog post. These are the images in the blog_images field in a blog-post template. See attached (zipped) animated GIF (it seems I cannot upload GIFs anymore). featured-image-blog.gif.zip
 - 
	Thanks for reporting this @DV-JF. Incidentally, @Ivan Gretsky reported the same warning yesterday in the GitHub repo ?.
 - 
	
	
				[SOLVED] Exclude a page from pagearray, before applying limit
kongondo replied to johnstephens's topic in API & Templates
I marked your topic (title) as solved ?. - 
	
	
				[SOLVED] Real estate site - project on start page
kongondo replied to brandy's topic in General Support
Looking forward to this! ? - 
	
	
				[SOLVED] Real estate site - project on start page
kongondo replied to brandy's topic in General Support
Definitely not! That's not how we roll in this community. I guess you should start here then? https://processwire.com/docs/start/templates/ It's always the name of the field :-) <?php namespace ProcessWire; // will yield its value // @note: the value can be as simple as a string or integer, or more complex, e.g. an array or object // @note: that field must be present in the template that this page uses $page->name_of_field; In other words the 'name of the field' is a property (some would say attribute) of that page. Just like things (humans, buildings, animals, etc) have properties/attributes: height, width, etc. Edit Also note that $page always refers to the current page, but the principle of 'name_of_field' still applies. For example: <?php namespace ProcessWire; // this page we are viewing // get a property from it. $height = $page->height;// height is the name of an integer field in the template used by this page echo $height; // get another page not currently in view // get it using its ID $anotherPage = $pages->get(1234); // this other page uses the same template as our 'current page' above // so, we can get its height property as well $anotherPageHeight = $anotherPage->height; echo $anotherPageHeight; // @note: we only echo 'simple' field values, i.e. those that do not return an array or an object, etc - 
	
	
				[SOLVED] Real estate site - project on start page
kongondo replied to brandy's topic in General Support
Welcome to the forums and to ProcessWire @brandy :-). I don't know how much of the docs and/or tutorials you have gone through already. If you haven't already seen the docs about $page and $pages. I'll also throw in selectors. You'll get along better and farther with these under your belt. - 
	Welcome to the forums @jonassalen, Have a look at this thread. It should answer your question, but the solutions might need a bit of tweaking since the case there was to 'preserve' default language pages.
 - 
	
	
				Front-end form to let Member edit specific fields
kongondo replied to modifiedcontent's topic in General Support
What does this mean exactly? No save? No post? ? Depends on the type of field. Plain text? Not repeaters by the looks of it. Maybe a little bit more info will help get better responses :-). - 
	Maybe a sign that it's times for a break ?. Sometimes it helps to 'speak out your code' to determine if it makes sense. Have a look at that line. tableofcontents_table, I assume, is your Profields Table. Reading that out loud, your code is saying, find me siblings (PLURAL) of this page and get me the value of its (SINGLE) tableofcontents_table field. Doesn't sound right, does it? It's like saying 'find me 10 oranges (PLURAL) and show me its (SINGLE) price. That's wrong. The question would be, which orange's price? We have 10 oranges here! It should read, 'find me 10 oranges (PLURAL) and show me their (PLURAL) prices. Aha, so, we are dealing with a collection. Any collection has to be iterated (foreach) to get each members individual value. Alternatively, you could ask for the first(), last() or nth() orange to deal with one member only. OK, so I need to get some sleep too. The docs say this about $page->siblings(): $toc is a PageArray. If you run this in Tracy console: <?php d($page->siblings("template=tableofcontents")->tableofcontents_table);// null You will get the value null, hence your error message since you are doing this null->render(). Now for some unsolicited advice ?. TracyDebugger is your best friend. The table clearly is there and clearly is a sibling and its template is as stated and the table also. Whilst this might be the case, it is best to always check if your selector/query returned something (and its type) before you start working with it. Hope this helps. ps: Profields Table has its own VIP support forum, accessible to you if you have a current subscription
 - 
	Glad you got it sorted! ?. Hmm. That sounds like one-too-many hoops. This is an interesting one. I have never really thought of the guest needing to have a preferred theme, but I can see the setting in Users > guest. Why would the guest need a theme at all? I'll have a think unless someone beats me to this.
 - 
	
	
				How to change the published date in the page dialog?
kongondo replied to RuiVP's topic in Getting Started
moderator note Nice try, but no. The article is about migrating from D8 to D9. I have removed your (advertising) link. - 
	I'll see if I can get time to have a play. From what I can tell, in AdminThemeFramework::init we have this code: <?php namespace ProcessWire; $user = $this->wire('user'); if(!$user->isLoggedin() && $this->useAsLogin) $this->setCurrent(); parent::init(); That checks if the user is NOT logged in and if useAsLogin is true... $this->setCurrent() is a method in the base class, AdminTheme. Like you said, $useAsLogin is native to AdminThemeFramework. However, AdminThemeFramework only uses it internally to see if to use setCurrent(). In AdminTheme::init, it will first check if there is a user specified theme and if that matches the current admin theme. If true, it will use setCurrent() to set it as the current theme. Else, it will fall back to what is specified in $config->defaultAdminTheme, if a value exists there. <?php namespace ProcessWire; if($adminTheme) { // there is user specified admin theme // check if this is the one that should be used if($adminTheme == $this->className()) $this->setCurrent(); } else if($this->wire('config')->defaultAdminTheme == $this->className()) { // there is no user specified admin theme, so use this one $this->setCurrent(); } I am guessing that in the init() method of your custom AdminTheme, you can use the above logic (first code) similar to what is in AdminThemeFrameWork::init (the bit about user not logged in....). Sorry if this doesn't make sense; Written in a hurry...
 - 
	Follow the rabbit from here: wire/core/AdminThemeFramework.php /** * AdminTheme Framework * * The methods in this class may eventually be merged to AdminTheme.php, * but are isolated to this class during development. * * @property bool $isSuperuser * @property bool $isEditor * @property bool $isLoggedIn * @property bool|string $isModal * @property bool|int $useAsLogin <------- this one? * @method array getUserNavArray() * */ $useAsLogin maybe?
 - 
	No worries :-).
 - 
	This line is the problem. It is messing up the selector string (see screenshot below). $sanitizer->entities is for entity encoding a string for output ( i.e. output to your page). What we want here is for input, hence $sanitizer->selectorValue should be enough. Remove the entities sanitizer (or use $sanitizer->text in its place to remove HTML) and you should get same results: sanitized selector results
 - 
	Haven't done it myself, but I guess it should be possible. Have a look at AdminThemeUikit settings when editing it in Admin / Module /. You see this: That shows it should be possible.
 - 
	
	
				#1214 - The used table type doesn't support FULLTEXT indexes
kongondo replied to vmo's topic in General Support
@vmo, Was there question you wanted to ask? - 
	Yes, it should. As long as you tell the JS what criteria to use to filter things. I don't know if you are using vanilla JS or some library but the principle is the same. You will filter out/in items to either remove/hide OR add/display depending on whether you filtered out or in. This is how we do it in Menu Builder, giving us flexibility to create all sorts of menus. If you have more questions specific to your use case (including the JS), please open a new thread so that we stay on topic in this thread. Thanks.
 - 
	What's your use case? Deeply nested arrays can get unwieldy and depending on how big they are, consume a lot of memory. I find it simpler to work with flat(ter) arrays with in-built relationships between the members. I then run that through a recursive function. Something like this: <?php namespace ProcessWire; $menu = array( 1 => array( 'id' => 1023, 'title' => 'Menu item 1', 'parent' => null, // this menu item does not have a parent/top level ), 2 => array( 'id' => 1024, 'title' => 'Menu item 2', 'parent' => null, ), 3 => array( 'id' => 3000, 'title' => 'Child 1 of Menu item 2', 'parent' => 1024, // its parent is item with ID 1024 ), 4 => array( 'id' => 3001, 'title' => 'Child 2 of Menu item 2', 'parent' => 1024, ), 5 => array( 'id' => 3003, 'title' => 'Child 1 of Child Menu item 2', 'parent' => 3001, ), 6 => array( 'id' => 1027, 'title' => 'Menu item 4', 'parent' => null, ), 7 => array( 'id' => 3009, 'title' => 'Child 1 of Menu item 4', 'parent' => 1027, ), 8 => array( 'id' => 4001, 'title' => 'Child 1 of Child 1 of Menu item 4', 'parent' => 3009, ), 9 => array( 'id' => 4002, 'title' => 'Child 2 of Child 1 of Menu item 4', 'parent' => 3009, ), );
 - 
	
	
				How to make a simple 'Delete My Account' link for users
kongondo replied to modifiedcontent's topic in General Support
Glad you got it sorted :-). Those are nice improvements you added there. - 
	
	
				How to make a simple 'Delete My Account' link for users
kongondo replied to modifiedcontent's topic in General Support
Here's the updated code with the above robustness baked in. In your template file with 'forget me form': <?php namespace ProcessWire; if ($input->post->forgetme) { if ($user->isSuperuser()) { echo 'You should not be here...'; $session->redirect('/'); } $items = $pages->find('template!=user,name=' . $user->name); if ($items->count) { // save items to delete to cache using unique cache names // cache the value, and expire after 10 minutes (600 seconds) $cache->save("forgetmepages-{$user->id}", $items, 600); $cache->save("forgetmeuser-{$user->id}", $user, 600); $session->redirect("/confirm-delete/"); } } In the 'delete confirmed' template file: <?php namespace ProcessWire; // get the uniquely-named caches $forgetmePages = $cache->get("forgetmepages-{$user->id}"); $forgetmeUserID = (int) $cache->get("forgetmeuser-{$user->id}"); // if we got the caches if ($forgetmePages && $forgetmeUserID) { // also check if we have the right user if ($user->id === $forgetmeUserID) { foreach ($forgetmePages as $item) { $item->delete(); // $pages->trash($item); } // delete the user $users->delete($user); // log them out $session->logout(); } } // get me outta here $session->redirect('/'); Hope this helps. - 
	
	
				How to make a simple 'Delete My Account' link for users
kongondo replied to modifiedcontent's topic in General Support
Btw, the code I supplied is not robust enough to cover a scenario of simultaneous forget mes! It uses the same cache name and will at best lead to a race condition or at worst, miss deleting pages since these would have been replaced in the cache. One way to overcome this is to create a cache with a unique name, e.g. 'forgetmepages-1234' where 1234 is the ID of the logged in user we want to 'forget'. We would the retrieve the cache as $cache->get("forgetmepages-{$user->id}"); We will need to check that the cache exists before doing the foreach(){delete). Secondly, and this is now probably covered in the above, it is best to check that we have a user ID at $cache->get("forgetmeuser->$user->id"); and that the (int) value of that matches the $user->id before we delete the user and his/her pages. I hope this makes sense. - 
	
	
				How to make a simple 'Delete My Account' link for users
kongondo replied to modifiedcontent's topic in General Support
Yes, please let me know. I did a number of tests and it worked for me. Speaking of which, I better get to mine as well! :-).