-
Posts
1,412 -
Joined
-
Last visited
-
Days Won
18
Everything posted by Juergen
-
Thanks Lostkobrakai this was a mistake, I am switching between Joomla and Processwire and therefore I wrote TinyMCE. I will check out the link you provided. Thanx
-
Hello @ all I use the Tiny MCE editor and I want to remove some of the settings for the tables. The editor offers some attributes which are obsolent (f.e. width and height). It also offers to change the paddings or to show a border around the tables or to change the alignment. I want to disable all of them because customers are always irritated and I use CSS to make all the tables look like the same. Has someone dealed with the same problem and has found a way to disable this settings in the editor? Best regards Jürgen
-
Today I had to output notes in a form at the frontend. This little code snippets show you how it can be done via the API: 1) One language site: $notesofmyfield = $page->fields->get("myfield")->notes; echo $notesofmyfield; 2) On a multilanguage site if ($user->language->name != 'default') { $notes = "notes{$user->language}"; } else { $notes = 'notes'; } $notesofmyfield = $page->fields->get("myfield")->$notes; echo $notesofmyfield; Happy coding!!
-
Userimage and resize doesnt work on frontend with API
Juergen replied to Juergen's topic in API & Templates
I have changed the image settings from "auto" to "single element (null if empty)" and now it works. Thanks for your efforts -
Userimage and resize doesnt work on frontend with API
Juergen replied to Juergen's topic in API & Templates
$userimage = $user->userimage->first() and $userimage = $user->userimage return both the same array with var_dump: object(Pageimages)#656 (2) { ["count"]=> int(1) ["items"]=> array(1) { ["bewerbungklein-1.jpg"]=> string(20) "bewerbungklein-1.jpg" } } Strange behaviour because if the image is in a page template like $pageimage = $page->userimage this will work. -
Hello @ all, I added a profil image to the user template in the backend. Unfortunately I am not able to resize the image in frontend. $img = $image->size($x, $y) This function doesnt work for images which are stored in the user template. Here is the complete code $userimage = $user->userimage; if ($userimage){ $options = array( 'quality' => 90, 'upscaling' => false, 'cropping' => 'north' ); $img = $userimage->size(80, 100, $options); echo '<img src="'.$img.'"/> } I always got this error: Error: Exception: Method Pageimages::size does not exist or is not callable in this context (in /home/.sites/24/site1275/web/wire/core/Wire.php line 350) Imagefield setup: Number of allowed images = 1 Format = auto Is it not possible if I call an image from the user? Thanks for your answeres
-
Yes that was the problem (Hint: This code is for multilingual site): You have to insert the following code to get the values in different languages: if ($user->language->name != 'default') { $title = "title{$user->language}"; $value = "value{$user->language}"; } else { $title = 'title'; $value = 'value'; } Then you can start to create the options for the select $storedgender = $user->YOUROPTIONFIELDNAME->id; $genderoptionstag = ""; //make select for gender options $genderoptions = $fieldtypes->get('FieldtypeOptions')->getOptions('YOUROPTIONFIELDNAME'); foreach($genderoptions as $option) { $genderid = $option->id; $gendervalue = $option->$value; $gendertitle = $option->$title; if ($storedgender == $genderid) { $genderstatus = " selected"; } else { $genderstatus = ""; } $genderoptionstag .= "<option$genderstatus value='$genderid'>$gendertitle</option>"; }; //here you can output the option tags wherever you want (in my case in the user frontend form) echo $genderoptionstag;
-
Hello at all, I have added a select field with the option field type where the user can select the gender (mister or miss) to the user template. On the frontend the user has a profile page with a form where he can update his user data (if he/she is logged in). On the frontend form I call the gender option field in this way: //grab stored gender from DB $storedgender = $user->usergender; //make select for gender options $genderoptions = $fieldtypes->get('FieldtypeOptions')->getOptions('usergender'); foreach($genderoptions as $option) { $genderid = $option->id; $gendervalue = $option->$value; $gendertitle = $option->$title; $genderselected = ""; if ($storedgender == $genderid) { $genderstatus = " selected"; } $genderoptions .= "<option$genderselected value='$option->id'>$option->title</option>"; }; //here you can output the option tags wherever you want (in my case in the user frontend form) echo $genderoptions; This renders the output in the way that I want but..... Problem: The comparison between the stored user gender (e.g. mister with the value 1) and the genderstatus "selected" doesnt work and I dont know why $genderselected = ""; if ($storedgender == $genderid) { $genderstatus = " selected"; } //this kind of comparison doesnt set the selected status correctly It always put the status "selected" to the first option in the foreach statement independent of the stored user gender. I cant figure out what the problem could be ? Has anyone an idea? I've been trying for some time to find a solution, but I can not find one. Best regards Jürgen
-
Why dont you check the image with an if statement? if($page->img){ $header_image = $page->img->size(800,250)->URL; } Or am I misunderstand your question?
-
Its done: https://processwire.com/talk/topic/2074-module-page-edit-field-permission/page-2
-
Be careful: break site if using with 2.5.25 in my case. Take a look at https://processwire.com/talk/topic/9565-upgrade-from-2524-to-2525-broke-the-site/#entry92025
-
Thats true but it worked quite well until this update. Anyway! My recommendation: Be careful if you use this module with wire version 2.5.25 - it brokes the site in my case
-
After uninstalling the PageEditPermission module the upgrade works as expected. I made the update and after that I reinstall the module once more. The error appear once more. I dont need this module at the moment, but this module causes the error. So it seems that it is not compatible with the latest version at the moment
-
Hello Horst, I have looked into that before I have posted this topic, but I couldnt find the reason on line 8 and 69. <?php /** * Provides the implementation for the PageEditFieldPermission::getModuleConfigInputfields method * */ function PageEditFieldPermissionConfig(array $data) { $inputfields = new InputfieldWrapper(); $f = wire('modules')->get('InputfieldMarkup'); $f->label = 'How to use this module'; $f->attr('name', '_instructions'); $config = wire('config'); $f->value = <<< _OUT <p> To use, create a <a href='{$config->urls->admin}access/permissions/'>new permission</a> and name it <b>page-edit-[field]</b>, replacing [field] with the name of the field you want to limit access to. <em>Better yet, use the tool below to create them for you and save some time.</em> </p> <p> Once your page-edit-[field] permission(s) exist, <a href='{$config->urls->admin}access/roles/'>add them to any roles</a> that you want to have edit access to the field. Roles that have edit access to a page, but do not have the required page-edit-[field] permission will not be able to see or modify the [field] in the page editor. </p> <p>Note that none of this applies to users with the superuser role, as they always have access to edit everything.</p> _OUT; $createPermissions = wire('input')->post->_create_permissions; if($createPermissions) foreach($createPermissions as $name) { $name = wire('sanitizer')->pageName($name); $permission = wire('permissions')->add("page-edit-$name"); $permission->title = "Access to edit the '$name' field"; $permission->save(); wire('modules')->message("Added permission: $permission->name"); } $inputfields->add($f); $f = wire('modules')->get('InputfieldCheckboxes'); $f->attr('name', '_create_permissions'); $f->label = 'Handy tool to create permissions for you'; $f->optionColumns = 3; $f->description = 'Check the box next to each field name you would like this tool to create a permission for you. This is the same thing as going to the Permissions page and creating them yourself, so this is here primarily as a time saver.'; $fields = array('name', 'parent', 'template', 'status'); $notes = ''; foreach(wire('fields') as $field) $fields[] = $field->name; foreach($fields as $name) { if($name == 'pass') continue; if(wire('permissions')->get("page-edit-$name")->id) { $notes .= "$name, "; continue; } $f->addOption($name); } if(!$notes) $notes = "[none yet]"; $f->notes = "Fields that already have permissions: " . rtrim($notes, ", ") . ". " . "Non-superuser roles that have page-edit access will no longer be able to see/edit these fields unless the appropriate permission is assigned to that role. "; $inputfields->add($f); return $inputfields; } Line 8 is function PageEditFieldPermissionConfig(array $data) { and line 69 is the closing bracket at the end
-
I use the upgrade module - it was not updated via FTP. It seems that PageEditFieldPermission Module doesnt work with the latest version.
-
After upgrade I got the following error: Compile Error: Cannot redeclare PageEditFieldPermissionConfig() (previously declared in /home/.sites/24/site1275/web/site/modules/PageEditFieldPermission/PageEditFieldPermissionConfig.php:8) (line 69 of /home/.sites/24/site1275/web/site/modules/PageEditFieldPermission/PageEditFieldPermissionConfig.php) This error message was shown because you are logged in as a Superuser. Error has been logged. I upgraded wire and index.php not the htaccess file. At the moment I changed it back to 2.5.24 to get it working. Does anyone struggle with the same problem?
-
Unexpected behaviour of field dependency and checkbox field
Juergen replied to Juergen's topic in General Support
For all users with the same problem: Downloading inputfields.js and the minified version from Github solved the problem. I had slightly different js files in my directory and they have caused the strange behaviour. Thanks to all contributors for their efforts to solve the problem. -
Unexpected behaviour of field dependency and checkbox field
Juergen replied to Juergen's topic in General Support
If I change $config->debug = true to $config->debug = false in config.php the strange behaviour is back. If I change it back then it works. I will add it to the minified version too because it will be loaded if debug is off. Addition: I have downloaded the latest min-version from Github and now it works also with debug off. I have updated my PW to the latest version but I had another js version - very strange!!!! Now everything works fine. -
Unexpected behaviour of field dependency and checkbox field
Juergen replied to Juergen's topic in General Support
Yep I think so! ProcessWire Core (Development) ProcessWire dev 2.5.24 2.5.24 Auf dem neuesten Stand But your piece of code was not in my JS file. -
Unexpected behaviour of field dependency and checkbox field
Juergen replied to Juergen's topic in General Support
This code doesnt add anything to the log files (wheter checked or unchecked). This piece of code solves my problem. Now checkbox fields work as expected as dependency field! Thank you so much for your effort!!!!! From now on you are no longer LostKobrakai - you are BestKobrakai Best regards Jürgen -
Unexpected behaviour of field dependency and checkbox field
Juergen replied to Juergen's topic in General Support
With condition "0" and checkbox checked: <li style="display: block;" class="Inputfield InputfieldCheckbox Inputfield_facebookaktivation..... With condition "0" and checkbox unchecked: <li style="display: none;" class="Inputfield InputfieldCheckbox Inputfield_facebookaktivation.... Work as expected!! With condition "1" and checkbox checked: <li class="Inputfield InputfieldCheckbox Inputfield_facebookaktivation.... With condition "1" and checkbox unchecked: <li class="Inputfield InputfieldCheckbox Inputfield_facebookaktivation.... As you can see no CSS-inline-style will be added!! -
Unexpected behaviour of field dependency and checkbox field
Juergen replied to Juergen's topic in General Support
Here is the problem: Field snintegration - Current value: 1 inputfi...s?v=13c (Zeile 20) Field snintegration - Matched? YES inputfi...s?v=13c (Zeile 20) Field snintegration - Current value: 0 inputfi...s?v=13c (Zeile 20) Field snintegration - Matched? NO inputfi...s?v=13c (Zeile 20) ---- inputfi...s?v=13c (Zeile 20) Determined that field "facebookaktivation" should be visible. inputfi...s?v=13c (Zeile 20) Field is already visible. The field is always visible independent if the value matches or not!!!!!! This only happens if I choose the value "1" as condition - with the value "0" it works as expected. -
Unexpected behaviour of field dependency and checkbox field
Juergen replied to Juergen's topic in General Support
This is from the console: Checkbox is checked: JqueryC...s?v=183 (Zeile 2) ------------------------------------------------------------------- inputfi...s?v=13c (Zeile 20) Field "socialnetworksintro" detected a change to a dependency field! Beginning dependency checks... inputfi...s?v=13c (Zeile 20) ---- inputfi...s?v=13c (Zeile 20) Start Dependency 0 inputfi...s?v=13c (Zeile 20) Condition type: show inputfi...s?v=13c (Zeile 20) Field: socialnetworkactivation inputfi...s?v=13c (Zeile 20) Operator: = inputfi...s?v=13c (Zeile 20) Required value: 1 inputfi...s?v=13c (Zeile 20) Field socialnetworkactivation - Current value: 1 inputfi...s?v=13c (Zeile 20) Field socialnetworkactivation - Matched? YES inputfi...s?v=13c (Zeile 20) ---- inputfi...s?v=13c (Zeile 20) Determined that field "socialnetworksintro" should be visible. inputfi...s?v=13c (Zeile 20) Field is already visible. inputfi...s?v=13c (Zeile 20) ------------------------------------------------------------------- inputfi...s?v=13c (Zeile 20) Field "Inputfield_fieldset1" detected a change to a dependency field! Beginning dependency checks... inputfi...s?v=13c (Zeile 20) ---- inputfi...s?v=13c (Zeile 20) Start Dependency 0 inputfi...s?v=13c (Zeile 20) Condition type: show inputfi...s?v=13c (Zeile 20) Field: socialnetworkactivation inputfi...s?v=13c (Zeile 20) Operator: = inputfi...s?v=13c (Zeile 20) Required value: 0 inputfi...s?v=13c (Zeile 20) Field socialnetworkactivation - Current value: 1 inputfi...s?v=13c (Zeile 20) Field socialnetworkactivation - Matched? NO inputfi...s?v=13c (Zeile 20) ---- inputfi...s?v=13c (Zeile 20) Determined that field "Inputfield_fieldset1" should be hidden. inputfi...s?v=13c (Zeile 20) Field is now hidden. inputfi...s?v=13c (Zeile 20) 1 visibility changes were made. inputfi...s?v=13c (Zeile 20) InputfieldWindowResizeActions() Checkbox is not checked: JqueryC...s?v=183 (Zeile 2) ------------------------------------------------------------------- inputfi...s?v=13c (Zeile 20) Field "socialnetworksintro" detected a change to a dependency field! Beginning dependency checks... inputfi...s?v=13c (Zeile 20) ---- inputfi...s?v=13c (Zeile 20) Start Dependency 0 inputfi...s?v=13c (Zeile 20) Condition type: show inputfi...s?v=13c (Zeile 20) Field: socialnetworkactivation inputfi...s?v=13c (Zeile 20) Operator: = inputfi...s?v=13c (Zeile 20) Required value: 1 inputfi...s?v=13c (Zeile 20) Field socialnetworkactivation - Current value: 1 inputfi...s?v=13c (Zeile 20) Field socialnetworkactivation - Matched? YES inputfi...s?v=13c (Zeile 20) Field socialnetworkactivation - Current value: 0 inputfi...s?v=13c (Zeile 20) Field socialnetworkactivation - Matched? NO inputfi...s?v=13c (Zeile 20) ---- inputfi...s?v=13c (Zeile 20) Determined that field "socialnetworksintro" should be visible. inputfi...s?v=13c (Zeile 20) Field is already visible. inputfi...s?v=13c (Zeile 20) ------------------------------------------------------------------- inputfi...s?v=13c (Zeile 20) Field "Inputfield_fieldset1" detected a change to a dependency field! Beginning dependency checks... inputfi...s?v=13c (Zeile 20) ---- inputfi...s?v=13c (Zeile 20) Start Dependency 0 inputfi...s?v=13c (Zeile 20) Condition type: show inputfi...s?v=13c (Zeile 20) Field: socialnetworkactivation inputfi...s?v=13c (Zeile 20) Operator: = inputfi...s?v=13c (Zeile 20) Required value: 0 inputfi...s?v=13c (Zeile 20) Field socialnetworkactivation - Current value: 1 inputfi...s?v=13c (Zeile 20) Field socialnetworkactivation - Matched? NO inputfi...s?v=13c (Zeile 20) Field socialnetworkactivation - Current value: 0 inputfi...s?v=13c (Zeile 20) Field socialnetworkactivation - Matched? YES inputfi...s?v=13c (Zeile 20) ---- inputfi...s?v=13c (Zeile 20) Determined that field "Inputfield_fieldset1" should be visible. inputfi...s?v=13c (Zeile 20) Field is now visible. inputfi...s?v=13c (Zeile 20) 1 visibility changes were made. -
Unexpected behaviour of field dependency and checkbox field
Juergen replied to Juergen's topic in General Support
Markups: 1) Checkbox not checked: <input id="Inputfield_socialnetworkactivation" class="FieldtypeCheckbox" name="socialnetworkactivation" value="1" type="checkbox"> 2) Checkbox checked: <input id="Inputfield_socialnetworkactivation" class="FieldtypeCheckbox" name="socialnetworkactivation" value="1" checked="checked" type="checkbox"> As you can see in the source code the value is always 1, the difference is only checked="checked" In the log files no entry! -
Unexpected behaviour of field dependency and checkbox field
Juergen replied to Juergen's topic in General Support
Outputting the value in frontend shows 1 or 0 as expected. <?php echo $page->mycheckboxfieldname;?> The form is only an admin form to create content in the backend and there I am not able to change the values of the checkboxfield.