reditech
Forum Replies Created
-
Have solved this (sort of) with dynamic hyperlinks and have updated the page. However, there are a few things that need attention:
Instead of the Id for Location1 and Location2 and Category1 and Category2, I want to have the values of those Id’s. I can get it to work with custom sql but am unable to get the dynamic hyperlinks working when using query rather than table/view.
Also need an example of a nested macro for displaying icons – there are several different types of icons I wish to display. Maybe I need a use case such as:
If id=1, display this image, if Id=2, display alternate image, if Id=3, display a 3rd image etcWhen I go into data explorer, I see ConvictsView and can open and explore that. There is nothing listed as ironcladsister_women.ConvictsView
Thanks
Hi Peter
No, am using database on the same site. I have moved it from old site.
Thanks
Andrew
Can you assist with how I generate the error logs?
Hi
I’ve followed the instructions but there still seems to be a problem. When I run the SQL Query it comes up with WordPress database error: ‘ironcladsister_women.ConvictsView’ is not VIEW
And when I try to load a certain table on the site, it comes up with ERROR: Table ‘ironcladsister_wpress.tblShips’ doesn’t exist
Obviously something isn’t quite correct following the migration.
Thanks
Andrew
Thanks Peter. Finally got back to this and with a bit of massaging, the code is working great.
Terrific plugin.
Thanks so much for the code. I was getting a 403 error and after sorting out caching with my webserver, I am now getting 0 which according to my research says that the action is not being called, or not registered.
I have now been looking at the need to create a plugin with this code?
Am aware that I want the code to be in a place that won’t be overwritten when there is a theme/wordpress update but not exactly sure which file the action needs to be included in. Can you provide any tutorial links?
Thanks again – learning heaps.
OK, I may be getting beyond my level of expertise however, it seems that I need to create a page that the dynamic link goes to which then determines if user is then logged in and if so, displays the attachment, and if not, goes to login/register page.
It will be a matter of passing the attachment filename from the original page through the “intermediary/user check” page as the filename changes with every record.
Thanks
Andrew
Hi Peter
Things are progressing well and have the dynamic hyperlinks working with a view. However I am trying to implement where the user can only download if they are logged in, else it says ‘Members Only’
The code I have in the dynamic hyperlink field is below but something is going wrong. Also not sure if this is where I should be placing this code?
Thanks for your assistance.
Andrew
<?php if (!is_user_logged_in() ) { echo "<a href="https://www.reditech.com.au/jessgirls/files/$$AttachmentFileName$$" target="_blank" rel=" noreferrer noopener"><img src="https://reditech.com.au/jessgirls/wp-content/uploads/2022/08/pdf-icon.png" alt="" width="30" height="30"/></a>; else { echo <a href="https://www.reditech.com.au/jessgirls/wp-login>Members Only</a>"; } ?>Hi Peter
I have created the dynamic hyperlink to the file and can access it when looking at that particular table. However, I want to join several tables and include this dynamic hyperlink in the sql statement. The instructions on dynamic hyperlinks says to use the “Select” button which is only available when the ‘Table or View’ radio button is selected. How do I reference a hyperlink when using the ‘Custom Query’ radio button as there are other formatting and organisational options I want to include on various other fields.
Thanks
Andrew
That sounds workable and also perhaps answers another question about where to store the pdf files. Sounds like it would be better to store them in a directory and just have the url in the database. Thoughts?
Will give your suggestion a try.
This sort of answers the question and what you have provided will definitely be useful. However, I am wanting to limit the downloading of files to only logged in users.
So, the table would be:
Name File
Sam xyz.pdfWhen the user clicks on xyz.pdf if they are not logged in then it wouldn’t allow them to download the file. But I still want them to see that there is a file available to encourage them to register.
Hope this is clearer.
Hi
Initially it will be read only tables but there is scope for it to be developed whereby users can contribute – possibly not to the existing tables but to newly created tables.
I guess one work around would be to create public pages which have dummy links that when clicked go to the login. And then on user pages the links actually link to the file. Not ideal as it essentially means two pages per function but could possibly work.
Thanks
Andrew