Custom Wizard Plugin


(Angus McLeod) #186

@tophee Are you able to check with her that she actually saw the wizard and what she did beforehand? That would help me figure out why she saw it, assuming she saw it. It’s tricky to debug something without any firm context, or reproducible steps.

@SmokedFish Could you show me what settings you have for that step? How is the create_topic action set up? What role does the “Reason and Comments” input play?


(Jacob) #187


This is my topic, there are no topic fields.
Capture
This is the “Reason and Comments” settings. I use the wizard for my game staff to give a ban reason for players they ban in-game. Its only purpose is for the admins to give a reason for the ban. It still works but you can’t hit enter, you have to click the done button.


(Christoph) #188

That may be difficult as she is a non-tech user who rarely logs into the forum at all. Is there any other way I might be able to get that information? Logs? Data explorer? Crystal ball?

Is there anything in particular that she could have done (or not done) that might have played a role?

I poked around a bit and found that she she had forgotten her password and requested a reset password email. Somehow, I have a strong suspicion that may have had an effect…?

I also noticed that, as a result of the PM, she showed up in the stats as a “new contributor”:

image

(As an aside: is there a way of avoiding that? Because it essentially means that if you use the wizard for new-user onboarding and have it produce a PM (in my case to register new users in their group), every new user always becomes a “new contributor” the day they sign up, effectively turning your “new contributor” stats into “new user” stats.)


(Angus McLeod) #189

@SmokedFish Thanks for the detail. I’ll look into it in the next couple of days; latest on the weekend.

She had never posted or created a pm before now? Perhaps she signed up for a new, seperate account with the same name?


(Christoph) #190

That’s what I first thought but it’s not the case. She’s using her 9 months old account and only that one.

Is it possible that the wizard somehow mistakes such users as new users?


(Angus McLeod) #191

hm well there’s something strange going on here then if you’re sure the new contributor stat is tied to her. Could it be tied to anyone else? That stat is unaffected by the custom wizard plugin. Unless she’s never posted anything in 9 months.


(Christoph) #192

I’m not sure I understand. Aren’t you basically saying the wizars does not turn anyone into a new contributor except if they haven’t posted before (which is the definition of a new contributor, no?). So the wizard doesn’t affect the stats except when it does?

But nevermind the stats for now if those have nothing to do with the main issue of the wizard sending an email where it shouldn’t.


(Angus McLeod) #193

The wizard simply lets a user create a new message or topic. The topic or message is created in the same way it would be if you created it via the composer, it just uses a different UI (i.e. wizard steps instead of the composer).

If the topic or message created via the wizard is the first topic or message the user has ever created, then yes this will effect the new_contributor stat. Not because the Custom Wizard plugin is intentionally set up to affect that stat, but because the creation of the topic or message via the wizard is effectively the same as if the user did it themselves via the composer.

The method that generates that stat is here. That method uses a class method on the User model called count_by_first_post which counts how many users created their first post within the period you’re looking at.

So in this case, if you’re sure the “New Contributor” stat is tied to the PM generated by the wizard then it is likely that this was in fact a new user account (and the Custom Wizard “After Signup” setting is functioning as expected) rather than a 9 month old one. Unless the 9 month old user had never posted a topic or sent a message before.


(Christoph) #194

Yes, that’s what I assumed and I understand that this may be impossible to circumvent, but I wanted to point out that there are good reasons to exclude posts created via the wizard from those stats, especially when the wizard is used for new user onboarding.

But back to the message that I received from the wizard even though only new users should get to see the wizard. How does the wizard determine whether a particular user is a new user or not? Is it possible that a password reset could confuse it?


(Angus McLeod) #195

@tophee You were right! There was indeed a scenario in which the after signup setting could force an existing user into the wizard on a password reset. I was skeptical, so thanks for persisting :+1:. Now fixed.


#196

Custom Wizard & Locations Plugin

Hi there,

I was recently requested to find a way to ease the template-based process to add a point to the map, i.e., creating a topic with a location and some structure. At first I studied the possibility to use a direct link to topic creation in the form: https://discourse.example.com/new-topic?category=shared+resources&tags=new-resource%2Cneed-review. This works great, but does not allow to pass, e.g, an URL as title so that it’s automatically linked to the topic.

So, I thought about making a wizard to do this, asking for a name and an url.

“Pasted Link” as topic title

Part 1: crafting an URL

I would have been happy with a simple wizard that shows a form for a name (required) and an URL (optional), so that I could craft the new-topic URL using the following algorithm:

https://discourse.example.com/new-topic?category=shared+resources&title=%s&tags=... % (url.blank? ? name : url)

Then the internal Discourse mechanism would create the topic accordingly. But this is not available since the Wizard does not support URL actions yet. (See first screenshot below.)

Part 2: casting a spell to create the topic

First I used the w{url} to set the topic title, but when the field is empty (e.g., because the resource pointed at does not have a web site), the topic does not get a title at all. Making the url field mandatory would block some legitimate additions. A way to use a required form value as a fallback (in my case w{name}) in case the first choice is empty would be great.

Required field as topic title

I chose to postpone the linked topic until it becomes possible to edit the topic and associate a link, and went for using a required field to ensure the new topic has a title.

