Jump to content

androbey

Members
  • Posts

    91
  • Joined

  • Last visited

Everything posted by androbey

  1. Hi @flydev, thank you for your answer. It helped me finding my mistake (although I am not understanding what my mistake actually is). //this does not work (no output) $field = 'donationtext'.$lang; $test = $this->field; //this does work however $testArr = $this->data['donationtext'.$lang];
  2. Hi @Zeka, thank you for this link, didn't find that one. However, that did not worked out well for me. After applying the concept of Adrian, I always got the not default language outputted. I have a hardcoded version now. It's not good practice, but it does its job.
  3. Hi there, I feel like I have another rather stupid question, but I am stucked in a problem. I wrote a small module, which makes use of the multi-language option. The inputfield code looks like this: $donationText = $this->modules->InputfieldCKEditor; $donationText->useLanguages = true; $donationText->name = 'donationtext'; $donationText->label = 'Donation CTA Text'; $donationText->value = $this->donationtext; $donationText->required = true; $wrapper->add($donationText); My simplified render method in the module looks like this: public function renderDonationCTA(){ echo $this->donationtext; } However, when I call this method in my template code only the default language gets outputted. What did I miss or what can I do, in order to output the inserted text in the "right" language?
  4. Hi there, I was wondering if it is possible to use an image field with the popular "Simple Contact Form" of @justb3a? When I tried I got the following error message (without even "uploading" an image): Call to a member function path() on null in C:\xampp\htdocs\pw2\wire\modules\Fieldtype\FieldtypeFile.module on line 184 As I don't want to save messages on the server (so just sending an image), it shouln't be a security issue, I guess. But is it possible to use an image field with the SimpleContactForm module?
  5. Hi @szabesz, thanks for pointing out. Definitely will have a look at this module. Seems to be a more practicable way, like @Robin S wrote.
  6. Hi @Robin S, thank you very much for your reply. Really appreciate your help. You are right, in general my logic wouldn't make sense at all. In my case this field serves as a kind of archive (which is necessary to satisfy a duty to preserve records), even though I know it's not ideal. Anyway, I think I have still a lot to learn about hooks and how to use them. Have a good day!
  7. Hello, I'm rather new to ProcessWire, but love all the possibilities it gives us. Also, I'm a rather unexperienced developer, so please forgive me. What I like to achieve: I want to prevent users (that are not superusers) from deleting files (which are uploaded through/with a file field in ProcessWire) or at least to send a mail when someone deletes that file. I'm developing a kind-of intranet for a NPO in order to push digitalisation. However, for quality management, files should not be deleted unnoticed by not authorized persons. Is this kind of thing even hookable? I found with the help of Captian Hook, that there is a delete hook for fields and also this one: $this->addHookBefore('Fieldtype::deleteField', function(HookEvent $event) But I'm afraid that this won't help for my issue, will it? Here's my very first attempt of a module.. class Disabledelete extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'Disable File Delete Functionality', 'version' => 3, 'summary' => 'Should disable delete functionality for files.', 'singular' => true, 'autoload' => true, ); } public function init() { $this->addHookBefore("File::deleteField", $this, "disableDelete"); } public function ___disableDelete($event) { //But what to do here? (If even here!) } } Hope you can help me out there!
  8. Hi @flydev, thank you for replying. Works as expected. Thank you for your help!
  9. Hello again! Unfortunately I came across another problem. I have a "regular" ProcessWire setup and want to create a separate php script. That script should be executed by a cron job and is bootstrapped with my PW setup. Main goal is to send mails which are stored in a email field. My problem: I want to access a specific field from a template where only specific users have access to. Right now, the cron job is executed as "guest", of course. How can I bypass this restriction, so that I have access to that specific field (it's only one email field)? Does it make sense to set current user via api? Hope you can help me out there. Cheers, Andreas
  10. Hi bernhard, thank you for your tips. You're right, using a workaround I could nearly get the desired outcome. However, I would say that both solutions come with a huge downside (uploading more images than necessary..) .
  11. I think it would be a great advantage for images to have an option to translate image tags, alongside the translatable description field (when using PWs language feature at all). This feature could improve the multi language support in ProcessWire even further, thus the usability of it. As a side effect that would also mean, that image tags could be easily used with the search engine, when dealing with a lot of images.
  12. Hi @heldercervantes, thanks for your reply. I see and I was afraid to hear that. Personally, I wouldn't have a big problem using extra fields for that purpose, but it looses a lot of usability for the actual client using the feature. As I am using the build in API to find images based on tags (and the capabilities that comes along with that), it would mean a huge loss for my current implementation. Thanks also for the hint to add it to the feature request list. Will add it there.
  13. Hello there, I was wondering if it's possible to somehow translate image tags. Right now I have a page which outputs all images related to one tag in a single container (as there are many tags this results in various containers). Every container has a title (and id) with the tag string, but currently only in the language of the entered tags. Using the PW format inside the code like this does, of course, not work.. _x($variable,'translated Tag') Is there a way to achieve this, without using workarounds (like extra fields)? Cheers, Andreas
  14. Thank you both, Robin S and wbmnfktr! I managed to achieve the desired behaviour by setting a GET Variable in the redirect URL and adjusted the code. I already did prepend the "_init.php" file, but was probably overwriting the session variable.. Here's the code I use in my "_init.php": if(!$user->isLoggedin()) { //'returnID' is my GET variable and page id 1055 is my start page (not log-in page). if(isset($_GET['returnID']) && $page->id!=1055 ){ $session->set('returnPage', $_GET['returnID']); } } Thanks again, you helped me a lot.
  15. Hi @wbmnfktr, thanks for your reply. That code works fine, but only with a condition, which is problem for my current setup. Pre-condition that psy's code works is that "_init.php" gets loaded at all. As far as I see, that file only get's loaded when user role "guest" has access to the corresponding template, but not if restricted permission (and so redirection) is set in ProcessWire backend. However, only certain user roles should have access to the template. As a workaround I could add permission handling in the specific template, but then I would loose control in ProcessWire backend as I would have to hardcode user roles. Maybe I'm wrong with this or do you know how to set "returnPage" variable before ProcessWire redirection?
  16. Hello everyone, I'm rather new in developing with ProcessWire and loving it every day more. I found that new module "LoginRegister", which is amazing. However, I would be happy about one feature. I wasn't able to solve this myself. Is there a possibility to achieve, that a user is redirected to a site (which is denied for guest users) he actually wants to view? Let's say I have a restricted sub-page called "test", which redirects to LoginRegister login form if a user is not logged-in. Right now, the redirection after successful log in is static and points to a pre defined site (let's say: "welcome"). So when a user tries to call mypage.com/test and logs in successful he gets to mypage.com/welcome instead of mypage.com/test.. Hope you have some hints for me on how to achieve this.
×
×
  • Create New...