-
Posts
1,360 -
Joined
-
Last visited
-
Days Won
49
Everything posted by flydev
-
Yes it could be faster optimizing the query but it could depend on the approach used on your pages tree. In this specific case I think you could do something already solid with the pw api. When you have a moment, you can take a look at this discussion and module (the old thread).
-
Need help to output flag icon in drop down (multi language)
flydev replied to Flashmaster82's topic in General Support
Sorry for the short answer. I think you are close, try to write $language->language_icon->first()->url or $language->language_icon->url [...] // output the option tag echo "<option$selected value='$url'> {$language->language_icon->first()->url} $language->title </option>"; [...] -
A quick example : $userPassword = $input->post->password; // user input foreach ($pages->get('/')->children as $p) { // iterate all pages $passwordField = $p->password; // get the password field if(!$passwordField || !$passwordField->matches($userPassword)) continue; // not authorized echo "'{$p->title}' Authorized"; } Edit: Nop, you don't need to store the user password, just check it against the password field stored in the page you are looking for. PS: We posted at the same time, let me know if you got it ?
-
Like I said in my previous example, to get the hash : $hash = $pages->get('/passwords/')->password->hash; Install TracyDebugger (or use var_dump() on $hash) and try my code posted earlier. You will see the hash and the salt.
-
So I assume you have a field called "email" in the template "firma" (correct ?). If its not the case, the Find-Page tool will not work as the user template is a system template. Anyway, to have a result here, you have to check your password with the HASH you get and not the plain text password. The tool do not convert the password to a hash on the fly, same as example $pages->find("a selector") will not work with a plain text password; And ProcessWire do not store the plain text password, so trying to compare it here do not make sense. With hash comparison : With plain text password comparison :
-
with the thread I linked above, you can achieve in two lines what you want : $password = 'password1337'; // user input password $hash = $pages->get('/passwords/')->password; // password field from page "passwords" $result = $hash->matches($password); // check if password hash equal to stored password (hash) bd($result); // dump the result with TracyDebugger - return true or false easy as always..
-
Need help to output flag icon in drop down (multi language)
flydev replied to Flashmaster82's topic in General Support
This is just a frontend example for inspiration (should work as is) - the flag image is set trough CSS (gf-if and gspr class) but could be an image or whatever. $langswitch = ''; foreach($languages as $language) { if(!$page->viewable($language)) continue; // is page viewable in this language? if($language->id == $user->language->id) { // current user language $langswitch .= "<li class='current'>"; } else { $langswitch .= "<li>"; } $url = $page->localUrl($language); $hreflang = $homepage->getLanguageValue($language, 'name'); $langswitch .= "<a hreflang='$hreflang' href='$url'>$language->title<b class='gf-if gspr {$language->name}'></b></a></li>"; } echo "<ul class='langswitch'>{$langswitch}</ul>"; -
-
okay ? PS: to update the modules directory, just re-submit the module and the module will be updated automatically in a second.
-
Installed a stock ProcessWire 3.0.102 I Downloaded the module RockFinder 1.0.0 I installed RockFinder I installed ProcessRockFinder I clicked Setup > RockFinder tester I have the same warning / error. Just for testing I replaced InputfieldRockGrid on line 50 by InputfieldTextarea, I can access the process module.
-
ProcessWire 3.0.98 PHP 7.0.10 I just installed the module from your Gitlab repo then I clicked Setup > RockFinder tester and the error happen. I think you can't reproduce this error because you have InputfieldRockGrid (called at line 50 in ProcessRockFinder.module.php) but its not shipped with module. That explain the warning. wow those smileys are big lol
-
Please submit this gold module to the modules directory so we can update it in one click ? Edit: Just re-installed the module from scratch, I got an error when I try to access the RockFinder tester, see the attached screenshot :
-
Already glad you switched from WP to PW ???
-
I think I am missing something, because to achieve what you asked, you have to write : [...] foreach($stories as $story) { if(count($page->imagefieldname)) { // images exist, we show the div echo "<div>...</div>"; } [...] } [...]
-
I am out of idea right now - I have 15 minutes, if you want I can take a look at your install if you feel confident.. Edit: was a browser cache issue.
-
Sorry, I don't understand what you mean by 'post archive'. The if condition you write, only work if the imagefieldname field is configured to contain a max of one (1) image. It is the case ?
-
You might have modified your .htaccess file to work on localhost and a subdirectory. Now, you should double check the .htaccess file, in particular this section : # ----------------------------------------------------------------------------------------------- # 11. OPTIONAL: Set a rewrite base if rewrites aren't working properly on your server. # And if your site directory starts with a "~" you will most likely have to use this. # ----------------------------------------------------------------------------------------------- RewriteBase / # RewriteBase /pw/ # RewriteBase /~user/ How is looking your ?
-
try updating your config.php with your new site url : $config->httpHosts = array('your.newsite.com');
-
Hi, more infos: https://processwire.com/api/fieldtypes/images/
-
Its one of the new Facebook security things yes. Please have a read to this article and please don't slap me with a large trout, its a WP oriented blog ! ? https://wp-native-articles.com/blog/news/how-to-fix-facebook-apps-error-cant-load-url-domain-url-isnt-included-apps-domains/
-
ok this time is good, you need to put your markup after the if condition. <?php //Display current user image $upload_path = $config->paths->assets . "files/avatar_uploads/"; $f = new WireUpload('userimage'); $f->setMaxFiles(1); $f->setMaxFileSize(1*1024*1024); $f->setOverwrite(true); $f->setDestinationPath($upload_path); $f->setValidExtensions(array('jpg', 'jpeg', 'png', 'gif')); if($input->post->form_submit) { if(!is_dir($upload_path)) { if(!wireMkdir($upload_path)) throw new WireException("No upload path!"); } $files = $f->execute(); if ($f->getErrors()) { foreach($files as $filename) @unlink($upload_path . $filename); foreach($f->getErrors() as $e) echo $e; } else { $user->of(false); $user->profile_picture->removeAll(); // wirearray (line added by @horst: explanation is three posts beneath) $user->profile_picture = $upload_path . $files[0]; $user->save(); $user->of(true); @unlink($upload_path . $files[0]); } } // here $userImg = $user->profile_picture->first(); echo '<img src="'.$userImg->url.'">'; ?> <form class="forum-form" accept-charset="utf-8" action="./" method="post" enctype="multipart/form-data" > <input type="file" id="attach" name="userimage" accept="image/jpg,image/jpeg,image/gif,image/png" /> <input type="submit" name="form_submit" value="Submit"/> </form> and if you want to avoid a warning in imageExtra, then you should assign a title to the picture_profile field : [...] $user->profile_picture->title = ''; // or whatever $user->save() [...]
- 24 replies
-
- 1
-
- image fields
- image upload
-
(and 1 more)
Tagged with:
-
oops, no too fast ?
- 24 replies
-
- 1
-
- image fields
- image upload
-
(and 1 more)
Tagged with:
-
@rareyush sorry, its a custom function, you can copy paste the code in _func.php or where you want : /* * replace the last occurence of $search by $replace in $subject */ function str_lreplace($search, $replace, $subject) { return preg_replace('~(.*)' . preg_quote($search, '~') . '~', '$1' . $replace, $subject, 1); }
-
Hi @theo is there something in the apache / nginx / php* logs ?
-
Hello @Sanyaissues , I was not aware of the reCAPTCHA v3 but it will be definitely implemented. I will wait a bit more documentation as I already tried to get it working but without success. Thanks for your interest ?