Then of course I needed to populate the topic’s first post, which is nicely supported by the post creator.
I was happy to see that I could use a location field in my wizard. But I met a couple of issues:

  1. the displayed location form is a bit confusing, and does not match the one from the Locations plugin that is available from editing a topic’s location via the button. It would be great to use that one for consistency.
  2. said location can be output in the post itself via w{location} but it shows the JSON object, not a link to the map, and worse: it does not actually set location to the topic.

This might be related to Locations Plugin

  • Is there a way to replace the multiple location fields with a simple free form address + country selector (and set this to a default value)?
  • Is there a way to redesign the location input to use a combination of address search and map interaction?
  • Integrating Wizard and Locations better would help. I remember that I checked a box regarding the neighborhood that might affect how the form is displayed. I also remember that depending on the reverse geo-location provider the operations might change. In any case, I’d be available to help around.

Current Wizard

I end up with a 3-step wizard:

Topic Title

Topic Location

  • Note that the wizard starts with an error message: actually, this is more like guidance, and should probably not appear as red. It also makes it quite complicated to go through.

Topic Description

  • Here, the composer field does not match the regular composer, which is a bit confusing. If there’s a way to use the native Discourse composer that would be terrific.
  • The composer is too small, especially with regard to the blank space used. Making it resizable could help.

Way Forward

I’m not sure this is entirely related to the Wizard Plugin, as Locations are also involved. Feel free to move or split the discussion accordingly.

My take without looking at the code is that adding an action to generate a link might be easier than to tackle other options mentioned above and would totally satisfy my immediate need.

Thank you @angus for your awesome work! Using the wizard plugin has been a very nice experience so far.

Edit: display bug on mobile

I forgot to mention that the second step of the wizard is blocked on mobile because the “Back” and “Next” buttons appear below another part of the form. They should get a bump in the z-index on CSS.


(Angus McLeod) #197

Thanks for the detailed rundown :+1:

Could you explain the problem a bit more? What do you mean by “ease the template-based process to add a point to the map”?

I’m not entirely sure if I understand what you’re trying to achieve, but I think you could tackle this problem by mapping the “url” field directly to featured_link which is the topic property that adds a featured link to a topic. e.g.

It matches one version of that form. I will add the ability to customise the Locations Form in the Custom Wizard Location field this coming week.

Yeah, displaying locations in the body of posts is not supported, either via the Custom Wizard or just in the Locations plugin itself. I don’t plan to add support for that anytime soon.

In add fields you need to map topic.custom_fields.location to the location field. I just tested this and it’s working. There was a small issue (which I just pushed a fix for) that arose if you entered something in the ‘Custom Field’ box and then removed it, but it wouldn’t have affected standard custom_field mapping.

Somewhat confusingly the placeholder for the entry of a custom value was “Custom Field”. I’ve changed that to “Custom Value”: add custom value placeholder · angusmcleod/discourse-custom-wizard@1a0a4fd · GitHub

Could you send a screenshot of this? Thanks.


#198

I was using a topic template including comments (configured in the category), but people would get confused about what to do with all this, leaving most of the comment inline and requiring moderator edition to clean up. The template’s intention was to help people entering the correct location for the topic, but it didn’t work. Hence the idea to use a wizard instead.

Aha! I didn’t know that one. Indeed it should work!

Great! Exactly what I need.

I must say I have no clue how to take a screenshot from an Android.

@angus, as always, your help is most precious. Kudos!

I’m going to test and report.


#199

@angus, it works like a charm! Here’s an example of wizard-added resource on the map:

Now, I tried to add tags but failed:

2018-10-08-001738

Is there a documentation somewhere about “topic fields”? Maybe the tags need to exist in the first place… The error was confusing: the wizard window displays a red rectangle with <!DOCTYPE html> inside.

Note: in the screenshot, the custom topic fields work perfectly to add a featured link and location on the map.


(Angus McLeod) #200

Could you try it with pre-existant tags? That would help narrow it down.


#201

I tried tags, topic.tags, topic.tags.name, all with a single existing tag: no error, no tag.

A topic has_many :topic_tags and has_many :tags, through: :topic_tags, so I guess it would require calling create on the association with the tags ids.


#202

Hi @angus ,

Similar to Custom Wizard Plugin @SystemZ’s question.

I have users that have accepted the Customised User Field “Privacy Policy” and some that have not (form another platform import).
With your Wizard plugin, could I show the wizard to those who have not accepted the field yet? so if a user has accepted it already s/he wont see it but those who haven’t will be prompted to accept it?

Thanks.

A.


(Michał Frąckiewicz) #203

If you need only popup for GDPR or similar stuff, I think that this plugin is a little overkill.

I can recommend my friend’s plugin written specially for just this one purpose:

I use it in production for some time.


#204

thanks for this,

Yes, I only need it for GDPR purposes.

Would this one check if user has accepted Customised user field and then ask to accept if not ticked? if it has been accepted already then nothing happens…

I have to ask IT to install it and want to make sure that any plugin is the closest thing to what we need before asking them…

A.


(Angus McLeod) #205

Hey @testingsoftware did you take a look at the simple GDPR helper plugin? Does it do what you’re looking for? Or are you still interested in using this plugin?