Closed davefoord closed 2 years ago
Hi @davefoord ,
That sounds like it could be useful. I will look into it.
Best regards,
Michael
Hi @davefoord
I looked into your feature request. Unfortunately I have yet to find anything that would help me identify that the user is using the Moodle mobile app. If you know of any way or have seen another plugin do it, let me know.
What I can offer you is a set of {ifwebservice}{/ifwebservice} (and the NOT version). It won't be able to tell the difference between the mobile app and any other web service but should provide you with the functionality you are looking for since the app accesses Moodle through web services. I just don't want to call it {ifmobile} because the name would be misleading since it cannot actually tell if the user is coming from a mobile app.
Would this work for you?
Best regards,
Michael
Hi Michael - that would work fine for me.
I have no idea how plugins identify if someone is using the mobile app or not. I am just a PE teacher, that pretends to understand these things....
Hi Dave,
You asked for it - you got it!
The new {ifwebservice}{/ifwebservice} and {ifnotwebservice}/{/ifnotwebservice} tags are ready but currently only available here in GitHub.
I would really appreciate it if you could be so kind as to please try them both out and let me know how it goes. If everything seems to work as expected, these new tags will be included in the upcoming release of FilterCodes on Moodle.org/plugins around the same time as the launch of Moodle 4.0.
Best regards,
Michael
Hi Michael - I have installed the version from github and tested this on my Moodle (3.9.10) by adding the following lines of text to a page:
{ifnotwebservice}Don't show on mobile{/ifnotwebservice} {ifwebservice}Only show on mobile{/ifwebservice}
I was expecting the top line to show on laptop in browser, and the bottom line to show when using the Moodle app, however - it is showing the top line only on both browser and app. Am I doing something wrong?
Hi @davefoord
I was wondering if it would be a lot of trouble for you if I renamed these tags to ifmobile as you originally suggested instead of ifwebservice?
I have just been thinking that from a usability point of view, most people would use it to detect mobile access. Those people probably don't even know what a web service is.
Thoughts?
Michael
I will take a look at your issue. Which version of Moodle are you using?
Hi Micheal I am using 3.9.10 for my testing, I manage various other Moodles that are either 3.9 or 3.10 (and one that is 3.11)
It would be no problem for me if renamed to {ifmobile}
Thanks for the info. You are doing it correctly.
I will look into it. I don't currently have a local development instance that is setup for web services so I will need to get back to you on this.
Best regards,
Michael
Hi @davefoord ,
Could you please give it a try again using the latest code here on GitHub? Seems I forgot to push some of the code.
I tested specifically on Moodle 3.9 in a page resource to make sure that it will work for you on both a browser and the Mobile app. for you.
REMINDER: I renamed the tags from {ifwebservice} to {ifmobile}. Here is the test string that I am using.
Viewing on: {ifmobile}Mobile App.{/ifmobile}{ifnotmobile}Browser{/ifnotmobile}
Let me know if it works better for you now.
Best regards,
Michael
Do you think {ifmobileapp} would be better? I am just thinking that {ifmobile} could be misinterpreted as "mobile device" which could be a web browser on a mobile device.
Yes, I think that {ifmobileapp} is better than {ifmobile} - much clearer exactly what it is doing.
@michael-milette - I have installed the latest version from github, and I have used the same line of code that you did, but I am getting the same problem as before - e.g. the mobile app is showing 'Viewing on: Browser' rather than 'Viewing on: Mobile App'
Thanks
Hi @davefoord
As you can see in the screenshot below, it works correctly for me. I am using a freshly installed instance of Moodle 3.9. The only customization is the installation and activation of FilterCodes for Content and Headings. I also put it at the top of the list of filters. The results shown are a label in an otherwise empty course.
I need to be able to reproduce the issue in order to fix it.
Here are a couple of other plugins you can test. Please let me know if they work correctly for you:
If they don't work any better on your instance of Moodle, could you try it on another instance of Moodle?
Best regards,
Michael
Hi Michael, I will get this installed onto another Moodle, to test it out - it will be next week now, as I don't have permissions to install plugins onto that Moodle.
Thanks again for your efforts with this, they are very much appreciated.
As I have not heard back from you, I will assume that you figured it out and got the {ifmobile} tags working. I am closing this ticket as I will be releasing this in the latest FilterCodes on Moodle.org shortly.
Please feel free to create a new issue ticket if you have additional information which might help me reproduce your issue.
Best regards,
Michael
Hi Michael - sorry for the tardy response, but with Easter, and me only working part time these last 2 weeks, things took longer than they should. Anyway - we have finally got the latest version of the plugin installed, and it has worked as expected on the mobile showing the correct text. Thanks again for your efforts with this.
Hi Dave,
No worries. Thanks for getting back to me and confirming that all is well. Hope you had a great Easter.
Best regards,
Michael
Would it be possible to add filter codes to show or not show content based on if they are using the Moodle Mobile app e.g. something along the lines of:
{ifmobile}{/ifmobile} {ifnotmobile}{ifnotmobile}
I have a course which uses activity autolinking to create navigation between items, but if accessed via the mobile app, the link takes the user out of the app and to the browser and links that way. So if I were to put my links inside the {ifnotmobile] tags, then these wouldn't show for those using the mobile app?