Forum Academy Marketplace Showcase Pricing Features

How to generate URL for user to share

I want to create a dynamic text field which shows the url of a page that the user can copy and paste somewhere else, such as in a Google Doc, email etc.

The page is the user’s profile.

I have two problems with that:

  1. I can’t for the life of me figure out how to have an ID show up in the URL, even if I deploy live.

Right now, it’ll show, for example, “https://preacquaint.org/profile” in the browser’s URL bar. I’m not even worried about creating a unique slug. At the moment, I just need to figure out how to show the URL WITH the unique ID in it so that a user could paste that somewhere and someone else could visit their profile page, even if they are not a registered user of the site.

  1. Once that works, then I’d like to create a dynamic text field so that the URL of the user’s profile page appears in it so that they can copy it from there.

Again, I have spent several hours on my own first to try and figure it out before asking for help. I have solved several issues by myself in the last week, but this time I’m stuck once again.

Thank you in advance for any help anyone can provide.

Thanks for your precious suggestion.

Assuming you just want to ‘display’ the link on a page somewhere for users to see or copy (as opposed to actually send users to the URL) there are several ways to get the URL of a particular dynamic page…

The easiest is to use the ‘link’ expression in a text box. So in your case (assuming your profile page has a content type of User), use ‘insert dynamic data’ and select ‘User’s Link: Profile’ (‘User’ being the particular user who’s link you want to display -i.e. current user, current cell’s user, current page’s user, parent group’s user, or search for user etc.).

That will display the link to that particular user’s profile page (regardless of whether you’re in dev or live versions) - by default it will use the user’s unique ID, or if you’ve got a slug for the user it will use that.

You can also just use ‘website home URL:’ than manually type the page name (profile), followed by the dynamic unique ID (or slug) of whatever user you want to display.

If you want to actually send users to the dynamic profile page, then you can use the same methods above to create a ‘link’, or you can just use the ‘go to page’ workflow action, and send the ‘User’ data of whatever User you want to display on the page.

Again, by default, dynamic pages will display the Unique ID in the URL - but if you have a slug for that particular thing, then it will display that instead.

1 Like

Hi, thank you for kindly taking the time to help me.

It still isn’t quite working for me yet.

Here are the steps I took:

  1. I set the “Type of Content” on the profile page to “User”. I left the field “Backup field for URL” blank.
  2. On another page, I created a text field with the content set dynamically to “Current User’s link”, with the “Link Destination” set to “profile”.

It did generate a URL with a Unique ID, as you had said. However, when the URL is copied and pasted in a browser in which the viewer is not logged as a user (even on live deployment), only the static data on the profile page shows. In other words, the user’s dynamic data (name, completed fields, etc.) is absent.

Obviously, that defeats the purpose of my effort at that point.

Is there something that I am missing that you could identify?

So you know, the point of the site is to allow the user to create an appendix to a job resume, and then allow the user to copy and paste a link to provide to a potential employer… who will not have a user account on the site, but will be able to view the user data on the profile page. (Of course, all other pages of the user’s account will have a workflow to redirect anyone else away from them.)

Thanks in advance for any clarification you could offer.

How is your page content set up to get the data? What is the data source? It sounds as though you’re not getting the data to display from the current page’s user.

If you weren’t using a page content-type before (as you seem to suggest) then how were you populating the page with data?

If it wasn’t coming from the URL (either as a path or query parameter) I can only assume you were only ever displaying the current user’s data on the page?

In any case, you need to use the page’s user (not the current user) as the datasource for all other data on the page that will relate to that user, so check your data source on all your page elements and groups etc.

If you still can’t get it working then maybe sharing a link to the page or editor might shed some more light on any issues.

I’m beginning to see where you might be going with this question. Here is a screenshot

:

What you see from the page comes from 3 sources:

  1. The texts, “Part 2”, “I have answered…” and “Answer #1” come from regular text fields and show up when the link is copy and pasted into a browser.
  2. “Question #1: What…” comes from a multiline input with the dynamic data set to an option set. It also shows when the link is copied and pasted in a browser.
  3. “Current User’s Answer #1” is the problem. It comes from a multiline input with the dynamic data set to retrieve the data from the database. The data type is “User” and the field is “Answer #1.” The input is disabled, as the data was input by the user on another page.

“Current User’s Answer #1” is the problem. It comes from a multiline input with the dynamic data set to retrieve the data from the database. The data type is “User” and the field is “Answer #1.” The input is disabled, as the data was input by the user on another page.

So you’re displaying the current user’s data here (i.e. the person viewing the page) - which is why it’s empty when you open it in another browser or share the link.

