-
Posts
118 -
Joined
-
Last visited
Posts posted by hollyvalero
-
-
On 3/10/2017 at 2:55 PM, fbg13 said:
@modifiedcontent Works the same as everywhere else, you have a form, form gets submitted, you process it (do what you need with the values submitted).
I showed you how to save the values in a page, the same way you can create a user.
<?php // $input->post->username same as $_POST["username"] if($input->post->submit) { $u = new User(); $u->name = $input->post->username; $u->email = $input->post->email; $u->pass = $input->post->password; $u->registrationDate = time(); $u->addRole("member"); $u->save(); }
I am about to ask a big, stupid question... having gone through 50 pages of user, login, registration stuff. I can easily create a form - or use formbuilder - to create a simple registration form for a couple levels of users (roles = subscribers, contributors) and I can easily send those entries to a page structure like
Pages
--- Users
------Subscribers
-- Bill Smith, etc.
------Contributors
-- John Jones, etc.
This creates a directory of pages, assigned roles, and page access based on role, but this doesn't put those people into: ACCESS > USERS >
My user data lives in Admin > Access > Users -- not in the document tree. If I want to have user accounts, doesn't Bill Smith, in the example above, have to be in both locations? Or, at least Admin > Access > Users? This is a conceptual problem, not a code problem... as a new user of PW, I don't know where my logged in users are supposed to live -- and if I use a form, how to get them there.
-
On 11/23/2013 at 6:04 AM, ryan said:
In this particular case, the users don't get to directly edit a page they just created.
This is exactly what I am doing... and I am using your formbuilder. I have a couple of registration forms - one shorter, one longer. The submissions are tagged as either subscribers or contributors and sent manually, to the document tree where I created:
users
--subscribers
-----name
--contributors
-----name
Contributors have access to the submission form pages that work like the example you cited to send data but not edit. Subscribers have access to view full detail pages, but they don't submit anything.Getting these entries into Admin > Access > Users is the question.
It seems that users should be managed through this internal function since that provides login, reset password, etc. And in the back end, I can always add users manually, but I'm not sure (read: clueless) as to how to get those three fields: email, name, roles from the collected form entry into users...
-
1 minute ago, arjen said:
We didn't define the $image variable. How about this?
<?php $features = $pages->find("template=newsitem, limit=3, sort=-date"); foreach($features as $feature) { $img = $feature->image->size(320, 180)->url; echo " <div class='column is-4' >" . "<img src='$img' alt='' />" . "<h3 class='title is-4'><a href='{$feature->url}'>{$feature->title}</a></h3>" . "<p><span class='date'>{$feature->date} • </span>" . "{$feature->summary}</p>" . "</div>"; }
YAY!! That worked!!! Thank you!
-
5 minutes ago, arjen said:
This should work:
<?php $features = $pages->find("template=newsitem, limit=3, sort=-date"); foreach($features as $feature) { $img = $image->first()->size(320, 180)->url; echo " <div class='column is-4' >" . "<img src='$img' alt='' />" . "<h3 class='title is-4'><a href='{$feature->url}'>{$feature->title}</a></h3>" . "<p><span class='date'>{$feature->date} • </span>" . "{$feature->summary}</p>" . "</div>"; }
You can read more in the docs. On why you should use first() - or not.
So this gives me: Call to a member function first() on a non-object (line 7 -- which is the line:
$img = $image->first()->size(320, 180)->url;
And most of my errors seemed to be like this. The field is a single image field, not a multiple image field.
-
1 minute ago, kongondo said:
Nothing wrong with using the variable $features. What I suspect is that your image field is set to hold (and return) more than one image, i.e. an array. So, calling the resize function on an array won't work.
** Actually the field is a single image field called "image" ... used for news features that have one teaser image...
-
I came across a foreach example that I was able to customize a bit without several error messages. Yes, I am new. Be kind... coming from Modx. Basically, 80% of what I need in most web development is: bring back a bunch of fields from THIS parent page or THIS template... and display a limited number... sorted by whatever.... home page features, carousels, masonry... it's everywhere
This is a basic sample for news items on a sample home page - 3 across the bottom. What I can't seem to incorporate is the ability to say: $img = $image->size(320,180);
No matter what image size has been uploaded, in the display we want it to be 320 px by 240px. I can do the images alone... foreach($images as $image) but I can't seem to get that into this foreach and I assume it's because I am using $features at the top ... I'd be happy to call it $pages or $penguin or anything... I just want to keep the ability to use the same thing in about 3-6 locations within a website by changing the template name... since this is a very common function.
Thank you!
$features = $pages->find("template=newsitem, limit=3, sort=-date"); foreach($features as $feature) { echo "<div class='column is-4' >" . "<img src='{$feature->image->url}' alt='' />" . "<h3 class='title is-4'><a href='{$feature->url}'>{$feature->title}</a></h3>" . "<p><span class='date'>{$feature->date} • </span>" . "{$feature->summary}</p>" . "</div>"; }
FrontendUser: login, logout and register users / members
in Modules/Plugins
Posted
I read through the multiple parents post. All my users basically enter the same 6 fields. They get assigned one of two roles depending upon whether they are just subscribing to content, or contributing content. I tried creating a user registration form... got it to create (albeit missing data, no follow up page, and ugly) to access > users ... but I'd need it to also notify the admin that a new user is waiting.