Developer forum

Forum » CMS - Standard features » "Min side" med brugernavn som URL

"Min side" med brugernavn som URL

Rune Skovbo
Reply

Har jeg i DW mulighed for at lave en ”min side”, hvor URLen bliver mit brugernavn eller et ID?

Sådan at hvis jeg som ny bruger, signer up til at blive kunde, så får jeg en side ala dynamicweb.com/runeskovbo – det vil så være her jeg kan se mine tidligere ordre, redigere profilen og lignende.

Tillægsspørgsmål: HVIS det er muligt at lave en side med unik URL, som beskrevet ovenfor, kan man så lave den delbar? Altså så den ikke ligger bag login (det skulle dele af siden naturligvis gøre). Her vil jeg så kunne dele mine favoritlister eller andet.

/Rune


Replies

 
Nicolai Pedersen
Reply

What? Me not understand Danglish :-).

Lets say you create a page called /profile - and that page shows the users profile. If the user is logged in, they will of course see their profile on that page and it would be different for each user eventhough the url is the same.

If that is the page you want to be called just /{name-of-user} that is a problem. You can however do that if it is ok that it is called /profile/{name-of-user}.

Since it would be the page /profile the /{name-of-user} does not have an impact on what happens on the page, except of being in the URL.

/profile is rewritten to /Default.aspx?ID=123 - /profile/{name-of-user} should then link to /Default.aspx?ID=123&userid=456.

To do that, you can create a UrlProvider. Those are pretty simple to do. See dump#1 and the example in UserUrlProvider.zip

With that you will have the profile on the /profile/{name-of-user} url if the user logs in or have autlogin.

To login the user on that page automatically based on the AccessUserID (which you now have in the URL because of the UserUrlProvider), you can write a piece of code that does that for you. An example attached in PageLoadedObserver.zip that does that. One catch is though, that it will not work if you are not storing passwords in clear text in database...

There is no publically available authentication methods that can login users without their password... For security reasons.

Capture.PNG
 
Rune Skovbo
Reply

Yeah, sorry for the danish part - glad you figured it out ;-)

I actually wanted to update the thread name to "Public user page, with unique URL" (or something like that), but I i'm not able to edit the title.

Anyways... Thanks for the indepth reply!

 So that seams to cover my first question: "Can you create a unique page per user, named username og ID".

To follow up with my second question: "Can that page be shareable". Does that mean that the /profile/runeskovbo page will not be behind login and will indeed be shareable?

Again, the idea is that, while im logged in, I can add products to my favourite list and that list will then be visible to anyone on "my page".

 
Nicolai Pedersen
Reply

Hi Rune

Example 2 in the thread above is a shareable page. Problem is that the code actually logs in the user, so that would be another problem. Because then the anonymous user will be able to go to the products and add other products etc.

If you use the new indexing engine, you can use a small macro to give you a criteria for the indexing to return the products on your whishlist - in that way you can get a product list using the catalog module with the whishlist... See dump and example attached.

Capture.PNG
 
Rune Skovbo
Reply

Hi Nicolai

Yeah that's what I was afraid of. We only want other users (or non-users) to see the lists - not add to them. Also there's the whole "edit user" part that should be locked to the actual user.

We are definitely going to use the new index, so the supplied example of outputting a specific users favourite list looks great!

But just so I understand you correctly, by combining your example 1 in your first post and this way of outputting a favourite list - does that mean that I can automatically create a unique page for each user (/profile/runeskovbo) where I can output the users favourite list and that is accessible without a login? Or is it the whole "/profile/runeskovbo" part that poses a problem?

/Rune

 
Nicolai Pedersen
Reply
This post has been marked as an answer

Combining example 1 and the indexing macro will give you exactly what you want. The favorites list without the login, and edit user/favorites for the logged in user.

BR Nicolai

Votes for this answer: 1
 
Rune Skovbo
Reply

Perfect!

Thanks Nicolai :-)

/Rune

 

You must be logged in to post in the forum