My assumption was that you wanted to display data relating to the page’s user on the page? (not the current user - the person viewing the page).

In that case you need to use ‘current page’s user’ not ‘current user’ as your data source for the text.

Hi,

Setting “current page’s user” doesn’t work.

Let me re-state the issue differently.

I have a user. Her name is Jane. She is logged in to the site and has made selections in her “Settings” page which automatically populate her profile. Then, she sends the link of her profile to as many individuals as she wants. These people will click on the link she has sent them and will be able to see her profile without having to sign up to the site.

It has now become clear to me, using the link expression in a text box method, as you kindly suggested, will only show the page before any dynamic data is added.

What I am trying to do is to have the URL display the unique data.

What I mean is the following:

  1. When I’m logging as a user on my own website that I’m creating in Bubble, I see this link for the profile page: https://preacquaint.org/profile
    There is nothing showing after “profile”. That can’t be right.

  2. When I visit a listing on AirBnb and I’m not even logged in as a user, I see this:

https://www.airbnb.ca/rooms/46922240?adults=2&children=0&infants=0&check_in=2021-04-06&check_out=2021-05-04&federated_search_id=5e44a79b-a277-4da8-82cf-d1dbf5de1225&source_impression_id=p3_1614733123_S5XGgyjo0qm4XZif

Anyone in the world who selects that link will see that page. They are not the “Current Page User” who needs their data to come up: they don’t have data to pull. They are simply there to see Jane’s data without needing to be logged in. They don’t even have to know what site they are on.

In other words, how does YouTube generate a URL for a video that can be seen by anyone, whether that someone is logged in or not?

That is what I am asking about.

How do I make the uniquely identifying data appear in the actual URL?

Thanks.

Incorrect. Using an item’s ‘link’ will generate the dynamic link for the particular thing’s selected page, including the full URL path. So as long as the item exists in your database, it will generate a full dynamic link for the chosen thing e.g. www.mysite/mypage/databaseitem1 or www.mysite/profile/user1

When I’m logging as a user on my own website that I’m creating in Bubble, I see this link for the profile page: https://preacquaint.org/profile
There is nothing showing after “profile”. That can’t be right.

Indeed - that is NOT a link to a specific user’s profile - there is no path for a specific user, so Bubble can’t possibly know which User’s data you want to display on the page. Therefore when sharing that link, viewers will not see any dynamic data on the page.

Anyone in the world who selects that link will see that page. They are not the “Current Page User” who needs their data to come up: they don’t have data to pull. They are simply there to see Jane’s data without needing to be logged in. They don’t even have to know what site they are on.

You seem to be misunderstanding the concept of current page user and current user and getting the two things mixed up.

The current user is whoever is viewing the page - and as you rightly say, a person somewhere else in the world who doesn’t have an account doesn’t have any data stored in your database, so if you use ‘current user’ as the datasource there won’t be any data to display.

The Current Page User on the other hand is the User associated with the particular page, as defined in the URL. For example, if Jane has a profile page containing her personal data, as long as your profile page has a content type of User, then referencing the current page user will be referring only to Jane, whenever her unique ID or slug is in the URL path.

So when using the link www.mysite/profile/jane ‘Jane’ is the current page user - no matter who is viewing the page or where they are, logged in or not, the data on the page will be the data from Jane’s database entry.

How do I make the uniquely identifying data appear in the actual URL?

Bubble does this automatically for you - when viewing a dynamic page (i.e. a user’s profile) the URL structure will include either the user’s unique ID (if you don’t have a slug) or the slug e.g. www.mysite/profille/user1.

How you arrive at a dynamic page depends on how you’re navigating between pages in your app - the simplest way is using the ‘go to page’ action (e.g. profile page), and sending the required data (e.g. whichever user you want to display). Then that page will contain either the unique ID or the slug in the URL.

Without seeing your database or how you’re generating your links/navigation I can’t say what the issue you’re having is - so perhaps some screenshots outlining what you’re currently doing on your pages/workflows/database etc. will help to highlight where you’re going wrong.

1 Like

Hi,

I want to thank you from the bottom of my heart. Your last message has sorted me out. Without your help, I was stuck in a dark alley with nowhere to go. Every difficulty I was experiencing with this issue has dissipated. I’ve only been at web development and Bubble for under two months, and therefore, something that may be vividly clear to you might look like a brick wall to me. The time and patience you’ve deployed to see me through this perhaps means more to me than you might imagine. I will pay it forward. Thanks again.

Best,

Mario

1 Like

Glad you’ve got things working how you want them to now :slight_smile:

1 Like